Remove dead code PathFeatures.cs and assume all path features are available#120929
Remove dead code PathFeatures.cs and assume all path features are available#120929stephentoub merged 6 commits intomainfrom
Conversation
Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
src/libraries/System.Diagnostics.Process/tests/ProcessModuleTests.Windows.cs
Show resolved
Hide resolved
src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/FileSystemTest.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
src/libraries/System.IO.Compression/tests/ZipArchive/zip_ManualAndCompatibilityTests.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Directory/Delete.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Directory/Delete.cs
Outdated
Show resolved
Hide resolved
...ibraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/IO/PathTests_Windows.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
|
oops, ran the workflow on the wrong PR 😄 |
Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
This PR removes the obsolete PathFeatures.cs file and all references to it throughout the codebase. The PathFeatures class was only used in tests targeting current netcoreapp where all path features (long paths, new normalization) are already available. The changes eliminate dead code and conditional logic that assumed legacy path behaviors.
Key changes:
- Deleted
PathFeatures.csand removed its references from 5 csproj files - Replaced conditional test attributes (
ConditionalFact/ConditionalTheory) with unconditionalFact/Theoryattributes where they depended on always-true path feature checks - Removed conditional runtime logic that branched based on path normalization capabilities
- Merged duplicate test methods that previously existed to handle legacy vs. new path normalization
Reviewed Changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| PathFeatures.cs | Deleted obsolete file containing runtime path feature detection |
| System.Runtime.Extensions.Tests.csproj | Removed PathFeatures.cs reference |
| System.IO.FileSystem.Tests.csproj | Removed PathFeatures.cs reference |
| System.IO.FileSystem.DisabledFileLocking.Tests.csproj | Removed PathFeatures.cs reference |
| System.IO.Compression.Tests.csproj | Removed PathFeatures.cs reference |
| System.Diagnostics.Process.Tests.csproj | Removed PathFeatures.cs reference |
| PathTests_Windows.cs | Removed conditional logic based on legacy path normalization and merged duplicate test cases |
| PathTestsBase.cs | Updated test data to use non-legacy expected values |
| FileSystemTest.cs | Removed property wrappers for PathFeatures methods |
| Delete.cs | Replaced redundant property wrappers with direct RemoteExecutor.IsSupported checks |
| zip_ManualAndCompatibilityTests.cs | Removed PathFeatures usage and converted conditional test to unconditional |
| ProcessModuleTests.Windows.cs | Converted ConditionalFact to Fact and updated comment |
| Various test files | Converted ConditionalFact/ConditionalTheory to Fact/Theory |
|
Tagging subscribers to this area: @dotnet/area-system-io |
adamsitnik
left a comment
There was a problem hiding this comment.
@copilot please apply my suggestions to fix following CI failure:
[FAIL] System.IO.Tests.Directory_Delete_str_bool.ExtendedDirectoryWithSubdirectories
System.InvalidOperationException : An appropriate member 'IsSupported' could not be found. The conditional method needs to be a static method, property, or field on the type System.IO.Tests.Directory_Delete_str or any ancestor, of any visibility, accepting zero arguments, and having a return type of Boolean.
[FAIL] System.IO.Tests.Directory_Delete_str_bool.LongPathExtendedDirectory
System.InvalidOperationException : An appropriate member 'IsSupported' could not be found. The conditional method needs to be a static method, property, or field on the type System.IO.Tests.Directory_Delete_str or any ancestor, of any visibility, accepting zero arguments, and having a return type of Boolean.
src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Directory/Delete.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Directory/Delete.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
... Applied the suggested fixes to add typeof(RemoteExecutor) parameter to both ConditionalFact attributes. (commit 6c4e3a5) |
Summary
Successfully removed PathFeatures.cs dead code and all its references. Replaced all conditional test attributes that depended on always-true properties with unconditional Fact/Theory attributes. Removed redundant property wrappers and merged duplicate test methods. Fixed ConditionalFact attributes to properly reference RemoteExecutor.IsSupported. All tests now assume:
Original prompt
Fixes #120928
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.