2010-07-25 38 views
4

我有一個Silverlight 4應用程序(plug ... http://audioorchard.com ... end plug)偶爾會在IsolatedStorageFileStream構造函數中拋出一個異常。從IsolatedStorageFileStream構造函數拋出的IsolatedStorage_Operation_ISFS錯誤是什麼意思?

System.IO.IsolatedStorage.IsolatedStorageException:[IsolatedStorage_Operation_ISFS]參數:調試資源字符串不可用。關鍵和論據常常提供足夠的信息來診斷問題。請參閱位於AudioOrchard.Client.Utility.DiskManager.CreateNewFile(String fileName,Boolean wasDiskSpaceRequested)處的System.IO.IsolatedStorage.IsolatedStorageFileStream..ctor(String path,FileMode mode,FileAccess access,FileShare share,Int32 bufferSize,IsolatedStorageFile isf)處的http://go.microsoft.com/fwlink/?linkid=106663&Version=4.0.50524.0&File=mscorlib.dll&Key=IsolatedStorage_Operation_ISFS。 ...(在此輸入的不是SL運行時代碼)

堆棧跟蹤中的網址沒有提供任何幫助,也沒有提供谷歌搜索。我在哪裏可以瞭解有關IsolatedStorage_Operation_ISFS的更多信息以及導致它的原因?

回答

7

這意味着您正在Silverlight隔離存儲中達到文件長度限制。對於獨立存儲的基本存儲位置可以在一個很長的名稱的路徑 - 它看起來像:

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

(且可甚至更長的XP,裏基爲C:\ Documents和設置)

鑑於此,達到260個字符文件路徑限制並不需要太多。基本路徑加上內部路徑(在獨立存儲器內)加上文件名必須小於260個字符。

我已經看到在這種情況下,兩個不同的故障模式:

  1. 試圖創建一個目錄,總路徑長度(基本路徑加上新的路徑)是超過260個字符。這會導致由IsolatedStorageFile引發的PathToLongException。創建目錄

  2. 嘗試使用IsolatedStorageFileStream創建文件,其中總路徑長度(基本路徑加內部路徑加文件名)大於260個字符。這會導致IsolatedStorageFileStream構造函數引發IsolatedStorageException(IsolatedStorage_Operation_ISFS)。

據我所知,除了捕捉異常並繼續進行之外,沒有真正的解決方案來解決這個問題。這是Silverlight的一個不幸的限制。

有一個關於此問題的好文章:

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

0

其實沒有構造函數IsolatedStorageFileStream相同參數列表:

System.IO.IsolatedStorage.IsolatedStorageFileStream..ctor(字符串 路徑的FileMode模式,FileAccess的 訪問,文件共享份額,的Int32 bufferSize,IsolatedStorageFile isf)

Int32 bufferSize參數實際上超過了這裏。請檢查documentation是否爲IsolatedStorageFileStream構造函數。
我想有一些第三方組件嘗試使用不支持的IsolatedStorageFileStream構造函數。

+0

是的,這似乎有點奇怪。看來堆棧跟蹤在這裏有點誤導。在代碼中,我實際上調用構造函數IsolatedStorageFileStream(String,FileMode,IsolatedStorageFile) – herbrandson 2010-07-30 06:23:13

0

我其實是有這個問題,並解決它,我明白我的Silverlight緩存。如果您使用Program Files - > Microsoft Silverlight並單擊應用程序存儲選項卡,則可以刪除列出的任何或全部網站。我刪除了有問題的網站,並在下次能夠正確使用。

相關問題