I was trying to understand the behavior of Dispose at time of the exception. I wrote below program.
class Program
{
static void Main()
{
using (var d = new MyDisposable())
{
throw new Exception("Hello");
}
}
class MyDisposable : IDisposable
{
public void Dispose()
{
Console.WriteLine("Disposed"); //Debugger at this line
}
}
}
When I tried to Debug this code by having Debugger at Dispose, my Debugger is not getting hit.
Please Help.