Value Does Not Fall Within The Expected Range

PA

Cryptic error messages–they are the bane of my existence.  I don’t know how much of my programming time has been taken up trying to trace down the meaning of an error message.

Now, I can’t say that I’m perfect.  The first project I worked on coming out of college had “Invalid Key” for just about every error message– without so much as a clue as to why the key pressed on the point of sale system was invalid.

Microsoft, however, has no excuse.  I mean, they have this whole complex exception system built into their development environments, but all they can tell me is “Value does not fall within the expected range,” and I’m left wondering:

  • What is the value?
  • What is the expected range?
  • What control threw the exception?
  • How do I fix it if I can’t even see it?

That last part’s the kicker, you see, because the exception was thrown in the designer, which means I can’t see any of the controls on the screen or interrogate them.

I tried to comment out all the initialization code in the constructor–to no avail.  I tried using Yahoo to search for articles on the topic.  Even when saying “designer” I was getting the generic argument exception instead of help on what to do.

When I finally included part of the unhelpful stack trace, I found a forum that had all kinds of unhelpful things– except, restart the IDE.

And that’s what fixed it.  Half an hour later and the solution was to restart the IDE.  Ugh.

Hopefully, this should serve as a good reminder to return better error messages than the ones I get!

Leave a Reply

Your email address will not be published. Required fields are marked *

CommentLuv badge