.NET Framework Bookmark and Share   
 index > Windows Presentation Foundation (WPF) > DispatcherUnhandledException messagebox exception
 

DispatcherUnhandledException messagebox exception

I am using DispatcherUnhandledExceptionEventHandler in a WPF application as shown in the code below.

public static void Main()

{

App app = new App ();

app.DispatcherUnhandledException += new System.Windows.Threading.DispatcherUnhandledExceptionEventHandler (app_DispatcherUnhandledException);

app.Run(new WPFMain (splashForm));

}

static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)

{

Exception ex = (Exception )e.ExceptionObject;

if (ex != null )

{

LogHelper .LogError(ex.ToString());

ExceptionMessageBox .Show(ex);

}

}



The issue is that whenever some exception happens in the WPFmain form, the control does go to the CurrentDomain_UnhandledException method. But before that i get the following error message window:
Microsoft .NET framework: Unhandled exception has occurred in your application . If you click continue, the application will ignore....

Note: I don't get this window when I debug the project from Visual studio. Any input on this would be of great help

Thanks
Vishal

Vishal Kalia
You have to set e.Handled = true in order the application not close.
Mariano O. Rodriguez
You have to set e.Handled = true in order the application not close.
Mariano O. Rodriguez

You can use google to search for other answers

Custom Search

More Threads

• ComboBox - Unbound : How to set the SelectedItem
• Window.ShowDialog() requires disposal?
• Polygon with Thumbs
• getting the control parent name
• Build error - WPF application manifest and ComCtl32.dll version 6
• How to assign a string value to particular cell in wpf datagrid?
• build treecontrol like MS Blend Objects?
• Why IsLoaded property is not correct
• customizable toolbars?
• Persisting state when using Tab Control