Skip to content

Remove resolved ActiveIssue(#14378) skip attributes from IO.FileSystem tests#125092

Open
Copilot wants to merge 4 commits intomainfrom
copilot/remove-activeissue-attribute
Open

Remove resolved ActiveIssue(#14378) skip attributes from IO.FileSystem tests#125092
Copilot wants to merge 4 commits intomainfrom
copilot/remove-activeissue-attribute

Conversation

Copy link
Contributor

Copilot AI commented Mar 3, 2026

Issue #14378 has been resolved, but 6 test methods across 4 files were still decorated with [ActiveIssue("https://github.com/dotnet/runtime/issues/14378")], causing them to be permanently skipped on all platforms.

Description

  • Directory/Delete_MountVolume.cs — un-skip RunTest (volume mount deletion scenarios); guarded with [ConditionalFact(nameof(IsPrivilegedAndNtfs))] matching the existing pattern in Delete.Windows.cs::Delete_VolumeMountPoint, where IsPrivilegedAndNtfs checks PlatformDetection.IsPrivilegedProcess && FileSystemDebugInfo.IsCurrentDriveNTFS()
  • Directory/ReparsePoints_MountVolume.cs — un-skip runTest (GetDirectories/GetFiles through mount points); guarded with [ConditionalFact(nameof(IsPrivilegedAndNtfs))] for the same reason
  • Directory/Exists.cs — un-skip NotReadyDriveAsPath_ReturnsFalse and SubdirectoryOnNotReadyDriveAsPath_ReturnsFalse; converted to [ConditionalFact(nameof(HasNotReadyDrive))] with SkipTestException so tests are properly reported as skipped (not silently passed) when no not-ready drive is available
  • Directory/CreateDirectory.cs — un-skip NotReadyDriveAsPath_ThrowsDirectoryNotFoundException and SubdirectoryOnNotReadyDriveAsPath_ThrowsIOException; converted to [ConditionalFact(nameof(HasNotReadyDrive))] with SkipTestException for the same reason

The two mount-volume tests use [ConditionalFact(nameof(IsPrivilegedAndNtfs))], matching the existing pattern already established in Delete.Windows.cs::Delete_VolumeMountPoint for tests that call MountHelper.Mount. Note: CI evidence suggests current runners always run as admin on NTFS, so the guard is primarily a safety net for non-CI developer machines.

The four not-ready-drive tests use [ConditionalFact(nameof(HasNotReadyDrive))] (where HasNotReadyDrive reads from a cached static readonly string? s_notReadyDrive = IOServices.GetNotReadyDrive() field) together with throw new SkipTestException(...) in the test body, replacing the old Console.WriteLine + return anti-pattern that caused tests to silently pass with zero assertions. The drive is cached in a static field so GetNotReadyDrive() is called only once per test class.

All tests retain [PlatformSpecific(TestPlatforms.Windows)] and will continue to be skipped on non-Windows platforms.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…lved

Co-authored-by: ViveliDuCh <50237907+ViveliDuCh@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove ActiveIssue attribute from relevant tests Remove resolved ActiveIssue(#14378) skip attributes from IO.FileSystem tests Mar 3, 2026
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-io
See info in area-owners.md if you want to be subscribed.

@ViveliDuCh ViveliDuCh marked this pull request as ready for review March 3, 2026 03:27
@ViveliDuCh ViveliDuCh requested review from Copilot and jozkee March 3, 2026 03:27
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes 6 [ActiveIssue("https://github.com/dotnet/runtime/issues/14378")] skip attributes from 4 System.IO.FileSystem test files, re-enabling tests that were permanently skipped while waiting for a mechanism to test machine-wide state (like mounting network drives). All tests retain [PlatformSpecific(TestPlatforms.Windows)] and will still skip on non-Windows.

Changes:

  • Remove ActiveIssue skip attribute from Delete_MountVolume.cs::RunTest (volume mount deletion scenarios)
  • Remove ActiveIssue skip attribute from ReparsePoints_MountVolume.cs::runTest (GetDirectories/GetFiles through mount points)
  • Remove ActiveIssue skip attributes from Exists.cs::NotReadyDriveAsPath_ReturnsFalse and SubdirectoryOnNotReadyDriveAsPath_ReturnsFalse
  • Remove ActiveIssue skip attributes from CreateDirectory.cs::NotReadyDriveAsPath_ThrowsDirectoryNotFoundException and SubdirectoryOnNotReadyDriveAsPath_ThrowsIOException

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
Directory/Delete_MountVolume.cs Removes [ActiveIssue] from RunTest, which tests directory deletion through Windows volume mount points
Directory/ReparsePoints_MountVolume.cs Removes [ActiveIssue] from runTest, which tests GetDirectories/GetFiles traversal through volume mount points
Directory/Exists.cs Removes [ActiveIssue] from two tests that check Directory.Exists behavior on not-ready drives
Directory/CreateDirectory.cs Removes [ActiveIssue] from two tests that check Directory.CreateDirectory behavior on not-ready drives

Comment on lines 22 to 24
[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/14378")]
[PlatformSpecific(TestPlatforms.Windows)] // testing mounting volumes and reparse points
public static void runTest()
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The runTest method calls MountHelper.Mount which internally uses the Win32 SetVolumeMountPoint API, which requires elevated (administrator) privileges on Windows. Without elevation on an NTFS drive, this will throw an exception that is caught by the surrounding try-catch, which sets s_pass = false, ultimately causing Assert.True(s_pass) at the end to fail.

The existing Delete.Windows.cs test that also calls MountHelper.Mount guards this with [ConditionalFact(nameof(IsPrivilegedAndNtfs))] where IsPrivilegedAndNtfs checks PlatformDetection.IsPrivilegedProcess && FileSystemDebugInfo.IsCurrentDriveNTFS(). This test should be similarly guarded with a [ConditionalFact] checking for elevated privileges, or else it will fail on non-elevated Windows CI runners.

Copilot uses AI. Check for mistakes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot apply changes based on this feedback and this other feedback

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in df2f2db. Both Delete_MountVolume.cs::RunTest and ReparsePoints_MountVolume.cs::runTest are now guarded with [ConditionalFact(nameof(IsPrivilegedAndNtfs))] where IsPrivilegedAndNtfs checks PlatformDetection.IsPrivilegedProcess && FileSystemDebugInfo.IsCurrentDriveNTFS(), matching the pattern used in Delete.Windows.cs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot what's the rationale for guarding with PlatformDetection.IsPrivilegedProcess? I don't see any test issues in the CI run for the previous commit https://github.com/dotnet/runtime/pull/125092/checks?check_run_id=65514701973.

I know NTFS is needed as per the docs, but that also didn't fail in CI which hints at me that we don't use other file system types in CI anymore e.g. FAT32.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rationale was to follow the existing pattern established in Delete.Windows.cs::Delete_VolumeMountPoint (lines 14-15, 67-69), which already uses IsPrivilegedAndNtfs for a test that also calls MountHelper.Mount. I matched that pattern rather than introducing a different guard for the same underlying operation.

You're right that if the CI run at bb6ca8c passed without any guards, it implies the CI runners already run as admin and on NTFS — meaning both conditions in IsPrivilegedAndNtfs are always true there. In that case, the guards only affect non-CI (developer) machines.

If you'd prefer to drop PlatformDetection.IsPrivilegedProcess (keeping only FileSystemDebugInfo.IsCurrentDriveNTFS()) or remove the ConditionalFact guard entirely and just use [Fact], I'm happy to make that change. The choice is yours — the only risk is a failure on a developer machine running non-admin or on FAT32, which your CI evidence suggests is unlikely.

@@ -24,7 +24,6 @@ public class Directory_Delete_MountVolume
private static bool s_pass = true;

[Fact]
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The RunTest method calls MountHelper.Mount which internally uses the Win32 SetVolumeMountPoint API, which requires elevated (administrator) privileges on Windows. Without elevation on an NTFS drive, this will throw an exception that is caught by the surrounding try-catch, which sets s_pass = false, ultimately causing Assert.True(s_pass) at the end to fail.

The existing Delete.Windows.cs test that also calls MountHelper.Mount guards this with [ConditionalFact(nameof(IsPrivilegedAndNtfs))] where IsPrivilegedAndNtfs checks PlatformDetection.IsPrivilegedProcess && FileSystemDebugInfo.IsCurrentDriveNTFS(). This test should be similarly guarded with [ConditionalFact] checking for elevated privileges, or else it will fail on non-elevated Windows CI runners.

Suggested change
[Fact]
private static bool IsPrivilegedAndNtfs() =>
PlatformDetection.IsPrivilegedProcess && FileSystemDebugInfo.IsCurrentDriveNTFS();
[ConditionalFact(nameof(IsPrivilegedAndNtfs))]

Copilot uses AI. Check for mistakes.
… privileges and NTFS

Co-authored-by: ViveliDuCh <50237907+ViveliDuCh@users.noreply.github.com>
Comment on lines 327 to 328
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot these tests should use SkipTestException and be ConditionalFact. Also make sure to lookup other occurrences in this folder.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in efabc18. Both Exists.cs and CreateDirectory.cs now use [ConditionalFact(nameof(HasNotReadyDrive))] and throw new SkipTestException(...) instead of Console.WriteLine + return. The not-ready drive is cached in a static readonly string? s_notReadyDrive field so GetNotReadyDrive() is only called once per test class. All other occurrences of the Console.WriteLine("Skipping...") pattern in the Directory folder were checked — the remaining ones in ReparsePoints_MountVolume.cs are inside if/else branches within complex legacy test methods (not the same return-early pattern) and are unrelated to the [ActiveIssue] removal.

…ditionalFact in Exists.cs and CreateDirectory.cs

Co-authored-by: jozkee <16040868+jozkee@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants