I'm researching some behaviour in our application and made a test that consistently makes the test engine crash. I simplified the test code into this:
[TestMethod, Timeout(2000)]
public void ShowDialogShouldCleanupAfterException()
{
    var topWindow = new Window();
    topWindow.Loaded += (sender, args) =>
    {
        var childWindow = new Window();
        childWindow.Loaded += (o, eventArgs) =>
        {
            throw new Exception("ChildWindowException");
        };
        childWindow.ShowDialog();
        topWindow.Close();
    };
    topWindow.ShowDialog();
}
Everytime I run this code a dialog pops up telling me vstest.executionengine.exe has stopped working. Why is this happening and can I do something to make sure the test keeps running when this happens? 
EDIT
Similar behaviour occurs in a WPF Sample application:
public partial class MainWindow : Window
{
    public MainWindow()
    {
        InitializeComponent();
        Loaded += MainWindow_Loaded;
    }
    private void MainWindow_Loaded(object sender, RoutedEventArgs e)
    {
        var childWindow = new Window();
        childWindow.Loaded += ChildWindow_Loaded;
        childWindow.Owner = this;
        try
        {
            childWindow.ShowDialog();
        }
        catch (Exception)
        {
            MessageBox.Show("Exception caught");
        }
    }
    private void ChildWindow_Loaded(object sender, RoutedEventArgs e)
    {
        throw new NotImplementedException();
    }
...
I understand this code has problems. Catching the exception in the child dialog would solve this. But I'm simply trying to understand why it behaves like this.