Skip navigation.

Better Usability with Silverlight? Yeah, right!All recent postsHow to Waste a Sale

An Easy Way to Cause Stack Overflow

If you’ve ever been greeted with the following red-on-white error message, I’ve got a tip for you.

Server Application Unavailable

The web application you are attempting to access on this web 
server is currently unavailable. Please hit the "Refresh" button 
in your web browser to retry your request.

In my experience, in nine out of ten cases this happens due to a sloppy or altogether unintentional recursion. See if you spot the problem:

public class Foo
{
   private string bar;
   // ...
   public string Bar
   {
      get { return Bar; }
   }
}

The Bar property references itself instead of the bar member. These cyclic calls exhaust the call stack, and you get the cryptic message above.

ReSharper has very aggressive IntelliSense and readily offers auto complete suggestions. I don’t even remember how many times I’ve walked into this trap. Granted, ReSharper displays a little recursion glyph, but who pays attention to the scenery at high speed? :)

Ironically, naming class members in Hungarian notaion or with underscores mitigates the problem.

Comments

Comment permalink 1 Damir |
Yes, I've done it by myself a time or two... That's the one of two reasons why I've adopted '_' prefix as a naming standard for private fields.

Second reason is to have naming standard compatible with VB.NET (I had to use it in some projects in my previous job...).
Comment permalink 2 Rik Hemsley |
"Who pays attention to the scenery at high speed?"

Those who unit test.
Comment permalink 3 Milan Negovan |
Rik, very true! Good point. I'm still wrestling with unit testing in ASP.NET.
Comment permalink 4 Josh Stodola |
Naming conventions can really save some grief!! This is another reason I always use 3 letter prefixes for all variables. Like:

Dim strName as String
Dim intAge as Integer
Dim blnAdmin as Boolean

Best Regards
Comment permalink 5 Michelle |
@Josh
well, nice trick, it will save me some trouble, thanks for sharing it :)
Comment permalink 6 Pendrive |
It’s very good article. Great site with very good look and perfect information.

Emails and Notifications

Would you like to be notified when somebody responds to this post?  Would you like to have these comments emailed to you?

Submit your comment

Please enter only text since all HTML tags except hyperlinks will be stripped. Hyperlinks will become live links. Any comments with flaming or offensive language will be deleted. Be courteous to other posters. Thank you.

Your name (required):
Your email (optional):
Your site's URL (optional):
Enter this number
Type in the number above:
Comment (required):