[Mono-list] Mono does not include full stacktrace while rethrowing exception

Алексей Богомолов horse315 at gmail.com
Wed Jun 22 09:36:20 UTC 2016


Hi, Alan! I understand inlining in Release configuration. I should have
mentioned that I'm running in Debug mode in both cases.

Bernard, I tried running with and without inlining in Debug configuration.
Thre result *with* inlining is:

System.NotImplementedException: The method or operation is not implemented.
  at TestApp.ExceptionReThrow.M2 () [0x00001] in
D:\source\TestApp\TestApp\ExceptionReThrow.cs:31

*without *inlining:

System.NotImplementedException: The method or operation is not implemented.
  at TestApp.ExceptionReThrow.M3 () [0x00001] in
D:\source\TestApp\TestApp\ExceptionReThrow.cs:42
  at TestApp.ExceptionReThrow.M2 () [0x00003] in
D:\source\TestApp\TestApp\ExceptionReThrow.cs:32

So, in Mono a allways loose original Test-M1-M2 method call chain.


2016-06-21 20:55 GMT+03:00 Bernhard Urban <beurba at microsoft.com>:

> You can try to run mono without inlining: `mono -O=-inline [...]'
>
>
> ------------------------------
> *From:* mono-list-bounces at lists.ximian.com <
> mono-list-bounces at lists.ximian.com> on behalf of Alan <
> alan.mcgovern at gmail.com>
> *Sent:* Tuesday, June 21, 2016 2:33 AM
> *To:* Алексей Богомолов
> *Cc:* Mono List
> *Subject:* Re: [Mono-list] Mono does not include full stacktrace while
> rethrowing exception
>
> This happens on .NET too. This gives a good description of what's
> happening and why.
>
>
> http://www.hanselman.com/blog/ReleaseISNOTDebug64bitOptimizationsAndCMethodInliningInReleaseBuildCallStacks.aspx
> <https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fwww.hanselman.com%2fblog%2fReleaseISNOTDebug64bitOptimizationsAndCMethodInliningInReleaseBuildCallStacks.aspx&data=01%7c01%7cbeurba%40microsoft.com%7cf5f2327fd4a34d18817208d399b71770%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=OW3ca33WcWiqD83Jujdu9dArjwARXrWC5ssdRcMU0CU%3d>
>
> Alan
>
> On 21 June 2016 at 09:31, Алексей Богомолов <horse315 at gmail.com> wrote:
>
>> 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?
>>
>>
>>
>>
>>
>> _______________________________________________
>> Mono-list maillist  -  Mono-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-list
>> <https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2flists.ximian.com%2fmailman%2flistinfo%2fmono-list&data=01%7c01%7cbeurba%40microsoft.com%7cf5f2327fd4a34d18817208d399b71770%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=HCjwCdQLyKc7gIOR1gMdBebupL2mSvlwxQGIGcDvYGM%3d>
>>
>>
>


-- 
С уважением, Алексей Богомолов horse315 at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-list/attachments/20160622/e575e195/attachment-0001.html>


More information about the Mono-list mailing list