Hi there,
I have an add-in that's looping through all files in Solution Explorer and calling "ProjectItem.FileCodeModel" for each (on the main thread). That call is causing the "USER Handles" count for "devenv.exe" to increase by 2 or 3, as seen in the Windows Task Manager. I'm therefore calling "Marshal.ReleaseComObject()" on my "FileCodeModel" reference until "Marshal.ReleaseComObject()" reaches zero. Presumably that should cause "USER Handles" to move back down again and on my machine it does, 99% of the time anyway. It should be 100% in theory, but more importantly, for one of my customer (using VS 2010), it doesn't move down at all (on multiple machines). I can even see this in code by passing 1 to "GetGuiResources()", which returns the "USER Handles" count, as currently found here:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms683192(v=vs.85).aspx
Can anyone explain this. It ultimately causes a resource leak, since my customer's app is very large, so eventually the 10,000 handle limit in Windows itself is exceeded (after looping through thousands of their files). Note that calling GC.Collect()" doesn't help BTW (but shouldn't be necessary). Thanks for your help.