سؤال

When debugging with elmah, is there any way to inspect the actual variables in an exception?

I know that I can find the http-get/post variables in the querystring/form section, but is there any way to see the current values of variables in the method where the exception is thrown?

هل كانت مفيدة؟

المحلول

Elamh does not have direct support for that, in fact even .NET does not provide this type of support natively. You can see this previous question Values of local variables in C# after exception? where the way that a third-party tool handles the capturing of local variables during an exception.

You can use this an example and build your own exception handling and throw a custom error type to Elmah via something similar to the following:

 try
 {

   ...
 } 
 catch (Exception ex)
 {
    Elmah.ErrorSignal.FromCurrentContext()
       .Raise(new CustomException(ex,<insert method variables here>));
 }
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top