Hi
I followed some discussions here about exceptions that occur when opening files and other uses.
I use micro sd of SanDisk 2GB.
I formated the card to FAT and then to FAT32 and in both cases I receive execptions.
I set a timeout of 3 seconds after the mount, before I start to deal with the card.
Nothing help.
What I do is:
I create a file and then I close it and get an exception:
Exception System.ObjectDisposedException - 0x00000000 (6)
System.IO.FileStream::get_Length [IP: 0009]
Uncaught exception
If I read an exsiting file I get the same exception when I close it, and if I try to read it again, the file handle is NULL.
Sample of my code:
static void Main()
{
PersistentStorage sdPS = new PersistentStorage("SD");
sdPS.MountFileSystem();
//// Assume one storage device is available, access it through NETMF
string rootDirectory = VolumeInfo.GetVolumes()[0].RootDirectory;
rootDirectory += "\\files\\";
FileStream FileHandle = new FileStream(rootDirectory + "hello.txt", FileMode.Create);
//byte[] data = Encoding.UTF8.GetBytes("This string will go in the file!");
// write the data and close the file
//FileHandle.Write(data, 0, data.Length);
FileHandle.Close();
...
Thanks