IOException - CLR_E_FILE_IO (4)

I’ve been upgrading (from 4.2 to 4.3) the “Tyrannt” sample program published under the codeshare for examples on file IO as its one of the few more complex VB examples that I’ve found to date. I intermittently (but more often than not) get these errors:

Exception System.IO.IOException - CLR_E_FILE_IO (4)
Exception System.IO.IOException - CLR_E_FILE_NOT_FOUND (4)

when loading bmp files off of an SD-Card. It fails intermittently (mostly) during the “picture selection tap”, but works every single time if I put a breakpoint in front, and (f11-step) into the load routine. Given the only code changes I’ve made to the program to date is to add a calibration button on the main screen.

 Private Function LoadBitmap(fname As String) As Bitmap
            Return storageDev.LoadBitmap(fname, Bitmap.BitmapImageType.Bmp)
 End Function 

Any thoughts on where to start looking for an error? As far as I can tell, I’m not mounting/unmounting the card. Also, if I break on the error, the fname path is absolutely correct, (and about 10% of the time, will load the file…)

Fez Hydra - Mainboard
2gb SD Card - Formatted Fat
T43 Display
USB Client DP with a 12v Supply

Sounds like some sort of synchronization or racing issue. I would look for clues in that direction. May be something is accessed before it is done initializing.

Architect, thanks for the suggestion, and immediately before the routine is called is a Glide “On Tap” interrupt. I tried putting in a delay prior to loading the file (thinking along the same lines of the racing suggestion, and that doesn’t seem to make a difference. Also not sure if this is helpful, but if I put a breakpoint in prior to calling the read, and F5 into it, the problem still happens, but if I F11 into the read, it works every single time.

I’m wondering if it could have something to do with the Screen and or Glide? The reason I ask is I run into the same issue of an endless reboot cycle, (the Control Shift - F5 to start debugging), if I try programming it without the SD card inserted, but the problem disappears if the SD card is inserted.

Both Tiny Booter & Tiny CLR are updated to

I don’t think loading file in an event is a good idea.
Add delay in event also not good idea too, I think.