Export (0) Print
Expand All
Run
Expand Minimize

RuntimeErrorEventArgs

Silverlight

Provides data for runtime error events.

RuntimeErrorEventArgs is obtained as input for your own event handlers.

By specifying error handlers as part of initial Silverlight plug-in instantiation code, you can introduce custom error handling even for runtime errors, including suppressing error dialog boxes.

The following JavaScript example shows the portion of an event handler that displays error information specific to runtime errors.

// errorArgs is an instance of RuntimeErrorEventArgs.
    if(errorArgs.ErrorType == "RuntimeError")
    {
      var runtimeErrorMsg = "Silverlight Runtime Error  \n\n";
            
      // Provide basic error event information.
      runtimeErrorMsg += "Error Type:    " + errorArgs.errorType     + "\n";
      runtimeErrorMsg += "Error Message: " + errorArgs.errorMessage  + "\n";
      runtimeErrorMsg += "Error Code:    " + errorArgs.errorCode  + "\n";
            
      // Provide runtime-specific error event information.
      if (errorArgs.lineNumber != 0)
      {
        runtimeErrorMsg += "Line:     " + errorArgs.lineNumber     + "\n";
        runtimeErrorMsg += "Position: " +  errorArgs.charPosition  + "\n";
      }
     
     runtimeErrorMsg += "MethodName: " + errorArgs.methodName     + "\n";
            
     alert(runtimeErrorMsg);
    }

Community Additions

ADD
Show:
© 2014 Microsoft