|
-
May 10th, 2006, 04:14 AM
#1
Thread Starter
Fanatic Member
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?
Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment. 
-
May 10th, 2006, 04:26 AM
#2
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
-
May 10th, 2006, 04:37 AM
#3
Thread Starter
Fanatic Member
Re: Writing Unhandled Exceptions to the event log
Thanks for the link, but that code only works for Windows Forms applications, not Class Libraries.
Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment. 
-
May 10th, 2006, 04:40 AM
#4
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.
-
May 10th, 2006, 04:42 AM
#5
Re: Writing Unhandled Exceptions to the event log
 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 :/
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|