Monday, 14 May 2012

IsolatedStorageFile Remove and Shared ShellContent

I have been working on a new feature of an application that is displaying some information on a custom Live tile. The source of the image used for the tile is stored in the Shared/ShellContent directory of the application's Isolated Storage. The application also has the ability to clear it's Isolated Storage for resetting purposes.

The issue then came about when the reset was performed this cleared the whole of the Isolated Storage including the Shared directory. The code I am using to then create the PNG in Isolated Storage failed with a "Operation not permitted on IsolatedStorageFileStream." exception.

The Shared directory seems to be created when the application is first deployed to the device so my Live tile was working fine until the reset was performed.

So if you are using a PNG from Isolated Storage for your Live tile, please make sure you don't remove the entire Isolated Storage for the application.

I used the Isolated Storage Explorer Tool to investigate this problem :-