Skip to content

Delete obsolete NormalizePathBadGlobalroot test#12049

Merged
YuliiaKovalova merged 3 commits intomainfrom
copilot/fix-4205
Jun 30, 2025
Merged

Delete obsolete NormalizePathBadGlobalroot test#12049
YuliiaKovalova merged 3 commits intomainfrom
copilot/fix-4205

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 20, 2025

The NormalizePathBadGlobalroot test was skipped due to failing on newer .NET versions where path validation behavior has changed. This test was checking that FileUtilities.NormalizePath(@"\\?\globalroot\XXX") would throw an ArgumentException, but .NET Core 2.1+ no longer validates globalroot paths as a security concern.

Problem

The test was expecting:

  • FileUtilities.NormalizePath(@"\\?\globalroot\XXX") to throw ArgumentException
  • But instead the method returned the path value, causing Assert.Null() to fail with NullException

Root Cause

Similar to other path validation tests in the same file, .NET Core 2.1+ removed the security validation for globalroot paths that was present in .NET Framework. The underlying Path.GetFullPath() method no longer throws exceptions for these paths.

Solution

Permanently deleted the test since:

  1. The security validation it was testing is no longer performed by the .NET runtime
  2. Other similar path validation tests in the file are marked with [WindowsFullFrameworkOnlyFact] to only run on older .NET Framework versions
  3. This test was completely skipped rather than conditionally executed, indicating the validation is obsolete

Changes

  • Removed the NormalizePathBadGlobalroot test method (19 lines)
  • Removed the associated empty #if FEATURE_LEGACY_GETFULLPATH conditional compilation block
  • Verified the build succeeds with no compilation errors

Fixes #4205.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • dnceng.pkgs.visualstudio.com
    • Triggering command: dotnet test src/UnitTests.Shared/Microsoft.Build.UnitTests.Shared.csproj --filter NormalizePathBadGlobalroot --verbosity normal (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Hello @@copilot, I noticed that you’re changing an .swr file or any file under src/Package/MSBuild.VSSetup.. Please make sure to validate this change by an experimental VS insertion. This is accomplished by pushing to an exp/* branch, which requires write permissions to this repo.

Copilot AI and others added 2 commits June 20, 2025 12:16
Co-authored-by: YuliiaKovalova <95473390+YuliiaKovalova@users.noreply.github.com>
Co-authored-by: YuliiaKovalova <95473390+YuliiaKovalova@users.noreply.github.com>
Copilot AI changed the title [WIP] Reenable or permanently delete NormalizePathBadGlobalroot Delete obsolete NormalizePathBadGlobalroot test Jun 20, 2025
Copilot AI requested a review from YuliiaKovalova June 20, 2025 12:23
@YuliiaKovalova YuliiaKovalova marked this pull request as ready for review June 24, 2025 10:04
@YuliiaKovalova YuliiaKovalova merged commit 73cec27 into main Jun 30, 2025
10 checks passed
@YuliiaKovalova YuliiaKovalova deleted the copilot/fix-4205 branch June 30, 2025 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reenable or permanently delete NormalizePathBadGlobalroot

3 participants