Dela via


CoreApplication.UnhandledErrorDetected Event

Definition

Occurs when there is an underlying error that is routed to the CoreApplication instance, as part of global error handling logic.

// Register
static event_token UnhandledErrorDetected(EventHandler<UnhandledErrorDetectedEventArgs> const& handler) const;

// Revoke with event_token
static void UnhandledErrorDetected(event_token const* cookie) const;

// Revoke with event_revoker
static CoreApplication::UnhandledErrorDetected_revoker UnhandledErrorDetected(auto_revoke_t, EventHandler<UnhandledErrorDetectedEventArgs> const& handler) const;
public static event System.EventHandler<UnhandledErrorDetectedEventArgs> UnhandledErrorDetected;
function onUnhandledErrorDetected(eventArgs) { /* Your code */ }
Windows.ApplicationModel.Core.CoreApplication.addEventListener("unhandlederrordetected", onUnhandledErrorDetected);
Windows.ApplicationModel.Core.CoreApplication.removeEventListener("unhandlederrordetected", onUnhandledErrorDetected);
- or -
Windows.ApplicationModel.Core.CoreApplication.onunhandlederrordetected = onUnhandledErrorDetected;
Public Shared Custom Event UnhandledErrorDetected As EventHandler(Of UnhandledErrorDetectedEventArgs) 

Event Type

Remarks

As part of an app's life cycle management code, developers can inspect error data (UnhandledError) from an UnhandledErrorDetected event, and choose whether to mark the error as handled. If the error is marked handled in the event data, then execution can continue. If the error is not marked handled, the app and its process will be terminated.

Errors that can fire UnhandledErrorDetected include errors that are thrown by code within an async completed handler.

UnhandledErrorDetected will occur if an app-code event handler throws an error, but the reason that the handler was executed was that system code (not app code) raised the event. App code doesn't always see that error or see that the handler executed.

Returning a failure from any delegate clears the handled state of the error.

Applies to