GetFiles bug

While on the topic of file system. I think I tripped over a bug.

So issuing the following on an “SD” volume:
Directory.GetFiles(“MM”);

Will *create the directory MM, instead of getting an IO error as one would expect. Not sure if NetMF bug, Fez bug, or a confluence of the two.

It is throwing exceptions here. Please make a small program that generates the problem.

Hi Mike. Test here on my domino creates dir. Dump is just extention method to Debug.Print elements. [url]http://www.fezzer.com/project/216/dump-collections/[/url]

public static void GetFiles()
{
    // Delete if exists already.
    Directory.Delete(@ "\SD\MM");

    // Print Dirs before.
    string[] dirs = Directory.GetDirectories(@ "\SD");
    dirs.Dump("\nDirs Before:");

    // Creates Dir \SD\MM
    string[] files = Directory.GetFiles(@ "\SD\MM");
    Debug.Print("\nFiles count:" + files.Length);

    // Print Dirs after.
    dirs = Directory.GetDirectories(@ "\SD");
    dirs.Dump("\nDirs after:");

    /* Output:
    Dirs Before:
    \SD\WJS

    Files count:0

    Dirs after:
    \SD\WJS
    \SD\MM
    */
}

Thank you. We opened an issue for NETMF code. For now, you can check if the directory exists before getting the files…

Thanks Mike. So you confirmed it was NETMF issue? I was not sure if it was SD driver, fez persis storage, or netmf.

It is something inside the file system itself. We are investigating…

I guess one quick way to Half the problem space is try the code on non-fez MF hardware to see if repro. If can repro, then issue probably just in netmf. I don’t have any non-fez hw - which I guess is a good thing. :slight_smile:

It is very unlikely to be specific to GHI’s products. The problem is in the file system which is NETMF. It is easy to check if the folder exists before enumerating what’s inside it for now.