Condividi tramite


Exceptions in Managed Threads

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

The common language runtime allows most unhandled exceptions in threads to proceed naturally. In most cases, this means that the unhandled exception causes the application to terminate. In Silverlight-based applications, the user experiences this as an error on the page.

The common language runtime provides a backstop for certain unhandled exceptions that are used for controlling program flow:

  • An AppDomainUnloadedException is thrown in a thread because the application domain in which the thread is executing is being unloaded.

  • The common language runtime or a host process terminates the thread by throwing an internal exception.

If these exceptions are unhandled in threads created by the common language runtime, the exception terminates the thread, but the common language runtime does not allow the exception to proceed further.

If these exceptions are unhandled in the main thread, or in threads that entered the runtime from unmanaged code, they proceed normally, resulting in termination of the application.

NoteNote:

It is possible for the runtime to throw an unhandled exception before any managed code has had a chance to install an exception handler. Even though managed code had no chance to handle such an exception, the exception is allowed to proceed naturally.

See Also

Concepts