Re: Mono does not include full stacktrace while rethrowing exception

Bernhard Urban <[email protected]>
Newsgroups gmane.comp.gnome.mono.general
Message-ID <[email protected]>
You can try to run mono without inlining: `mono -O=-inline [...]'


________________________________
From: [email protected] <[email protected]> on behalf of Alan <[email protected]>
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, Алексей Богомолов <[email protected]<mailto:[email protected]>> 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  -  [email protected]<mailto:[email protected]>
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>

_______________________________________________
Mono-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.