Recently, I’ve seen a number of questions posted in various forums that typically come in the form of something like -
“I am using the Windows Phone 7 Device Emulator to test my application. The application creates data which is saved in Isolated Storage. The other day I ran tests. I then ended the day and shut down Visual Studio and the emulator. When I started the next day’s work, I discovered that the data I had created are nowhere to be found on the emulator.
Where on my hard drive are the files related to Isolated Storage data?”
I’ve also been asked similar questions like this a lot lately. If I wanted to be blunt, the best answer would be – They’re gone. Bye-bye. I think a bit more of an explanation is in order, however
It’s important to being with by saying that the device emulator is just that – an emulator. It is a self-contained emulation of a device from both a hardware and software perspective. This includes the ROM image for the device and “local storage” for the device. As such, data written to the emulator is stored within the confines of the emulator session.
In past versions of Windows Mobile development, shutting down an emulator would first prompt you to save the current state of the device.
If you said yes to this question, the emulator would write out the current state of the emulator (including applications running in memory and data written to file systems) to your local hard drive. The next time you started the emulator, this information would be used to restore the emulator to it’s last running state. Think of it like hibernation on a PC. If you said no to saving state, the data written during the current session would be lost.
The Windows Phone 7 device emulator works on the same principle, with one major difference – the current implementation of the emulator does not give you the option to save emulator state. In other words – once shut down, your device data is gone.
I am not certain of any plans to bring the Windows Phone 7 emulator to a par with it’s Windows Mobile 6.5 brethren. I would image the state persistence will come eventually. In the meantime, just remember – once you close the device emulator, anything you had created in the form of data on the device (files in isolated storage, contacts, etc) are gone.