[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

-Bernhard

________________________________________
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:
https://na01.safelinks.protection.outlook.com/?url=https%3a%2f%2fmsdn.microsoft.com%2fen-us%2flibrary%2f0yd65esw.aspx&data=01%7c01%7cbeurba%40microsoft.com%7c8f639762e9994b298d1308d39aa0b29e%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=r%2fwVA7R%2fwmNwL59E03eJ9lzTA7HuOkswoPcSe2V8ago%3d

And just to confirm you're right, you *should* expect the stack to be preserved, if you throw without any arguments.
https://na01.safelinks.protection.outlook.com/?url=https%3a%2f%2fmsdn.microsoft.com%2fen-us%2flibrary%2fms182363.aspx&data=01%7c01%7cbeurba%40microsoft.com%7c8f639762e9994b298d1308d39aa0b29e%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=PcQ5QhsbXHxVUhu2vJKNRTAdoYFrbgaShShhNmSXFB0%3d

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
https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2flists.ximian.com%2fmailman%2flistinfo%2fmono-list&data=01%7c01%7cbeurba%40microsoft.com%7c8f639762e9994b298d1308d39aa0b29e%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=VayCRiA7CUa04VaCV3lZ4%2bLYsJJl9ApomsOSmWcS4TU%3d


More information about the Mono-list mailing list