我正在构建一个使用独立存储的Windows phone7应用程序。代码大部分时间都能正常工作,但我一直在随机获取IsolatedStorageExceptions:
{"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)该文件已存在。我将所有IsolatedStorage使用的内容都放在块中,所以我不应该让文件在任何地方打开。
这可能是什么原因造成的?
如何获取有关异常原因的更多详细信息?
发布于 2010-11-12 23:21:06
目前不能保证使用块刷新/关闭WP7中的流。
显式关闭所有文件/流,直到SDK达到您可以真正信任它的程度!:)
发布于 2010-09-27 01:30:13
我会特别检查以确保您已经关闭了文件中您要删除的所有读取器和写入器。我并不是说这一定会解决这个问题,而是不能删除确实存在的文件,这往往是由打开的文件引起的。
发布于 2010-07-18 02:24:20
不应该忽视的是,WP7仍然处于测试版中(您已经从CTP更新到测试版了,对吧?)
考虑创建一个非常简单的应用程序,它以您的主应用程序的方式操作独立存储,看看您是否可以创建一个问题的小Repo。完成后,将其发送给Microsoft,以便他们可以查看它。
https://stackoverflow.com/questions/3271353
复制相似问题