public void FirstChanceException_Called()
{
bool flag = false;
EventHandler<FirstChanceExceptionEventArgs> handler = (sender, e) =>
{
Exception ex = (Exception) e.Exception;
if (ex is FirstChanceTestException)
{
flag = !flag;
}
};
AppDomain.CurrentDomain.FirstChanceException += handler;
try {
throw new FirstChanceTestException("testing");
}
catch
{
}
AppDomain.CurrentDomain.FirstChanceException -= handler;
Assert.True(flag, "FirstChanceHandler not called");
}