代码之家  ›  专栏  ›  技术社区  ›  herbrandson

从isolatedStorageFileStream构造函数引发的isolatedStorage_操作isfs错误意味着什么?

  •  4
  • herbrandson  · 技术社区  · 14 年前

    我有一个Silverlight 4应用程序(插件… http://audioorchard.com …end plug),它偶尔会在isolatedStorageFileStream构造函数中引发异常。

    system.io.isolatedStorage.isolatedStorageException:[isolatedStorage_operation_isfs]参数:调试资源字符串不可用。通常,键和参数提供足够的信息来诊断问题。见 http://go.microsoft.com/fwlink/?linkid=106663&Version=4.0.50524.0&File=mscorlib.dll&Key=IsolatedStorage_Operation_ISFS 在audioOrchard.client.utility.diskmanager.createnewfile(string filename,boolean wasdiskspace requested)的system.io.isolatedstorage.isolatedstoragefilestream..ctor(字符串路径,文件模式,文件访问,文件共享,int32 buffersize,isolatedstoragefile isf)上…(此处输入的不是SL运行时代码)

    堆栈跟踪中的URL既没有提供任何帮助,也没有进行谷歌搜索。我在哪里可以了解更多关于IsolatedStorage_Operation_ISF的信息,以及是什么导致的?

    3 回复  |  直到 13 年前
        1
  •  7
  •   Jeff Atwood    14 年前

    这意味着您正在达到Silverlight独立存储中的文件长度限制。独立存储的基本存储位置可以位于一个名称很长的路径中-看起来像:

    C:\\Users\\kevind\\AppData\\LocalLow\\Microsoft\\Silverlight\\is\\1325qaxz.ekn\\xyro13wm.cn0\\1\\s\\qc4wuhalx4ciu4u5hbqqfohd3y3y4m1guyj5xuv5ml5y5qjbjmaaaeea\\f

    (在xp上甚至更长,其基础是c:\documents and settings)

    鉴于此,达到260个字符的文件路径限制并不需要太多的时间。基本路径加上内部路径(独立存储内)加上文件名必须少于260个字符。

    在这种情况下,我看到了两种不同的故障模式:

    1. 尝试创建路径总长度(基本路径加上新路径)超过260个字符的目录。这将导致IsolatedStorageFile.CreateDirectory引发PathToLongException。

    2. 尝试使用isolatedStorageFileStream创建文件,其中总路径长度(基本路径加上内部路径加上文件名)大于260个字符。这将导致isolatedStorageException(isolatedStorage_operation_isfs)由isolatedStorageFileStream构造函数引发。

    据我所知,除了捕获异常并继续进行,这个问题没有真正的解决方案。这是Silverlight的一个不幸限制。

    这里有一篇关于这个问题的好文章:

    http://msdn.microsoft.com/en-us/magazine/dd458794.aspx

        2
  •  0
  •   Igor V Savchenko    14 年前

    实际上,没有具有相同参数列表的IsolatedStorageFileStream的构造函数:

    system.io.isolatedstorage.isolatedstoragefilestream..ctor(字符串 路径,文件模式,文件访问 访问、文件共享、共享 英特32 缓冲区大小 ,isolatedStorageFile ISF)

    Int32 BufferSize参数在这里确实是多余的。请检查 documentation 对于IsolatedStorageFileStream构造函数。
    我认为有一些第三方组件尝试使用不受支持的IsolatedStorageFileStream构造函数。

        3
  •  0
  •   Ashley Pace    13 年前

    我确实遇到了这个问题,为了解决它,我清除了我的Silverlight缓存。如果要对程序文件--gt;Microsoft Silverlight单击“应用程序存储”选项卡,可以删除其中列出的任何或所有网站。我删除了相关的网站,并能够在下一次正确的。