Bug 643371 - Rethrow doesn't preserve stack trace
Summary: Rethrow doesn't preserve stack trace
Status: RESOLVED DUPLICATE of bug 322158
Alias: None
Product: Mono: Runtime
Classification: Mono
Component: debug (show other bugs)
Version: 2.8.x
Hardware: x86 Windows 7
: P5 - None : Major
Target Milestone: ---
Assignee: Martin Baulig
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-03 01:42 UTC by Tomas Matousek
Modified: 2010-10-04 00:11 UTC (History)
1 user (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tomas Matousek 2010-10-03 01:42:17 UTC
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()
Comment 1 Forgotten User vxPDddArjq 2010-10-04 00:11:10 UTC
duplicate.

*** This bug has been marked as a duplicate of bug 322158 ***