Hey,

It's not just inlining that'll cause a problem, it's also tailcalls. Read
the section that starts right after this sentence: "Plus, we haven't tried
64-bit yet. Let's run the Release build on 64-bit:"

It's pretty hard to guarantee you'll always get every stackframe on either
.NET or mono without hacking up every method because that stackframe may
not actually exist at runtime. This is especially true if you're running F#.

Alan

On 22 June 2016 at 10:36, Алексей Богомолов <horse...@gmail.com> wrote:

> 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 <beu...@microsoft.com>:
>
>> You can try to run mono without inlining: `mono -O=-inline [...]'
>>
>>
>> ------------------------------
>> *From:* mono-list-boun...@lists.ximian.com <
>> mono-list-boun...@lists.ximian.com> on behalf of Alan <
>> alan.mcgov...@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, Алексей Богомолов <horse...@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@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>
>>>
>>>
>>
>
>
> --
> С уважением, Алексей Богомолов horse...@gmail.com
>
_______________________________________________
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to