I have no clue what I am doing wrong here, I am trying to setup a method to create a device ID by writing a GUID to a file (I know it won’t persist firmware flashes), but I always get IOException errors. My top 2 lines don’t change, but I have tried both the Create and the WriteAllBytes lines.
Ok, thanks for that URL, but that leaves me 2 things.
Is there any internal storage that can be accessed? It will be a tiny file (just a guid) so I would prefer to keep it in onboard storage.
When I tried the code in that I get “An unhandled exception of type ‘System.Exception’ occurred in Microsoft.SPOT.Hardware.dll” when it tries to instantiate the FEZCerbuinoBee object.
I am mounting the SD card and Microsoft.SPOT.IO.VolumeInfo.GetVolumes()[0].RootDirectory returns “\SD”, but get directories and trying to write both error out. GetVolumes()[0] can get file system, free space, total space, etc.
Yeah, and through VolumeInfo it reports the filesystem as FAT and it returns both total size and total free space as valid numbers so as best as I can tell it seems to be in and valid. It is an 8GB card but the documentation I saw on the SD module indicates that at least the FEZ Spider has no size limit.
It takes a few seconds, after you program starts, for the SD card to be ready for mounting. Usually, you should check to see if the SD card is inserted before mounting.
You can verify that this is a timing issue by adding a Thread.Sleep(5000) before mounting the SD card.
As I said, it is reading the file system type, free and total spaces, root directory, etc, would those be available if it wasn’t ready? Also, I have hit a breakpoint after the insert but before the WriteAllBytes where I do those checks in the immediate window, and I am there for more than 10 seconds. Just for fun I threw in a 30 second loop and then expanded that to a 5 minute loop (just debug.print of the time and then sleep 1000) and it failed after both the 30 second and 5 minute pauses.