Question is taken from here: SO - Timeout in c# tests
I created a simple unit test like this:
[Timeout(1000)][TestMethod]
public void TestMethod1()
{
try
{
System.Threading.Thread.Sleep(2000);
}
finally
{
Console.WriteLine("Executed");
}
}
When I run the test, the finally block is not executed. But when I debug it, it does. Why is this happening?