Wednesday 30 April 2008

Isolated Storage (used.dat)

Following on from my previous article where is showed you where the isolated storage quota for an application is stored, I will now explore the used.dat file (please read my previous article for this to make sense.

The used.dat file lives in the same directory as quota.dat. The used.dat file holds in hex the number of bytes that your application uses in Isolated Storage. If you open the file in Visual Studio and mess with the hex value, it will change what Silverlight thinks your application is using in Isolated Storage. In fact the call AvailableFreeSpace call of the userStore simply returns the quota.dat hex value (previous article) - the used.dat hex file.

This means everytime you create a file in Isolated Storage, Silverlight simply add the size of the file to the hex value in used.dat. If you delete a file it will decrease the value.

Now there is a problem with this. If i manually go into my isolated storage area in Windows, and delete a folder or a file. The used.dat value doesn't get incremented. The file/directory will however be available to the application.


This means effectively the used.dat can increase, or remove the amount of isolated storage available to your application by adding via silverlight and deleting via windows (or vice versa). Due to the way this has been implemented your available isolated storage will get into a tiz.

The good news is that you shouldn't be messing with files in your isolated storage area, so this shouldn't be an issue (in normal usage).

I will create a screencast on this (when i sort out my silverlight streaming issues)

No comments: