Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IsolatedStorage Errors

I'm building a Windows Phone 7 application that uses isolated storage. The code works most of the time but I keep getting IsolatedStorageExceptions randomly:

{"An error occurred while accessing IsolatedStorage."}

There are no further details about the reason for the exception.  Here is the stack trace:

   at System.IO.IsolatedStorage.IsolatedStorageFile.DeleteFile(String file)
   at MyApp.Core.Data.WindowsPhoneFileRepository.DeleteFile(String name)
   at MyApp.Core.Domain.ThingService.SaveThing(Thing Thing)
   at MyApp.Core.Domain.TrackedThingService.PersistThingLocally(TrackedThing Thing)
   at MyApp.Ui.ViewModels.TrackViewModel.<.ctor>b__3(Thing Thing)
   at GalaSoft.MvvmLight.Command.RelayCommand`1.Execute(Object parameter)
   at GalaSoft.MvvmLight.Command.EventToCommand.Invoke(Object parameter)
   at System.Windows.Interactivity.TriggerAction.CallInvoke(Object parameter)
   at System.Windows.Interactivity.TriggerBase.InvokeActions(Object parameter)
   at System.Windows.Interactivity.EventTriggerBase.OnEvent(EventArgs eventArgs)
   at System.Windows.Interactivity.EventTriggerBase.OnEventImpl(Object sender, EventArgs eventArgs)
   at System.Windows.Controls.Primitives.ButtonBase.OnClick()
   at System.Windows.Controls.Button.OnClick()
   at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
   at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)

The file exists. I place all my IsolatedStorage uses inside using blocks so I shouldn't have the file open anywhere.

What could be causing this?

How I can I get more details about the cause of the exception?

like image 732
chief7 Avatar asked Jul 17 '10 11:07

chief7


1 Answers

Using blocks are currently not guaranteed to flush/close streams in WP7.

Close all files/streams explicitly until the SDK reaches the point you can actually trust it! :)

like image 138
Gone Coding Avatar answered Nov 15 '22 09:11

Gone Coding