[Mono-list] Mono does not include full stacktrace while rethrowing exception
Алексей Богомолов
horse315 at gmail.com
Tue Jun 21 08:31:04 UTC 2016
This behavior makes difficult to troubleshoot errors, especially in
external libraries. Example code:
public class ExceptionReThrow{
public void Test(){
try
{
M1 ();
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
public void M1()
{
M2();
}
private void M2()
{
try{
M3();
}catch{
throw;
}
}
private void M3()
{
throw new NotImplementedException();
}}
For Microsoft .Net output will be:
System.NotImplementedException: The method or operation is not implemented.
at TestApp.ExceptionReThrow.M3() in
D:\source\TestApp\TestApp\ExceptionReThrow.cs:line 38 at
TestApp.ExceptionReThrow.M2() in
D:\source\TestApp\TestApp\ExceptionReThrow.cs:line 32 at
TestApp.ExceptionReThrow.M1() in
D:\source\TestApp\TestApp\ExceptionReThrow.cs:line 24 at
TestApp.ExceptionReThrow.Test() in
D:\source\TestApp\TestApp\ExceptionReThrow.cs:line 14
For mono (4.2.3) output will be:
System.NotImplementedException: The method or operation is not implemented.
at TestApp.ExceptionReThrow.M3 () [0x00001] in
D:\source\TestApp\TestApp\ExceptionReThrow.cs:38 at
TestApp.ExceptionReThrow.M2 () [0x00003] in
D:\source\TestApp\TestApp\ExceptionReThrow.cs:30
As you can see, mono looses stack between first and second catch
statements. What is the explanation for this feature? Can I disable it?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-list/attachments/20160621/600e8417/attachment.html>
More information about the Mono-list
mailing list