Windows Phone 7– Duh Moment Of The Day

So I wrote this code block in a Windows Phone 7 application:

1 private void CreateNewLogFile() 2 { 3 string logFileLocation = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); 4 if (File.Exists(logFileLocation)) 5 File.Delete(logFileLocation); 6 7 } 8

And I got this exception:


And it hit me – can’t write to the local file system of the emulator using Windows Desktop/Server constructs. To write in a Windows Phone 7 application, I need to write to the local storage.  However, since I can’t read from local storage easily (no WindowsExplorer access) – I would need to write a program to get the data out.  This seems more trouble than it is worth.  I’ll just write to the Debug window….

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: