Repository navigation
Closed
Labels
Milestone
Description
Test PathWithReservedDeviceNameAsPath_ThrowsDirectoryNotFoundException fails on windows 10 machine.
<test name="System.IO.Tests.DirectoryInfo_Create.PathWithReservedDeviceNameAsPath_ThrowsDirectoryNotFoundException" type="System.IO.Tests.DirectoryInfo_Create" method="PathWithReservedDeviceNameAsPath_ThrowsDirectoryNotFoundException" time="79.5877502" result="Fail">
<traits>
<trait name="category" value="nonlinuxtests" />
<trait name="category" value="nonosxtests" />
<trait name="category" value="nonfreebsdtests" />
<trait name="category" value="nonnetbsdtests" />
</traits>
<failure exception-type="Xunit.Sdk.AllException">
<message><![CDATA[Assert.All() Failure: 3 out of 88 items in the collection did not pass.\r\n[30]: Xunit.Sdk.ThrowsException: Assert.Throws() Failure\r\n Expected: typeof(System.IO.DirectoryNotFoundException)\r\n Actual: (No exception was thrown)\r\n at Xunit.Assert.Throws(Type exceptionType, Exception exception) in C:\\BuildAgent\\work\\cb37e9acf085d108\\src\\xunit.assert\\Asserts\\ExceptionAsserts.cs:line 143\r\n at Xunit.Assert.Throws[T](Func`1 testCode) in C:\\BuildAgent\\work\\cb37e9acf085d108\\src\\xunit.assert\\Asserts\\ExceptionAsserts.cs:line 36\r\n at System.IO.Tests.Directory_CreateDirectory.<PathWithReservedDeviceNameAsPath_ThrowsDirectoryNotFoundException>b__32_0(String path) in C:\\Projkti\\.NET\\corefx\\src\\System.IO.FileSystem\\tests\\Directory\\CreateDirectory.cs:line 420\r\n at Xunit.Assert.All[T](IEnumerable`1 collection, Action`1 action) in C:\\BuildAgent\\work\\cb37e9acf085d108\\src\\xunit.assert\\Asserts\\CollectionAsserts.cs:line 31\r\n[29]: Xunit.Sdk.ThrowsException: Assert.Throws() Failure\r\n Expected: typeof(System.IO.DirectoryNotFoundException)\r\n Actual: (No exception was thrown)\r\n at Xunit.Assert.Throws(Type exceptionType, Exception exception) in C:\\BuildAgent\\work\\cb37e9acf085d108\\src\\xunit.assert\\Asserts\\ExceptionAsserts.cs:line 143\r\n at Xunit.Assert.Throws[T](Func`1 testCode) in C:\\BuildAgent\\work\\cb37e9acf085d108\\src\\xunit.assert\\Asserts\\ExceptionAsserts.cs:line 36\r\n at System.IO.Tests.Directory_CreateDirectory.<PathWithReservedDeviceNameAsPath_ThrowsDirectoryNotFoundException>b__32_0(String path) in C:\\Projekti\\.NET\\corefx\\src\\System.IO.FileSystem\\tests\\Directory\\CreateDirectory.cs:line 420\r\n at Xunit.Assert.All[T](IEnumerable`1 collection, Action`1 action) in C:\\BuildAgent\\work\\cb37e9acf085d108\\src\\xunit.assert\\Asserts\\CollectionAsserts.cs:line 31\r\n[28]: Xunit.Sdk.ThrowsException: Assert.Throws() Failure\r\n Expected: typeof(System.IO.DirectoryNotFoundException)\r\n Actual: (No exception was thrown)\r\n at Xunit.Assert.Throws(Type exceptionType, Exception exception) in C:\\BuildAgent\\work\\cb37e9acf085d108\\src\\xunit.assert\\Asserts\\ExceptionAsserts.cs:line 143\r\n at Xunit.Assert.Throws[T](Func`1 testCode) in C:\\BuildAgent\\work\\cb37e9acf085d108\\src\\xunit.assert\\Asserts\\ExceptionAsserts.cs:line 36\r\n at System.IO.Tests.Directory_CreateDirectory.<PathWithReservedDeviceNameAsPath_ThrowsDirectoryNotFoundException>b__32_0(String path) in C:\\Projekti\\.NET\\corefx\\src\\System.IO.FileSystem\\tests\\Directory\\CreateDirectory.cs:line 420\r\n at Xunit.Assert.All[T](IEnumerable`1 collection, Action`1 action) in C:\\BuildAgent\\work\\cb37e9acf085d108\\src\\xunit.assert\\Asserts\\CollectionAsserts.cs:line 31]]></message>
<stack-trace><![CDATA[ at System.IO.Tests.Directory_CreateDirectory.PathWithReservedDeviceNameAsPath_ThrowsDirectoryNotFoundException() in C:\Projekti\.NET\corefx\src\System.IO.FileSystem\tests\Directory\CreateDirectory.cs:line 408]]></stack-trace>
</failure>
</test>Fun fact:
I have executed this commands on my machine and it seems that some will give me exception while others will execute silently (while no actual directory will be created)
C:>mkdir Directory\COM4 <-- no error
C:>mkdir Directory\COM1 <-- error
The system cannot find the file specified.C:>mkdir Directory\LPT1 <-- error
The system cannot find the file specified.C:>mkdir Directory\NUL <-- no error
C:>mkdir Directory\AUX <-- error
The system cannot find the file specified.
Activity
hughbe commentedon Apr 8, 2017
Possibly related. A different test but similar thing: System.IO.Tests.DirectoryInfo_Create.PathWithReservedDeviceNameAsExtendedPath Failed in https://github.com/dotnet/corefx/issues/17763
danmoseley commentedon Apr 8, 2017
@Vertygo what version of Windows 10 do you have? Do you have any unusual configuration?
Does it fail when you run against desktop binaries, instead of .NET Core? To try this, do this from the root:
If it does then that tells us it's either the test or your machine.
Vertygo commentedon Apr 8, 2017
I have Windows 10 Pro x64 - Version 1607 (OS Build 14393.953). I wouldn't say that I have an unusual configuration but it could be that some of the tools/installations I have are affecting the tests in some way.
@danmosemsft after running netfx specific build/test commands there are numerous errors in build-tests.log. I will try running tests on clean Win 10 machine.
Also, after looking through repo issues, chat and other online sources I found out that some tests fail on other peoples machines (reason machine config, weird registry values etc.) while same ones are passing on CI build so I will be more careful about reporting bugs like these (test failure). Also I will report issue if there is space for improvement/making tests more resilient.
karelz commentedon Apr 9, 2017
If you find a way to make tests more robust (even on 'weird' config machines), that would be great!
danmoseley commentedon Apr 9, 2017
The tests should work on any reasonable configuration so please do open issues. It's just that it may have to be you that investigates, if we can't reproduce!
Vertygo commentedon Apr 9, 2017
@karelz @danmosemsft after a bit of research I have found out that my COM 3/4 ports are Bluetooth over Serial Port ports. After disabling Bluetooth from control panel I can see that tests are running smoothly and even faster than previously (trying to create folder with name COM3 was correctly returning error/exception but with some delay).
I think that in this case there is not much to do but we could add this to build notes list. Maybe it would be good idea to highlight those notes somehow so that people reading build/test instructions are somehow aware of those gotchas (I haven`t seen build notes up until I got this test issue).
@hughbe not sure if you have same issue since you have a slightly different behavior. Have you debugged tests? Do you know on which reserved device name test is failing? Anyway, if you have active Bluetooth on your machine try disabling it from control panel and then try running tests.
danmoseley commentedon Apr 9, 2017
@Vertygo interesting. That doesn't explain why NUL didn't give an exception, I guess?
Ideally there would be a line of code we could write that would detect this case, and skip those COM ports in this test. There is existing code here:
https://github.com/dotnet/corefx/blob/master/src/System.IO.Ports/tests/Support/PortHelper.cs
https://github.com/dotnet/corefx/blob/master/src/System.IO.Ports/tests/Support/TCSupport.cs
Those files could be shared into src\common\tests and reused in src\system.io.filesystem\tests for this test.
If you're interested you could take a look, but since only you hit this, it's useful but not a high priority.
Vertygo commentedon Apr 10, 2017
@danmosemsft I will definitely take a look into it. I have tried to get some info with serial port analyzers but that ended without any results.
danmoseley commentedon Apr 17, 2017
Since this is test only, only fails in a non standard configuration, and there's a workaround, moving to future. Still want to robustify the test though.
GrabYourPitchforks commentedon May 4, 2021
This test is now failing across all of my Windows Insider machines (running 21375.1). The test also floods my hard drive with COM1, COM2, etc. directories, as shown in the screen shot below.
danmoseley commentedon May 5, 2021
This means that Win32 CreateDirectory() behavior has changed to no longer return ERROR_PATH_NOT_FOUND for paths like
C:\COM, I guess. It should be easy to verify that on your machine.danmoseley commentedon May 5, 2021
And maybe we should robustify the test to delete such a folder if it unexpectedly makes it (assuming that RemoveDirectory() won't reject it either)
GrabYourPitchforks commentedon May 5, 2021
Based on internal investigation, I believe this test should be disabled on Win10+. Will send a PR for it.