Tuesday, December 19, 2006

COM+ task and Microsoft bug

Yesterday, we (Hanaa and I) handed COM+ task, and got the full mark (ALL Thanks to ALLAH).

COM+ task was very easy to develop no need for any types of skills just know how to talk to database and have a soul to solve damn exceptions.

While working in this task, I solved a nice exception reported as a bug by Microsoft in Visual Studio .NET 2003, but they forgot to solve it in Visual Studio 2005 as we were working on Visual Studio 2005 :D

Bug is: Cannot copy assembly [Referenced Assembly] to file [Current Project Output Folder]\bin\Debug\Release\[Referenced Assembly].dll. The process cannot access the file because it is being used by another process.

You can say the solution is to kill your application process from task manager, I am sorry for saying you won’t find it there :D

Their solution is, to solve this bug you have to call Microsoft Technical Support and install a hotfix …

No, you do not need that at all…. all you need is to kill process called “dllhost” from your task manager…. sure you do not need to make that each time you compile your application, so in application close event call this function OnCloseDo();

private void OnCloseDo()
{
Process[] dllHostProcesses = Process.GetProcessesByName("dllhost");
foreach (Process p in dllHostProcesses)
p.Kill();
}

For more details about this bug http://support.microsoft.com/kb/887818

I am going to write an article about how to COM+ , After ALLAH willing ;)

Happy, fixing ;-)