Bug 7554 - No feedback to programmer that a stack overflow occurred
Summary: No feedback to programmer that a stack overflow occurred
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: 6.0.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2012-09-30 17:13 UTC by Yvan Rodrigues
Modified: 2012-10-01 19:24 UTC (History)
3 users (show)

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

Sample project (5.36 KB, application/x-zip-compressed)
2012-09-30 17:13 UTC, Yvan Rodrigues
Screenshot of Visual Studio (184.06 KB, image/png)
2012-09-30 17:20 UTC, Yvan Rodrigues

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 Developer Community or GitHub 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 Yvan Rodrigues 2012-09-30 17:13:56 UTC
Created attachment 2653 [details]
Sample project

When a stack overflow occurs:
- no exception is thrown
- nothing is output to the "Application Output" pane
- the program just stops without explanation

In my current project, debugging just stopped. Finding the offending line involved stepping through every line of code until it broke, and even then I only identified it by noticing the trend in the call stack (after 2 hours of debugging).

using System;

namespace StackOverflow
	class MainClass
		public static void Main(string[] args)
			Console.WriteLine ("Hello World!");
			Main (new string[0]);
Comment 1 Yvan Rodrigues 2012-09-30 17:20:55 UTC
Created attachment 2654 [details]
Screenshot of Visual Studio

In .NET, a StackOverflowException is thrown by the runtime, which is then handled by Visual Studio with an exception notification.

Thanks Michael, you're right -- the runtime should be catching this condition.
Comment 2 Mikayla Hutchinson [MSFT] 2012-09-30 17:35:59 UTC
Yeah, StackOverFlowException has historically been a runtime problem on MacOS. The problem (as I understand it) is that when catching the signal, the stack has no space left for the handler to do anything... so it has to be relayed to an "altstack" (alternative stack). AFAIK it's been fixed on Mono 2.12 for a while, but the fix has not backported to Mono 2.10 (which MonoTouch uses) because it's quite invasive.
Comment 3 Rolf Bjarne Kvinge [MSFT] 2012-10-01 19:24:21 UTC
Just tried with Mono 2.11.5, and it's working (a StackOverflow exception is thrown).