Nevermind. It looks like I was thrown off by reading a post from december
that talked about threads just dying when an unhandled exception occurred
unless they were the main thread. I thought that meant that the appdomain
UnhandledException event would not get fired for them, but testing this with
some threads I created myself shows that it does fire. So the problem I am
facing is probably more mundane:
I am subclassing a class in a 3rd party component. I bet they are handling
exceptions and throwing them away in the base class, so my unhandled
exception handler is never getting them and they do not get logged. Looks
like it's try...catch or nothing. Oh well.
"Adam J. Schaff" <(E-Mail Removed)> wrote in message
news:%23hh%(E-Mail Removed)...
> For apps I have written in the past, I have always been able to define a
> global event handler. Something along the lines of this:
>
> AddHandler AppDomain.CurrentDomain.UnhandledException, AddressOf
> MyErrHandlerProc
>
> However, I now have a windows service application and when errors occur in
> it, I do not receive them. I cannot figure out how to tap into unhandled
> exceptions in a windows service. I tried putting the above line of code
into
> both the Sub Main and the OnStart, and followed it with a "Throw New
> Exception" just to see if it would get caught, and it did not. Obviously,
> I'm new to windows service and multi-threaded programming.
>
> Can anyone help me out with exception handling? I'd really hate to have to
> wrap every procedure of my code with try..catch. It's ugly and I'm not
sure
> how it would affect performance.
>
> Any help would be deeply appreciated. Thanks.
>
>
|