I'm trying to implement a login window, in WPF.
I have a MainWindow.xaml:
<Window ...
Closing="Window_Closing">
...
And then in MainWindow.xaml.cs:
private void Window_Loaded(object sender, RoutedEventArgs e) {
LoginWindow loginWindow = new LoginWindow();
loginWindow.Owner = this;
loginWindow.ShowDialog();
...
In the LoginWindow constructor I'm throwing an exception. It's never caught.
If I wrap the contents of Window_Loaded in a try/catch block, I can catch the exception, but if I rethrow it, from within Window_Load(), it's never caught.
This seems very odd, to me. I guess I'm used to environments where uncaught exceptions kill the app. Is there something I need to do to enable this, in WPF?