Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does anyone use .NET's System.IO.IsolatedStorage?

I was reading about the System.IO.IsolatedStorage namespace in .NET and found that I can use it to store a file to a location unique for my assembly or executable. For example, the following code:

using System.IO.IsolatedStorage;

public class Program
{
     static void Main(string[] args)
     {
           IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForAssembly();
           store.CreateFile("myUserFile.txt");
     }
 }

Creates the file "myUserFile.txt" at the following location:

C:\Users\Nick\AppData\Local\IsolatedStorage\bhxcjtkp.bpv\wbjkcolm.3br\StrongName.m2s0saaun2onmow3pd5pkml30lf2dobr\AssemFiles

And using IsolatedStorageFile.GetMachineStoreForAssembly() creates a similar directory structure under C:\ProgramData\IsolatedStorage.

I can see the benefit of letting this API create a storage location for you (not having to think up a file path yourself). But I was surprised to see that there weren't any other files stored in IsolatedStorage from other third-party applications (at least not on my computer).

Instead, I found quite a few programs storing configuration files and such simply under C:\Users\Nick\AppData\Local. Does anyone know of a reason why software vendors might shy away from using IsolatedStorage? Or are they using a different API that stores files under AppData?

like image 641
Nick Ramirez Avatar asked Aug 19 '11 02:08

Nick Ramirez


People also ask

What is isolated storage in the Microsoft NET Framework?

Among the vast number of classes and functions provided by the Microsoft .NET Framework, exists a new and powerful feature for storing information relating to users and applications called Isolated Storage. The System.IO.IsolatedStorage namespace allows data to be written to the hard disk where sometimes this is not allowed.

How do I use isolated storage in Java?

The IsolatedStorageFile class provides most of the necessary functionality for isolated storage. Use this class to obtain, delete and manage isolated storage. The IsolatedStorageFileStream class handles reading and writing files to a store. This is similar to reading and writing in standard File I/O classes.

What is the isolatedstoragescope enumeration?

The IsolatedStorageScope enumeration indicates different types of isolation. For more information about when to use isolated storage, see Isolated Storage. Represents the abstract base class from which all isolated storage implementations must derive. The exception that is thrown when an operation in isolated storage fails.

How does the isolatedstoragefilestream class work?

The IsolatedStorageFileStream class handles reading and writing files to a store. This is similar to reading and writing in standard File I/O classes. For more information about I/O, see the System.IO namespace.


1 Answers

One reason that we found (the hard way) is that the algorithm that applications use to identify the path to use under isolated storage is dependent upon the application version. Installing a new version of the application results in an inability to access previously stored data. I am sure there are options to make this scenario work, but we couldn't find them and just moved to a constant storage path.

like image 132
Chris Shain Avatar answered Oct 07 '22 11:10

Chris Shain