1

Resolved

get-childitem in 'dte:\windows' leaking somehow

description

Running windows 7, 64-bit. In visual studio 2013 I have created a simple test solution. Although we have integration with TFS, this particular project is not in TFS.

I start StudioShell (version 1.6).
§ C:\Windows\system32>cd dte:\
§ DTE:\>dir windows | measure
Count    : 28
Average  : 
Sum      : 
Maximum  : 
Minimum  : 
Property : 

§ DTE:\>dir windows | measure
Count    : 30
Average  : 
Sum      : 
Maximum  : 
Minimum  : 
Property : 
Every time I get a get-childitem on the windows directory I "leak" two windows. If I go deeper into the windows sub-tree, I see more leakage:
§ DTE:\>dir '\windows\solution explorer\CommandBars'
    Location: StudioShell.Provider\PSDTE::windows\solution explorer\CommandBars
    Command Bar: CommandBars
    Available Operations: d+ <      
           Id       Index Type                 Name                    
---------- --       ----- ----                 ----                    
d+~<       0        1     msoBarTypeNormal     Explorer                
§ DTE:\>dir \windows | measure
Count    : 64
Average  : 
Sum      : 
Maximum  : 
Minimum  : 
Property : 
This doesn't seem to happen on the solution sub-tree. The leaks all look like this:
dir | select caption, ObjectKind, Kind, windowstate
...
Visual Studio | MSDN                       {E8B06F52-6D01-11D2-AA7D-00C04F990343}    Tool                                                            vsWindowStateNormal
...

dir | group -property caption
...
Visual Studio | MSDN      {CodeOwls.StudioShell.Paths.Items.UI.ShellWindow, CodeOwls.StudioShell.Paths.Items.UI.ShellWindow, CodeOwls.StudioShell.Paths.Items.UI.ShellWindow, CodeOwls.StudioShell.Paths.Items.UI.ShellWindow...}                                                                                ...
I don't see any apparent proliferation of windows in visual studio, just in the dte provider.

JR

comments

jrvjrv wrote Jul 9, 2014 at 7:33 PM

If I open the web browser window (View, Other Windows, Web Browser), the "leak" stops. If I close the web browser window, the "leak" starts again.

JR

jrvjrv wrote Jul 9, 2014 at 7:58 PM

To clarify my first comment, the caption of the Web Browser window is "Visual Studio | MSDN". I'm guessing that if the web browser window doesn't exist, when StudioShell scans the list of "known" window types (in WindowCollectionNodeFactory.GetNodeChildren()), Visual Studio kindly creates a web browser if it doesn't already exist. I should have noticed that the GUID was actually EnvDTE.Constants.vsWindowKindWebBrowser, but I only just did.

JR

jrvjrv wrote Jul 9, 2014 at 8:09 PM

The following change in WindowCollectionNodeFactory.GetNodeChildren() seems to fix the issue
            foreach (string name in VSWindowKinds.All) {
                try {
                    if (name != VSWindowKinds.WebBrowser) {
                        var w = _windows.Item( name ) as Window2;
                        windows.Add( w );
                    }
                }
                catch {
                    continue;
                }
            }
If the web browser window actually is open it shows up because of the line:
windows.AddRange(from Window2 w in _windows select w);
JR

beefarino wrote Jul 15, 2014 at 5:04 PM

Confirmed in VS 2013.

beefarino wrote May 20, 2015 at 7:06 PM

Fixed in changeset 6559b9bf77d7