[Mono-dev] System.IO.Directory.CreateDirectory bug!
Leszek Ciesielski
skolima at gmail.com
Sat Dec 16 09:08:57 EST 2006
On 12/15/06, Luciano Callero <lnc19 at hotmail.com> wrote:
> Hi:
> I'm using mono 1.1.17.1.
> I have a problem with System.IO.Directory.CreateDirectory method.
> The problem is: if i create a file in somewhere with some name, and then
> create a folder in the same place with the same (file) name, the folder is
> not created (wich is correct) but no exception is throw. This is correct?
> (If i create first the directory and then the file, the
> System.IO.File.Create method throw a correct System.IO.IOException).
> The code to test is:
>
> namespace test
> {
> class MainClass
> {
> public static void Main(string[] args)
> {
> File.Create("/tmp/test");
> Console.WriteLine(String.Format("File Exists? {0}",
> File.Exists("/tmp/test").ToString()));
> Directory.CreateDirectory("/tmp/test"); // An IOException must be throw
> here.
> Console.WriteLine(String.Format("Folder Exists? {0}",
> Directory.Exists("/tmp/test").ToString()));
>
> }
> }
> }
>
>
> Do i fill a bug report? is it correct this behavior?
Just checked on MS.Net 2.0, an exception is thrown when you try to
create a directory with a same name as file. I guess we have to stick
with MS behaviour, not MSDN, if they differ. So this is a bug.
More information about the Mono-devel-list
mailing list