I have recently discovered that a .Net Compact Framework application was failing when there were too many files per folder with long file names.
Code was running on Pocket PC V 4.20.0 (Build 14053) running on ARM XScale. Storage Card is formated with FAT32. Pocket PC is using Compact Framework 1.0.
The code below fails at exactly 1000 files
private void button1_Click(object sender, System.EventArgs e)
{
int i = 0;
byte[] b = new byte[1];
b[0] = 123;
try
{
while(true)
{
i += 1;
System.IO.FileStream fs = new System.IO.FileStream("\\Storage Card\\FilesWithAFairlyLongNameMakeItWorse" + i.ToString(),System.IO.FileMode.Create);
fs.Write(b,0,1);
fs.Flush();
fs.Close();
textBox1.Text = i.ToString();
}
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show("Exception " + ex.ToString() + " at file number " + i.ToString());
}
}
The exception is simply reported as "IOException" without any further details (or any way of getting them).
Interestingly.
System.IO.StreamWriter logStream =
new System.IO.StreamWriter("\\Storage Card\\SwFile",true);succeeds even when there are > 1000 files in a folder. Also one of the 1000 files can be pasted as a copy using File Explorer.

Files Per Folder Limit in FileStream constructor
Zerox Millienium
Hi Bill,
I was able to reproduce the issue on a WM 5.0 device but not on PPC 2003. We will investigate if this is a product issue.
Thank you for reporting the issue.
Cheers,
Anthony Wong [MSFT]