SD card driver error after several operations

I am getting a fairly consistent exception when doing allot of IO to a SD card.

After reading and then deleting about dozen 170kB files I get an IOException with the IOExceptionErrorCode of "InvalidDriver"
Subsequent IO on the SD card will throw an exception with IOExceptionErrorCode of VolumeNotFound.

If remount the volume it works fine until the same exception occurs again.

Any Ideas ?

Here is the code :

	var fStream = File.Open(fileName, FileMode.Open, FileAccess.Read);
	byte[] fileBytes = new byte[fStream.Length];
	fStream.Read(fileBytes, 0, fileBytes.Length);

	var result = uploader.UploadFile(_uploadUrl, ref fileBytes, fileName);

	if (result)

	if (fStream != null)

Have you tried to format the card on pc with fat16 and again with fat32?
Have you tried different sd cards?

No and no, I’ll try that next.

Thanks for the advice.

Also, does anyone have any recommendations on any particular make/model of SD card that is known to work with the EMX module? Something in the 1gb to 2gb range?

Sandisk seem to have good reputation. I have seen problems with kingstone. Defiantly do not use the nobrand card found on eBay and such

Solved!! Total rookie mistake.

I was not keeping a reference to the PersitantStorage object after mounting the SD card. :frowning: