I'm pretty sure that I can implement this kind of behavior using my AOP engine and an intra-method join-point (don't know what to call it, perhaps catch?) I can supply the context information in the call to Method2(), and IsExecutingAsExceptionHandler() would simply have to read the context information.
More importantly: why would you want to do this? -John http://www.iunknown.com -----Original Message----- From: Jan Strube [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 30, 2002 8:31 PM To: [EMAIL PROTECTED] Subject: [ADVANCED-DOTNET] Detect Exception Handler I am wondering if it is possible to detect if some code executes as an Exception handler. What I am after is the implementation of IsExecutingAsExceptionHandler() in the following sample: void Method1() { Method2(); try { throw new Exception(); } catch { Method2(); } } void Method2() { if (IsExecutingAsExceptionHandler()) MessageBox.Show("Executes as exception handler"); else MessageBox.Show("Normal execution"); } I am aware that I could pass on the exception object to Method2, but I am looking for a way to avoid this. Thanks, Jan Strube You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.
