'System.IO.IOException' on Cerbuino Bee

I am running the following code on the Cerbuino Bee and get the following errory when reading a file.

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

I have tried both a 2gb card and 32gb card. Both produce the same results. The exception occurs at different locations in the file each time the program runs. I also tried using try/catch and attempting the read again, but still get the exception.


StorageDev.MountSD();

FileStream FileHandle = new FileStream(@ "\SD\test.bin", FileMode.Open, FileAccess.Read, FileShare.None);
byte[] seq = new byte[1024];

Debug.Print("Free mem : " + Debug.GC(true).ToString());

        while (FileHandle.Position < FileHandle.Length)
           {
              int read_count = FileHandle.Read(seq, 0, seq.Length);
              Debug.Print (read_count.ToString());
            }


Any ideas? Thank you.

Hi Mickpat,

We have discovered that there is indeed an error in the SD drivers. We are investigating and will get a solution as soon as possible.

The driver error appears to have occurred since the QFE2 release of 4.2 Micro Framework (Cerb-Family 4.2.3.x). We are continuing to investigate.

Thank you for the update. Very helpful. I wonder if the other issue I am having is related.

http://www.tinyclr.com/forum/topic?id=9098

It may be. I believe this problem has something to do with the File System code. When I tried my resent test, the directory structure nor the files were reading properly even though everything appeared to mount properly, but rest assured that we are looking into the matter.

Have Happy Holidays and a great New Year!