Friday, March 02, 2001 ..:: Home ::.. Register  Login
   TechTidBits (Blog)  

"Object reference not set to an instance of an object" when you try to run a WP7 app?

Apr 12

Written by:
Monday, April 12, 2010 9:06 PM  RssIcon

Error message in VSAre you getting an "Object reference not set to an instance of an object" error message when you F5/start running your WP7 app?  Read on, the solution is MUCH simpler than you think!

Error message in VSSo!  You wrote your first WP7 app?  COOL!  Then you goto sleep, next day you wake up, work, return home, have supper, open up VS, hit F5 and BOOM!!!!!!!!!!  You're staring RIGHT into something that LOOKS like an uncaught exception, but it's not labeled as such, it's not a KNOWN exception, cause well, it's not showing an exception type, nor a stacktrace.  Your app just dies on the table!  DOH!  WTF?

"Object reference not set to an instance of an object"

Turns out, the problem is rather simple (IMHO!).  Check out my steps to repro above, you just opened up VS and hit F5 right?  Chances are, you're solution is the currently selected node in the Solution Explorer tree, right?

Solution node selected

If that's the case, then the solution is as simple as selecting another project and hitting F5 again.  YUP!  It's THAT simple.

Select another project in the solution

I want to thank Rob Miles and Ginny Caughey for the heads up and the fix!  For without their blogs/posts/tweets, I would have torn what little hair I have left, OUT!

Now that you can keep your hair too!  LOL  It's time to grab a coffee and get coding!


Resources Why do I get an “Object reference not set to an instance of an object” error when I run my program?

Twitter: Ginny Caughey

Location: Blogs Parent Separator TechTidBits

Your name:
Gravatar Preview
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Add Comment   Cancel 
Copyright 1999-2012 by   Terms Of Use  Privacy Statement