[Mono-bugs] [Bug 643371] New: Rethrow doesn't preserve stack trace

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat Oct 2 21:42:20 EDT 2010


https://bugzilla.novell.com/show_bug.cgi?id=643371

https://bugzilla.novell.com/show_bug.cgi?id=643371#c0


           Summary: Rethrow doesn't preserve stack trace
    Classification: Mono
           Product: Mono: Runtime
           Version: 2.8.x
          Platform: x86
        OS/Version: Windows 7
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: debug
        AssignedTo: martin at novell.com
        ReportedBy: tomas.matousek at microsoft.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1;
Trident/5.0)

The methods above the frame that rethrows aren't included in the frames
constructed from an exception object: new System.Diagnostics.StackTrace(e)

This bug prevents IronRuby to display correct stack traces.

Reproducible: Always

Steps to Reproduce:
Compile and run the following code:

using System;
using System.Runtime.CompilerServices;


public class C {

    public static void Main() {
        Baz();
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    public static void Baz() {
        try {
            Bar();
        } catch(Exception e) {
            Console.WriteLine(new System.Diagnostics.StackTrace(e));
        }
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    public static void Bar() {
        try {
          Foo();
        } catch {
          throw;
        }
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    public static void Foo() {
        throw new Exception();
    }

}
Actual Results:  
   at C.Foo()
   at C.Bar()

Expected Results:  
   at C.Foo()
   at C.Bar()
   at C.Baz()

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list