Khare, Atul

A .NET Blog

<January 2009>
SuMoTuWeThFrSa
28293031123
45678910
11121314151617
18192021222324
25262728293031
1234567


Navigation

Subscriptions

Post Categories



UnhandledExceptionEventHandler quirk...

Managed code programs can use AppDomain.UnhandledExceptionEventHandler to trap unhandled exceptions and it works great. However, there's an interesting quirk that might be of interest in situations where your managed code assembly (DLL) might be used inside an unmanaged process. It appears that for some reason, this event is NOT fired if an managed code exception is thrown inside an unmanaged process. Come to think of it, it kind of makes sense because the CLR needs to walk the entire call stack to find if an exception handler is in place and fire the event only if no exception handler is found. My guess is that the stack walk terminates if an unmanaged code frame is detected and the exception is swallowed. Just out of curiosity, is this behaviour by design?

posted on Wednesday, November 10, 2004 9:19 PM by dotnetruminator





Powered by Dot Net Junkies, by Telligent Systems