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#