Not sure if this is in the .NET framework or the GHI SDK,
but consider the following snippet:
public static void Mount()
{
if (sdCard == null)
{
sdCard = new PersistentStorage(DEVICE_ID);
sdCard.MountFileSystem();
Thread.Sleep(100);
}
}
If you remove the Thread.Sleep(100), you will always get an exception,
if you try to access the SD card right away.
So something tells me, the mount requires a little time,
but MountFileSystem does not block until everything is ready.
[quote]#### Exception System.IO.IOException - CLR_E_FILE_IO (4) ####
#### Message:
#### Microsoft.SPOT.IO.VolumeInfo::.ctor [IP: 0000] ####
#### Microsoft.SPOT.IO.RemovableMedia::MessageHandler [IP: 0022] ####
A first chance exception of type ‘System.IO.IOException’ occurred in Microsoft.SPOT.IO.dll
An unhandled exception of type ‘System.IO.IOException’ occurred in Microsoft.SPOT.IO.dll
[/quote]
I see cases when you will need it, but I rather leave it as is. I mount the file system as the first thing, and do other initializations before I use any file io. By the time I am done, it is mounted and ready for me. The point is you can do other things instead of wasting cpu cycles waiting.