Consider this small program. Ignore, if you like, the overall catch, I kept it briefly to try to illustrate the point:
private static void Main(string[] args) { Try(Fail); } private static void Fail() { var x = ((string)null).Clone(); } private static void Try(Action action) { try { action(); } catch (Exception exc) { Debug.WriteLine(exc.StackTrace); } }
At startup, the following is created (with some path information deleted):
at Scratch.Program.Fail() in Program.cs:line 27 at Scratch.Program.Try(Action action) in Program.cs:line 34
My question is: why does the exception stack trace stop unwinding a chain of methods using the Try() method? I would expect it to open from the Main() method.
I was not able to find any documentation that stops throwing an exception bypassing Try() , so I would like to understand this.
source share