Closed ericwj closed 4 years ago
You seem to have bad casing in StackOverflowException in your error message (capital 'F' is incorrect). Could that be the reason? The tests seem to be able to reference it just fine.
Except I didn't type it in the first place - I only did when Ctrl+Space wouldn't find anything.
The type does not exist in .NET Core 1.0 nor 1.1 (about to be released). It will be part of our next release - 1.2 (currently scheduled for Spring 2017 - see milestones). The type was added into our dev/api branch in PR dotnet/corefx#10699.
Oké then I can stop looking ;) Thanks!
Is there have any way to detect System.StackOverflowException ( Which code segments are causing that? ) and prevent app crash at DotNet Core 2.0 or above?
Let's not highjack old bugs for related questions. If you need to debug it, get a dump and analyze the callstack - it will tell you more. There's also general info on the topic: https://stackoverflow.com/questions/1599219/c-sharp-catch-a-stack-overflow-exception
What should I do to reference
System.StackOverFlowException
?I have use to catch
StackOverflowException
, since I am writing code that would rely on the compiler doing tail call optimization. However, trying to catchSystem.StackOverFlowException
, I am presented withCS0246
. I tried to explicitly include some packages, but that was probably futile in concept, since the class should be part of theMicrosoft.NETCore.App
dependency I am using (v1.0.1).I'm sure it's possible as I'm seeing it being referenced in corefx/src/System.Runtime/tests/System/StackOverflowExceptionTests.cs. However, that repo is notoriously difficult to dissect - the test project for example doesn't have a project.json...
Yet, there is another issue, being that even if I write a simple test using Xunit and use this line:
Whatson will kick in reporting that
and obviously, that is very unfortunate and useless.
Reproduce by running:
Paste
This code works:
But not always:
Replace
Exception
withStackOverflowException
.\dotnetnew\Program.cs(11,27): error CS0246: The type or namespace name 'StackOverFlowException' could not be found (are you missing a using directive or an assembly reference?)