Click here to Skip to main content
15,891,375 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello!
I want to know, is that possible to place somewhere in App.xaml.cs method to call for example MessageBox with error, but continue running?
I found that:
C#
Application.Current.DispatcherUnhandledException += new DispatcherUnhandledExceptionEventHandler(Current_DispatcherUnhandledException);


and then in some of window 'raised' exception like :
C#
string a = "1.5";
            decimal.Parse(a);

so that calling messagebox, but also closing app.

Any help? ;)
Posted

1 solution

You can set the Handled property of the DispatcherUnhandledExceptionEventArgs to true, as follows:


C#
void Current_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
    // ...

    e.Handled = true;
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900