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.

Reply via email to