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 :
try
{
var fStream = File.Open(fileName, FileMode.Open, FileAccess.Read);
byte[] fileBytes = new byte[fStream.Length];
fStream.Read(fileBytes, 0, fileBytes.Length);
fStream.Close();
var result = uploader.UploadFile(_uploadUrl, ref fileBytes, fileName);
if (result)
{
File.Delete(fileName);
}
}
finally
{
if (fStream != null)
fStream.Dispose();
}