SmartAssembly 7

Reporting handled exceptions

Once enabled, Automatic Error Reporting intercepts all unhandled exceptions and reports them to you automatically. 

If required you can also report handled exceptions. 

To report a handled exception:

  1. Reference the assembly %ProgramFiles%\Red Gate\SmartAssembly 7\SDK\bin\SmartAssembly.ReportException.dll (this dependency will be removed when processed).

    For .NET Core applications, you should use .NET Standard version of the SDK assembly, located in: %ProgramFiles%\Red Gate\SmartAssembly 7\SDK\bin\SmartAssembly.ReportException_NetStandard.dll

  2. For any public method that can throw an exception which you wish to report, create a try-catch block and add a call to ExceptionReporting.Report as follows: 

    using SmartAssembly.ReportException;
    public class MyClass
    {
      public bool DoSomething()
       {
          try
          {
             DoSomethingInternal();
             return true;
          }
          catch (Exception exception)
          {
             ExceptionReporting.Report(exception);
             return false;
          }
       }
    }
  3. The error reporting dialog box is shown (unless the Automatic template is enabled).
  4. The program continues after the exception has been reported.

Didn't find what you were looking for?