Always check the most obvious things first

Published 04 September 08 11:34 PM

I spent a while or so on this 'issue' I had. Basically it's not even an issue, it's an expected behavior (if you now what the expected behavior should be). I was using a Guid class to create a new guid in a project which would be used later in the application (guid is passed on to another part of the system). Here's the code I had:

 Guid myGuid = new Guid();

Everything worked fine, no errors, no exceptions, nothing. If you check 'myGuid' you would see that the guid is indeed assigned to the variable. But the problem is that the guid is empty (e.g. {000...000}). Instead of spending time on researching what else could went wrong, I didn't even think about that line. Once I changed the above line to: Guid myGuid = Guid.NewGuid () - everything was working fine.

I guess the 'lesson' is - check the most obvious things first - I usually tend to skip over the obvious stuff because 'I know that's right' and 'It can't be that simple'. Well, looks like sometimes it is :)

 

Comments

# Always check the most obvious things first : EasyCoded said on September 4, 2008 6:56 PM:

PingBack from http://www.easycoded.com/always-check-the-most-obvious-things-first/

Anonymous comments are disabled

This Blog

Syndication

Page view tracker