Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

MessageBox closes immediately in DispatcherUnhandledException handler

$
0
0
Hi,

I have a DispatcherUnhandledException handler in Application.xaml.vb which should simply display an error message to the user, and after the user presses OK, shutdown the application.  Code:

    Private Sub GeneralExceptionHandler(ByVal sender As Object, ByVal e As DispatcherUnhandledExceptionEventArgs)

        ClosingAfterException = True

        MessageBox.Show("Exception: " + e.Exception.Message, "Fatal Error", MessageBoxButton.OK)

        MyBase.Shutdown()

        e.Handled = True

    End Sub
The message box does display, but only for a fraction of a second.  It doesn't wait for the user to press OK.  I tried a sample from MSDN which does something like this and the message box does stick around for the user to click on the button.  Any idea as to what could be causing this behavior?

Thanks,
Michel

Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>