System.IO.Directory.CreateDirectory – weirdest exception ever

  .net-core, c++, system.io.directory, windows

so, I’m trying to create a following directory:

d:tempaktynul

Path is constructed in the loop, starting from: d:temp and so on, creating non-existent directories along the way, so it first creates:

d:tempak

then:

d:tempakty

and…. then it comes to the last bit nul it throws this exception:

enter image description here

So, what’s going on – where it took .nul from?

The code:

string z_base_path = @"d:tempakty";
string z_extra_path = "nul";
string z_full_path = System.IO.Path.Combine(z_base_path, z_extra_path);

System.IO.Directory.CreateDirectory(z_full_path);

Source: Windows Questions

LEAVE A COMMENT