Just "upgraded" from VS2008 Pro to VS201 Express and when I try to run
an old program (that I have recompiled with VS2010) I get an
NullReferenceException on this scode:
[STAThread]
static void Main()
{
// Check for existing instance
bool firstInstance = false;
string safeName = Application.UserAppDataPath.Replace(@"\", "_");
Mutex mutex = new Mutex(true, safeName, out firstInstance);
if (!firstInstance)
return;
// Start only instance
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
The exception is on this line:
string safeName = Application.UserAppDataPath.Replace(@"\", "_");
The exact same code works prefectly in VS2008
What has changed and how do I fix it?
// Anders
|