[Mono-list] Mono does not include full stacktrace while rethrowing exception

Bernhard Urban beurba at microsoft.com
Thu Jun 23 04:39:21 UTC 2016

I agree with Edward, here's a PR: https://github.com/mono/mono/pull/3201


From: mono-list-bounces at lists.ximian.com <mono-list-bounces at lists.ximian.com> on behalf of Edward Ned Harvey (mono) <edward.harvey.mono at clevertrove.com>
Sent: Wednesday, June 22, 2016 4:52 AM
To: Алексей Богомолов; mono-list at lists.ximian.com
Subject: Re: [Mono-list] Mono does not include full stacktrace while rethrowing exception

> From: mono-list-bounces at lists.ximian.com [mailto:mono-list-
> bounces at lists.ximian.com] On Behalf Of ??????? ?????????

First, just to be sure you know, you *almost* should never catch and rethrow, because you're not adding new information. If you want to add new information, generally you should throw a new exception and include an InnerException. Here are some examples of situations you would want to catch and rethrow:

And just to confirm you're right, you *should* expect the stack to be preserved, if you throw without any arguments.

I've confirmed the behavior you reported. In a debug build, on windows, and on mono, the behavior is not the same on .NET and on mono. It should be.

I think this is probably an actual bug and I'll go report it.
Mono-list maillist  -  Mono-list at lists.ximian.com

More information about the Mono-list mailing list