how to catch an unhandled exception? if all my code wrapped in a try catch?
but an exception occurs all the same, and the application crashes … Maybe there is some general advice?
use:
try
{
...my code
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString(),"Error!",MessageBoxButton.OK);
}
Sample code is not present, because there is a big code and done many things … and it looks like somewhere an error occurs, but where it is try-catch does not show, and the application just closes …
add:
var errorw = MessageBox.Show(e.ExceptionObject.ToString(), "error", MessageBoxButton.OK); e.Handled = true;
And the message: The parameter is incorrect.
Just as we now understand where and what parameter has given is not true? By the way forgot to write that the error occurs when you press Back, when you return to the previous page of the application.
would you try like this