Bug 4164 - mcs should warn about obvious property getter/setter stack overflows
Summary: mcs should warn about obvious property getter/setter stack overflows
Status: NEW
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Marek Safar
Depends on:
Reported: 2012-03-30 17:34 UTC by Mikayla Hutchinson [MSFT]
Modified: 2012-03-30 17:34 UTC (History)
1 user (show)

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

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 for Bug 4164 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Mikayla Hutchinson [MSFT] 2012-03-30 17:34:44 UTC
It's very easy to typo a field name in property getters and setters, e.g.

int foo = 0;
public int Foo {
    set { foo = value; }
    get { return Foo; }

In the case of trivial getters (return itself) and setters (assign itself), it's obvious that all this can do is cause a stack overflow. The compiler should warn (or error!) on this, so it can be caught at compile time instead of runtime.

This would be particularly helpful on Mac, where stack overflows in Mono app are extremely hard to debug.