I am having an issue where I am getting an IsolatedStorageException (‘Operation not permitted on IsolatedFileStorageStream’) every first time I run an app. Consequent times of running the app, it works just fine. I have tried every method I could find of open files for writing, including
using (var iso = IsolatedStorageFile.GetUserStoreForApplication())
using (IsolatedStorageFileStream file = new IsolatedStorageFileStream(fileName, FileMode.Create, FileAccess.Write, iso))
{
}
using(var iso = IsolatedStorageFile.GetUserStoreForApplication())
using(IsolatedStorageFileStream file = iso.OpenFile(fileName, FileMode.OpenOrCreate))
{
}
and other various overloads of those methods. Nothing I do has worked, and I have followed the steps on every other post in Stack Overflow and every blog post I could find. When I look at the output, every time it throws the following exceptions:
A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.Net.WebException' occurred in System.Windows.dll
A first chance exception of type 'System.Net.WebException' occurred in System.Windows.dll
A first chance exception of type 'System.IO.DirectoryNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.IO.IsolatedStorage.IsolatedStorageException' occurred in mscorlib.dll
Does anyone have any other ideas as to why it’s exploding? I’m using WP7 7.1 RTM tools.
It turned out that if you have a file name with funny characters in it, you will get an exception, but then for some reason it accepts the file name.