Open
Description
Description
The same issue as #26448
Reproduction Steps
static void Main(string[] args)
{
var d = new DirectoryInfo(@"C:\");
d.CreateSubdirectory("bar");
}
Expected behavior
It creates the subdirectory
Actual behavior
System.ArgumentException: The directory specified, 'bar', is not a subdirectory of 'C:\'.
Parameter name: path
at System.IO.DirectoryInfo.CreateSubdirectory(String path)
...
Regression?
In .NET Framework 4.8 it works fine
Known Workarounds
No response
Configuration
<TargetFramework>net8.0-windows10.0.17763.0</TargetFramework>
<OutputType>Library</OutputType>
<Platforms>x86</Platforms>
Win 11 Pro 21H2 22631.2861 x64
Other information
This doesn't throw:
static void Main(string[] args)
{
var d = new DirectoryInfo(@"C:\foo");
d.CreateSubdirectory("bar");
}