bug in DirectoryInfo.GetFiles()


if path to DirectoryInfo has not an ending \ then 1 char is missing in the beginning of the file names 
and FileNotFound Exception on other methodes


 static void Main(string[] args)
        {
            string path = @"I:";  // <------ 1'st char is missing in output
            string path = @"I:\"; // works ok   
          
            DirectoryInfo dirInfo = new DirectoryInfo(path);
            FileInfo[] filInfo = dirInfo.GetFiles();
            foreach (FileInfo fi in filInfo)
            {
                Console.WriteLine(fi.Name);
                //Console.WriteLine(fi.Length); //<------- IoException  file not found

             

            }
            Console.ReadLine();
        }

Framework Beta2 


Answer this question

bug in DirectoryInfo.GetFiles()

  • bug in DirectoryInfo.GetFiles()