The code below crashes at exactly 245 files, I have four directories on the SD card but other than that the root is empty.
for (int i = 0; i < 256; i += 1)
{
try
{
string file = @ "\SD\" + i.ToString("D") + ".txt";
FileStream fs = System.IO.File.Create(file, 256);
fs.Flush();
fs.Close();
fs = null;
}
catch (Exception ex)
{
Debug.Print("SA: " + ex.HResultToString());
}
}
In the debug I see tons of these…
A first chance exception of type ‘System.IO.IOException’ occurred in Microsoft.SPOT.IO.dll
A first chance exception of type ‘System.IO.IOException’ occurred in System.IO.dll
SA: CLR_E_FILE_IO