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 ;-)

9 comments:

Hanaa Tag el Dain

hey as u said all thanks to allah
& about the bug i won't ever ever ever forget ur face when u saw a bug while we were tracing in the college:D:D:D u get red with surprised eyes :D:D:D u stop talking to ppl u keep scold the program,making alot of comments on the code :D:D:D:D that was bad really bad :D:D:D:D
so i can imagine when u have bug what will u do :D:D:D:D

Anonymous

Yes,Ramy this was a stupid bug .I also face that problem .
I was used Ctrl + Alt + Del to kill "dllhost.dll" process .
but because as i said it is stupid process so every time I kill it , appear again .
I must kill it 3 times as least to disappear for ever.
So thanks Ramy
private void OnCloseDo() is a nice solution .

Ramy Mahrous

@Hanaa
mt2olish aih hoa el bug dah 3lshan mt7'n2sh m3 btataa :D ely mish mnzlaa IIS :'(
yeaa, ana bs b3ml kda mish bshtm wala b3ly soty :$ :)

Ramy Mahrous

@Ahmed Essawy
Welcome Essawy ;)

Mohamed Meshref

mmm, that's a problem, because dllhost is a generic process, it's used to host many other libraries than yours, and when you're killing it you may kill another important library and not yours.

One simple solution is to query the process information using any process information tools, one of the most famous tools in this area is Process Explorer:

http://www.microsoft.com/technet/sysinternals/Utilities/ProcessExplorer.mspx

Ramy Mahrous

@Meshref
I did not find a problem to kill it I think it's a good tool but "We're sorry, but the page you requested could not be found. You might want to try another entry or use the links on this page"

Mohamed Meshref

You didn't face any problem because you were lucky and only one instance of dllhost was running.

About the link, it seems blogger has trancated the link, lets try again:

http://www.microsoft.com/technet/sysinternals/Utilities/ProcessExplorer.mspx

Mohamed Meshref

offfff, blogger is really bad:

[Begin URL]

http://www.microsoft.com/technet/sys

internals/Utilities/ProcessExplorer.

mspx

[End URL]
Please put the three lines in one line, as "a ref" is broken too!!!!

Ramy Mahrous

@Meshref

Thank you :)