CSharpFeeds - All your C# feeds in one place.

Sponsors

Tuesday, June 16, 2009

Property Causing a Stack Dump

by sweisfeld via Shawn Weisfeld [MVP] on 6/16/2009 12:26:50 AM

Got a call today, someone was getting a stack dump every time they tried to assign a value to a property. Here is a screen print of the problem they were having. can you spot the problem?

clip_image001

If you said that the property is calling itself you get a gold star.  What was happening is that every time we tried to set the Name property, it calls the Name property to set it, and that called the Name property, and that called the Name property, over and over again, till .NET stack dumped. We are missing a backing variable.

clip_image001[7]

By backing the property with a private variable, it removes the infinite recursion. Since the variable itself is private nobody can see it, or can use it outside the class, they are forced to use the property, and all is right with the world again! 

email it!bookmark it!digg it!

Original Post: Property Causing a Stack Dump

Subscribe

New Feed

Product Spotlight

Recently Updated Sources

Legal Note

The content of the postings is owned by the respective author. CSharpFeeds is not responsible for the contents of the postings. This site is automatically generated and cannot be reviewed for abusive content. If you find abusive content on CSharpFeeds, please contact us. Designated trademarks and brands are the property of their respective owners. All rights reserved.

Advertise with us