Reputation: 59
I need a general purpose (any C#
app) way of catching the event of any type of C#
application ending so I can write log data to a file at that time.
I discovered that Microsoft.Win32.SystemEvents.EventsThreadShutdown
does not catch the shutdown
event for a Multithreaded C# application I am testing with called SrcChess2
. EventThreadShutdown
does work with simple single threaded applications.
I then discovered that AppDomain.CurrentDomain.ProcessExit
does seem to work correctly with Multithreaded and single threaded apps.
Can anyone explain why EventsThreadsShutdown
does not always work, does not work with my Multithread Application?
Thanks!
Upvotes: 2
Views: 135