Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets the name of the method that is associated with a run-time error.

value = eventargs.MethodName

Property Value

Type: string

The name of the method.

This property is read/write but should be considered read-only because there is no reason to change the reported information. There is no default.

Managed Equivalent

No direct equivalent, but may be available within the message of an exception.


This property is technically read/write, but there is generally no reason to set it, because the property is simply reporting information from existing errors.

For run-time errors that involve properties, MethodName will report the property name. In these cases, the error message will be either AG_E_RUNTIME_GETVALUE or AG_E_RUNTIME_SETVALUE. This is true even if you explicitly use the GetValue or SetValue utility methods instead of the standard property scripting syntax.


The following JavaScript example shows the portion of an event handler that displays error information that is specific to run-time errors.

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