Bug 24647

Summary: ExceptionDispatchInfo::Throw does not replace capture stack trace
Product: [Mono] Runtime Reporter: Marek Safar <masafa>
Component: JITAssignee: Marek Safar <masafa>
Status: RESOLVED FIXED    
Severity: normal CC: kumpera, mono-bugs+mono, mono-bugs+runtime
Priority: ---    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS   
Tags: Is this bug a regression?: ---
Last known good build:
Bug Depends on:    
Bug Blocks: 18629    

Description Marek Safar 2014-11-19 07:37:37 UTC
Mono's ExceptionDispatchInfo.Throw captures exception but it should thrown captured exception from ExceptionDispatchInfo::Capture

>>>>>>>>>>>>>>>>>>>
using System;
using System.Diagnostics;
using System.Reflection;
using System.Threading.Tasks;
using System.Runtime.ExceptionServices;

public class Tests
{
	public static void Main (String[] args)
	{
		var e = new Exception ("test");
			
		var edi = ExceptionDispatchInfo.Capture (e);

		try {
			edi.Throw ();
		} catch {
		}

		edi.Throw ();

	}
}

Mono:

Unhandled Exception:
System.Exception: test
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0
  at Tests.Main (System.String[] args) [0x00000] in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0
  at Tests.Main (System.String[] args) [0x00000] in <filename unknown>:0

.NET

Unhandled Exception: System.Exception: test
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Tests.Main(String[] args)
Comment 1 Marek Safar 2015-02-18 10:26:36 UTC
Could this please be addressed, it makes async stack traces pretty hard to read
Comment 2 Marek Safar 2015-04-13 11:46:36 UTC
Fixed in master