Sunday, December 09, 2007

Funny Bug in Visual Studio 2008 Beta

While uninstalling MS Visual Studio 2008 Beta 2 I found one funny bug.



Trivial message from uninstaller that indicates that one or more of the files or directories to remove are occupied. The only thing to do is too close this application and click Retry. If this doesn't help, well click Ignore and hope this will not have any negative effect. But... what the heck is application named 4812? Well, it's may be not a name but an ID of process so I open Task Manager and look up for a process with ID 4812. Here it is!



Oops. It is a setup application itself blocked something and couldn't delete it. I tried to click "Retry". And it was a successful attempt process of uninstaller continued.

I even could make a guess why this short story happened but had a good final. While checking files/directories to remove setup.exe locked them. According to my guess releasing of lock is placed in destructor. When message appeared object that locked files was "deleted" but garbage collector wasn't called until that moment so hadn't called destructor. While I was thinking about this problem and taking screenshots garbage collector was invoked and called destructor that released locks. Of course this guess can be true only if setup.exe is using garbage collector. Well, as Andrew Troelsen in his book about C# suggested it is better to manually call method Dispose and release all resources when they already could be released and don't leave this job to GC, which is unpredictable.

Of course my suggestion is only a suggestion, but I think it is rather useful to try to explain bugs in not your applications even if source code is inaccessible.

No comments: