Bug 60862 - Stack overflow throws null (null is caught)
Summary: Stack overflow throws null (null is caught)
Alias: None
Product: Runtime
Classification: Mono
Component: General ()
Version: 5.8 (2017-10)
Hardware: PC Mac OS
: Normal normal
Target Milestone: Future Cycle (TBD)
Assignee: Bernhard Urban
Depends on:
Reported: 2017-11-26 13:49 UTC by Frederik Gelder
Modified: 2018-02-11 16:29 UTC (History)
6 users (show)

Tags: bugpool-archive
Is this bug a regression?: ---
Last known good build:

repro.cs (1.56 KB, text/plain)
2017-11-27 22:27 UTC, Ludovic Henry

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Frederik Gelder 2017-11-26 13:49:47 UTC
ive stumbled upon this yesterday in my project.

here is a working minimal example https://pastebin.com/SxGNDNia

here is the output of mono -V

Mono JIT compiler version (tarball Wed Nov 8 20:37:08 UTC 2017)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: softdebug
LLVM: supported, not enabled.
GC: sgen (concurrent by default)

(didnt know if i shouldve selected 5.4 in the above version selector, but it didnt fit the date)
im on ubuntu 16.04

in the example i deliberately create a stackoverflow exception (like it accidentally happened in my codebase). in the outer try catch i then catch an exception, which is null. i would either expect a stackoverflowexception instance, or the same behaviour as .net framework (the code will let the runtime abort the process on windows). 

the example code bit is part of a visual studio solution (vs 2017) (i can also provide the whole project if needed)

i compiled the solution on linux using msbuild (cd into solution dir, call msbuild)
then i ran the exe with mono --debug <exe name>

instead of the program continuing to run, and telling me there was a fault detected, i would expect some message like "process was aborted due to stack overflow", just like .net framework does. (personally i would prefer it to throw the exception so i can log it, but framework doesnt do it either).
Comment 1 Ludovic Henry 2017-11-27 22:27:18 UTC
Created attachment 25841 [details]

I can reproduce with Mono (2017-10/efce3b256a5).

It doesn't behave like a typical stack overflow exception where there is nested stack overflow, and it actually behaves quite decently, so I don't really know why we get a `ex = null` at the end.

Zoltan, would you mind taking a look at this one?

Thank you,
Comment 2 Bernhard Urban 2018-01-08 23:00:29 UTC