Bug 60862

Summary: Stack overflow throws null (null is caught)
Product: [Mono] Runtime Reporter: Frederik Gelder <frederik.gelder>
Component: GeneralAssignee: Bernhard Urban <bernhard.urban>
Severity: normal CC: bernhard.urban, ludovic, masafa, mono-bugs+mono, mono-bugs+runtime, vargaz
Priority: Normal    
Version: 5.8 (2017-10)   
Target Milestone: Future Cycle (TBD)   
Hardware: PC   
OS: Mac OS   
Tags: bugpool-archive Is this bug a regression?: ---
Last known good build:
Attachments: repro.cs

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