StackOverflowException and properties

An easy way to get this exception is by refering a property to itself:

  1. public string myproperty {
  2.     set { myproperty = value; }
  3. }

The exception looks like this:
[StackOverflowException: Exception of type System.StackOverflowException was thrown.]

Granted it’s a pretty dumb thing to do.. :)

Posted on 18 Oct 04 by Helen Emerson (last updated on 18 Oct 04).
Filed under ASP.NET

Comments

Paul 13 May 2005

This little post helped me find some stupidity of my own. Thanks!

DevDevMarie 10 Oct 2005

This helped me out too! It would have been a much longer day trying to find this small error, thanks!

Josh 22 Oct 2006

I lost hours to this. I am so happy I found your post!