Why do I get an “Object reference not set to an instance of an object” error when I run my program?
Sometimes when you run a Windows Phone program from VS 2010 (usually one that has run successfully before) you get the above message. This can also happen if you run a program that somebody else has sent you (and claims that it works).
The answer is simple, and has to do with the way that Visual Studio likes to create directory hierarchies as it builds your projects, and the fact that the filing system on your PC has a limited number of characters available for file paths. If you put your VS 2010 projects deep down your folders, in a well organised kind of way, they will fail to run as some of the files can’t be created, can’t be loaded and then produce the above error.
The solution is to move the entire project up a bit in the file system.
Reader Comments (3)
http://www.pchenry.com/Home/tabid/36/EntryID/297/Default.aspx