Over a million developers have joined DZone.

Tip: “Object reference not set to an instance of an object” Error in Silverlight for Windows Phone 7


Problem :  ”Object reference not set to an instance of an object.”  messagebox will be displayed when you are running Silverlight Windows Phone 7 Application in Visual Studio 2010.

Object Reference not set Error in Visual Studio 2010  Utimate and Express Vesrion

Solution : Shawn Oster, Program Manager of Silverlight for Window Phone team, confirmed that this is a known issue that they are currently working on fixing for next update. The workaround for this issue is that you need to ensure that the solution is not highlighted in Solution Explorer.

Let’s take a look at the picture below. Solution “WP7ApplicationBar” is highlighted in Solution Explorer, right? That’s why you are getting this error.

Don't highlight the solution.

In order to fix this, you need to move the selection by clicking on Project Name or other files in Solution Explorer. As you can see, Solution “WP7ApplicationBar” is highlighted in previous screenshot. And we moved the highlight to ProjectName in second screenshot. Then, you can try to run the application from Visual Studio again. I think it will work this time.

Put the highlight on project Name

Hope you find it useful. I’m facing this problem quite so often lately. This funny trick helped me to solve this problem. :) If this trick doesn’t help you then please feel free to let me know.



Published at DZone with permission of Michael Sync. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}