AppDomain.CurrentDomain.DomainUnload not be raised in Console app

Posted by Guy on Stack Overflow See other posts from Stack Overflow or by Guy
Published on 2010-04-22T17:47:57Z Indexed on 2010/04/22 17:53 UTC
Read the original article Hit count: 400

Filed under:
|
|
|

I have an assembly that when accessed spins up a single thread to process items placed on a queue. In that assembly I attach a handler to the DomainUnload event:

AppDomain.CurrentDomain.DomainUnload += new EventHandler(CurrentDomain_DomainUnload);

That handler joins the thread to the main thread so that all items on the queue can complete processing before the application terminates.

The problem that I am experiencing is that the DomainUnload event is not getting fired when the console application terminates. Any ideas why this would be?

Using .NET 3.5 and C#

© Stack Overflow or respective owner

Related posts about multithreading

Related posts about .net-3.5