I have a Silverlight 4 application (plug… http://audioorchard.com …end plug) that is occasionally throwing an exception in the IsolatedStorageFileStream constructor.
System.IO.IsolatedStorage.IsolatedStorageException: [IsolatedStorage_Operation_ISFS] Arguments: Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=4.0.50524.0&File=mscorlib.dll&Key=IsolatedStorage_Operation_ISFS at System.IO.IsolatedStorage.IsolatedStorageFileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, IsolatedStorageFile isf) at AudioOrchard.Client.Utility.DiskManager.CreateNewFile(String fileName, Boolean wasDiskSpaceRequested) at… (enter’s not SL runtime code here)
The url in the stack trace doesn’t provide any help and neither did a google search. Where can I learn more about IsolatedStorage_Operation_ISFS and what would cause it?
It means you are hitting a file length limit in Silverlight isolated storage. The base storage location for isolated storage can be in a path with a very long name – it looks something like:
C:\\Users\\kevind\\AppData\\LocalLow\\Microsoft\\Silverlight\\is\\1325qaxz.ekn\\xyro13wm.cn0\\1\\s\\qc4wuhalx4ciu4u5hbqqfohd3y3y4m1guyj5xuv5ml5y5qjbjmaaaeea\\f(and can be even longer on XP, where the base is C:\Documents and Settings)
Given that, it doesn’t take much to hit the 260 character file path limit. The base path plus the internal path (inside isolated storage) plus the file name has to be less than 260 characters.
I’ve seen two different failure modes in this case:
Trying to create a directory where the total path length (base path plus new path) is longer than 260 characters. This results in a PathToLongException raised by IsolatedStorageFile.CreateDirectory
Trying to create a file using IsolatedStorageFileStream, where the total path length (base path plus internal path plus file name) is greater than 260 characters. This results in an IsolatedStorageException (IsolatedStorage_Operation_ISFS) raised by the IsolatedStorageFileStream constructor.
As far as I can tell, there’s no real solution to this problem aside from catching the exceptions and carrying on. It’s an unfortunately limitation of Silverlight.
There’s a good article about the issue here:
http://msdn.microsoft.com/en-us/magazine/dd458794.aspx