Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 13, 2025

Windows removed localhost support in recent updates, causing ERROR_NETNAME_DELETED (0x40/64) when accessing UNC paths like \\LOCALHOST\share\path. This triggers a Debug.Assert failure in FillAttributeInfo because the error code isn't recognized as a path unreachable condition.

Changes

  • Interop.Errors.cs: Added ERROR_NETNAME_DELETED = 0x40 constant
  • FileSystem.Attributes.Windows.cs: Added ERROR_NETNAME_DELETED to IsPathUnreachableError pattern match

This aligns handling with other network path errors (ERROR_BAD_NETPATH, ERROR_BAD_NET_NAME, etc.) already in the unreachable path list.

Context

if (!IsPathUnreachableError(errorCode))
{
    Debug.Assert(errorCode == ERROR_ACCESS_DENIED || errorCode == ERROR_SHARING_VIOLATION || errorCode == ERROR_SEM_TIMEOUT,
        $"Unexpected error code getting attributes {errorCode} from path {path}");
    // ...
}

Previously, ERROR_NETNAME_DELETED fell through to the assertion. Now it's handled as unreachable.

Fixes #120380 (possibly same root cause)

Original prompt

This section details on the original issue you should resolve

<issue_title>System.IO.Tests fails with "Unexpected error code getting attributes 64 from path \LOCALHOST"</issue_title>
<issue_description>## Build Information
Build: https://dev.azure.com/dnceng-public/cbb18261-c48f-4abb-8651-8cdcb5474649/_build/results?buildId=1181840
Build error leg or test failing: System.IO.FileSystem.Tests.WorkItemExecution
Pull request: #119878

Error Message

Fill the error message using step by step known issues guidance.

{
  "ErrorMessage": "Unexpected error code getting attributes 64 from path \\\\LOCALHOST",
  "ErrorPattern": "",
  "BuildRetry": false,
  "ExcludeConsoleLog": false
}

Known issue validation

Build: 🔎 https://dev.azure.com/dnceng-public/public/_build/results?buildId=1181840
Error message validated: [Unexpected error code getting attributes 64 from path \LOCALHOST]
Result validation: ❌ Known issue did not match with the provided build.
Validation performed at: 10/22/2025 2:11:40 PM UTC

Known issue validation

Build: 🔎 https://dev.azure.com/dnceng-public/public/_build/results?buildId=1181840
Error message validated: [Unexpected error code getting attributes 64 from path \\LOCALHOST]
Result validation: ✅ Known issue matched with the provided build.
Validation performed at: 10/22/2025 2:17:17 PM UTC

Report

Build Definition Test Pull Request
1200811 dotnet/runtime System.IO.FileSystem.Tests.WorkItemExecution
1200758 dotnet/runtime System.IO.FileSystem.Tests.WorkItemExecution #121524
1200347 dotnet/runtime System.IO.FileSystem.Tests.WorkItemExecution #121524
1200222 dotnet/runtime System.IO.FileSystem.Tests.WorkItemExecution
1199457 dotnet/runtime System.IO.FileSystem.Tests.WorkItemExecution
1199150 dotnet/runtime System.IO.FileSystem.Tests.WorkItemExecution
1198822 dotnet/runtime System.IO.FileSystem.Tests.WorkItemExecution
1197942 dotnet/runtime System.IO.FileSystem.Tests.WorkItemExecution
1197801 dotnet/runtime System.IO.FileSystem.Tests.WorkItemExecution
1197409 dotnet/runtime [System.IO.FileSys...

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

@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.

@jkotas jkotas requested a review from jozkee November 13, 2025 04:37
Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix System.IO.Tests error on getting attributes Add ERROR_NETNAME_DELETED to IsPathUnreachableError for Windows localhost removal Nov 13, 2025
Copilot AI requested a review from jkotas November 13, 2025 05:06
@jkotas jkotas marked this pull request as ready for review November 13, 2025 05:19
Copilot AI review requested due to automatic review settings November 13, 2025 05:19
@jkotas
Copy link
Member

jkotas commented Nov 13, 2025

/azp run runtime-nativeaot-outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

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 addresses a bug where Windows' removal of localhost support in recent updates causes ERROR_NETNAME_DELETED (error code 64/0x40) when accessing UNC paths like \\LOCALHOST\share\path. This error was triggering a Debug.Assert failure because it wasn't recognized as a path unreachable condition.

Key Changes:

  • Added ERROR_NETNAME_DELETED = 0x40 constant to Interop.Errors.cs
  • Added ERROR_NETNAME_DELETED to the IsPathUnreachableError pattern match in FileSystem.Attributes.Windows.cs

Reviewed Changes

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

File Description
src/libraries/Common/src/Interop/Windows/Interop.Errors.cs Added ERROR_NETNAME_DELETED constant with hex value 0x40, positioned correctly between other network-related error codes
src/libraries/Common/src/System/IO/FileSystem.Attributes.Windows.cs Added ERROR_NETNAME_DELETED to the IsPathUnreachableError pattern match, grouping it logically with other network path errors

@jozkee
Copy link
Member

jozkee commented Nov 13, 2025

/ba-g #114315 and

/Users/runner/work/1/s/artifacts/toolset/restore.proj : error : Unable to load the service index for source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json.

on osx-arm64 Release NativeAOT_Libs.

@jozkee jozkee merged commit fb6e68d into main Nov 13, 2025
104 of 119 checks passed
@jozkee jozkee deleted the copilot/fix-system-io-tests-error branch November 13, 2025 17:36
@github-actions github-actions bot locked and limited conversation to collaborators Dec 14, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

3 participants