<Window x:Class="PreventSessionEnd.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="PreventSessionEnd" Height="300" Width="300"
>
<Grid Margin="5">
<Button Click="cmdException_Click">Throw an Unhandled Exception</Button>
</Grid>
</Window>
//File:Window.xaml.cs
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace PreventSessionEnd
{
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
}
privatevoid cmdException_Click(object sender, RoutedEventArgs e)
{
thrownew ApplicationException("You clicked a bad button.");
}
}
}