Share via


Error Messages

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

The primary programming model for Silverlight is a managed API, but errors (as opposed to exceptions) still exist at several points in the overall architecture and in the supporting development environment.

Script Errors in the DOM

Silverlight is ultimately a plug-in hosted in one of two possible control models (COM or NPAPI). You introduce Silverlight into the host using an object element, or some technique that introduces the plug-in instance into the DOM directly.

During the phase where Silverlight is being introduced to the host, it is possible that errors are reported to scripting even before the plug-in instance can be instantiated. This might happen if you specify param elements with invalid data, or specify invalid values for an attribute of the object element such as data.

The next phase of possible errors is if values for SplashScreenSource or Source are invalid or the URIs specified cannot be resolved. Problems during this phase have not yet enabled the Silverlight infrastructure to initiate with either possible API (JavaScript or managed) and can only be reported to the DOM. The Silverlight documentation does not include reference for general DOM error messages, but troubleshooting information for initialization is included in various topics that are linked from Adding Silverlight to a Web Page by Using HTML or JavaScript.

If there are no errors to this point, and the managed API is now initiated by a successful package loading of Source, then most errors that originate with Silverlight can now be handled as managed application exceptions. For details, see Application Services.

Native Code Basis of the Silverlight Plug-in

If you are using the managed API, most handling has transitioned to exception handling by the application. However, there is still the possibility that certain errors that originate from the Silverlight native code will be surfaced, without first raising UnhandledException. If you are deliberately using the JavaScript API, your error handling model will be based on such errors.

Handling native/script errors is described in Error Handling, and the error message are listed in Silverlight Plug-in Error Messages.

Errors from Scripts, Tools, or Dialogs

The remainder of reference topics in this reference section describe errors that originate with specific scripts, tools, or tool dialogs that support Silverlight development.