Subscribe to the Appdomain.UnhandledException event and log it from there.
If you do not handle it then you get the default behavior of the runtime,
which does not log it. For a windows app or asp.net you will also need to
subscribe to the Application.ThreadException and the
Web.HttpApplication.Error event to get all exceptions.
In general you should write the code so you never get a UE. In the shipping
version of the runtime (v1.1) a UE does not cause the app to terminate; in
future versions the app will terminate after a UE has been processed.
"tjfdownsouth" <tj**********@discussions.microsoft.com> wrote in message
news:B3**********************************@microsof t.com...
Is there a straight forward way to tell .net to log any unhandled errors
in
the application log. I am catching and logging in certain locations but
its
the surprise errors that I need to log the information from. I know how
to
log using a try-catch block but i need something for any unforseen error
since my users do not report the description and location correctly.
Thanks for any help.