Writing Unhandled Exceptions to the event log
Hi,
I am working in Visual Studio 2005.
Can anyone help me configure my Class Library application to write unhandled exceptions to the event log?
My problem is that on the Application tab of my project's properties, the View Application Events button is disabled.
How can I ensure that all unhandled events are caught and logged?
Re: Writing Unhandled Exceptions to the event log
You can create an event handler for unhandled exceptions.
Check out this article:
codeproject.com/dotnet/unhandledexceptions.asp
Re: Writing Unhandled Exceptions to the event log
Thanks for the link, but that code only works for Windows Forms applications, not Class Libraries.
Re: Writing Unhandled Exceptions to the event log
You can't catch all exceptions from a library in the library unless you only access that library through a single point. The reason that you can do it with applications is that you do have that sinlge point of entry, like a Main method or the MyApplication object in VB 2005.
Re: Writing Unhandled Exceptions to the event log
Quote:
Originally Posted by simonm
Thanks for the link, but that code only works for Windows Forms applications, not Class Libraries.
Sorry. I guess you'd have to make a ton of Try/Catch blocks then :/