Bug 315150 (MONO60330) - change the content of a string property from inside the class causes a stack overflow
Summary: change the content of a string property from inside the class causes a stack ...
Status: RESOLVED INVALID
Alias: MONO60330
Product: Mono: Runtime
Classification: Mono
Component: misc (show other bugs)
Version: unspecified
Hardware: Other Other
: P3 - Medium : Enhancement
Target Milestone: ---
Assignee: Mono Bugs
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords: qa
Depends on:
Blocks:
 
Reported: 2004-06-17 09:01 UTC by Rafael Ferreira
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 18:42:41 UTC


---- Reported by raf@ophion.org 2004-06-17 02:01:01 MST ----

Please fill in this template when reporting a bug, unless you know what you
are doing.
Description of Problem:


Steps to reproduce the problem:
1. Create a string property
2. set its content from inside the class
3. run the app

Actual Results:

What you see is a Unhandled Exception: System.StackOverflowException: The
requested operation caused a stack overflow.
and a long dump of something like this:

in <0x00000> T:set_Blah (string)
in <0x0000a> T:set_Blah (string)
in <0x0000a> T:set_Blah (string)
in <0x0000a> T:set_Blah (string)
in <0x0000a> T:set_Blah (string)
....



Expected Results:

The property should just be set

How often does this happen? 

All the time

Additional Information:

[raferrei@localhost tmp]$ mono --version
Mono JIT compiler version 0.95, (C) 2002-2004 Novell, Inc and Contributors.
www.go-mono.com
        TLS:           NPTL
        GC:            Included Boehm (with typed GC)
        SIGSEGV      : altstack
        Globalization: ICU
[raferrei@localhost tmp]$

I also had someone test on the IRC using a newer version of mono, and they
were able to reproduce the problem.

Here's an attached sample class that causes the error.

using System; 

class T {
	public static string Blah {
		get { return (Blah);}
		set { Blah = value;}
	}
	
	public static void Main()
	{
		Blah = "this is a test";
		Console.WriteLine(Blah);	
	
	}
}



---- Additional Comments From raf@ophion.org 2004-06-17 02:05:23 MST ----

IT does not have to be a string. setting any property causes an exception



---- Additional Comments From sebastien@ximian.com 2004-06-17 07:59:54 MST ----

Your set property is recursive.

public static string Blah {
	get { return (Blah);}
	set { Blah = value;}
}

The endless recursion is causing the stack overflow.
Changing code to

private string _blah;

public static string Blah {
	get { return _blah;}
	set { _blah = value;}
}

should work without problems.


Unknown bug field "cf_op_sys_details" encountered while moving bug
   <cf_op_sys_details>FC2</cf_op_sys_details>
Unknown operating system unknown. Setting to default OS "Other".