Custom Properties

From RedGateWiki
Jump to: navigation, search

Back to SmartAssembly SDK

C#

  1. protected override void OnReportException(ReportExceptionEventArgs e)
  2.     {
  3.                         // Get the .NET Framework version
  4.                         string dotNetVersion = String.Format("v{0}.{1}.{2}", System.Environment.Version.Major,
  5.                                                                                                                                   System.Environment.Version.Minor,
  6.                                                                                                                                   System.Environment.Version.Build);
  7.                         // Add the Framework version to the exception report
  8.                         e.AddCustomProperty("FrameworkVersion", dotNetVersion);
  9.       for (int i=0; i<3; i++)
  10.       {
  11.         if (e.SendReport()) break;
  12.       }
  13.       e.TryToContinue = true;
  14.     }

VB

  1. Protected Overrides Sub OnReportException(e As ReportExceptionEventArgs)
  2.   ' Get the .NET Framework version
  3.   Dim dotNetVersion As String = [String].Format("v{0}.{1}.{2}", System.Environment.Version.Major, System.Environment.Version.Minor, System.Environment.Version.Build)
  4.   ' Add the Framework version to the exception report
  5.   e.AddCustomProperty("FrameworkVersion", dotNetVersion)
  6.   For i As Integer = 0 To 2
  7.     If e.SendReport() Then
  8.       Exit For
  9.     End If
  10.   Next
  11.   e.TryToContinue = True
  12. End Sub
Personal tools