During Windows Phone development, operation not permitted on isolatedsotragefilestream must have been encountered. For example, if you just create a file and read it immediately, you will encounter this problem. The problem is that isolatedstoragefile. createfile returns an isolatedstoragefilestream, while isolatedstoragefile. openfile creates another isolatedstoragefilestream, which is not released. The correct usage is as follows.
using (IsolatedStorageFile isolatedStorageFile = IsolatedStorageFile.GetUserStoreForApplication()) { logPath = Path.Combine(lowerAppName, eventLogFileName); if (!isolatedStorageFile.FileExists(logPath)) { using (IsolatedStorageFileStream createFileStream = isolatedStorageFile.CreateFile(logPath)) { createFileStream.Close(); } using ( IsolatedStorageFileStream writeFileStream = isolatedStorageFile.OpenFile(logPath, FileMode.OpenOrCreate, FileAccess .ReadWrite, FileShare.ReadWrite) ) using (var streamWriter = new StreamWriter(writeFileStream)) { streamWriter.WriteLine("Event Log:"); streamWriter.Close(); writeFileStream.Close(); writeFileStream.Dispose(); } } }