Simon,
The logical boundary for exceptions being thrown is not an assembly.
Rather, it is the thread that is currently executing.
The code you have will do two things. The first is handle ^unhandled^
exceptions that are thrown in the UI thread (where the static Run method on
the Application class is called).
The second will handle exceptions that are thrown on all threads in the
application which are ^unhandled^.
If there is a try/catch block around the area where exceptions are
thrown, then these methods will not be called. These two methods only
handle unhandled exceptions.
If you find this is not the case, then provide a complete example
showing the behavior.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
(E-Mail Removed)
"Simon Tamman" <(E-Mail Removed)>
wrote in message news:bbjIg.16850$(E-Mail Removed)...
>I have an object named DisasterRecovery. The Ctor of this object is this:
>
> private DisasterRecovery()
> {
> Application.ThreadException+=
> new
> System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
> AppDomain.CurrentDomain.UnhandledException
> +=new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
> }
>
> It's private as only 1 static instance of this object is created and
> accessed via a singleton.
> I would have thought that all exceptions that occur in my program would
> have
> been caught by this object but this doesn't seem to be the case.
> Exceptions
> that occur in different assemblies do not appear to be caught (the
> stacktrace shows nothing of this object getting involved at any stage).
> Is there a generic method of catching exceptions in other assemblies (like
> Application.AssemblyException or something) or is my implementation of
> this
> object incorrect?
>
> Kind Regards
>
> Simon
>
>
>