Skip to content

Add ERROR_NETNAME_DELETED to IsPathUnreachableError for Windows localhost removal - #121569

Merged
jozkee merged 2 commits into
mainfrom
copilot/fix-system-io-tests-error
Nov 13, 2025
Merged

Add ERROR_NETNAME_DELETED to IsPathUnreachableError for Windows localhost removal#121569
jozkee merged 2 commits into
mainfrom
copilot/fix-system-io-tests-error

Conversation

CopilotAI commented Nov 13, 2025

Copy link
Copy Markdown
Contributor

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

BuildDefinitionTestPull Request
1200811dotnet/runtimeSystem.IO.FileSystem.Tests.WorkItemExecution
1200758dotnet/runtimeSystem.IO.FileSystem.Tests.WorkItemExecution#121524
1200347dotnet/runtimeSystem.IO.FileSystem.Tests.WorkItemExecution#121524
1200222dotnet/runtimeSystem.IO.FileSystem.Tests.WorkItemExecution
1199457dotnet/runtimeSystem.IO.FileSystem.Tests.WorkItemExecution
1199150dotnet/runtimeSystem.IO.FileSystem.Tests.WorkItemExecution
1198822dotnet/runtimeSystem.IO.FileSystem.Tests.WorkItemExecution
1197942dotnet/runtimeSystem.IO.FileSystem.Tests.WorkItemExecution
1197801dotnet/runtimeSystem.IO.FileSystem.Tests.WorkItemExecution
1197409dotnet/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
Copy Markdown
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 jozkeeNovember 13, 2025 04:37
Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
CopilotAI changed the title [WIP] Fix System.IO.Tests error on getting attributesAdd ERROR_NETNAME_DELETED to IsPathUnreachableError for Windows localhost removalNov 13, 2025
CopilotAI requested a review from jkotasNovember 13, 2025 05:06
@jkotas
jkotas marked this pull request as ready for review November 13, 2025 05:19
CopilotAI review requested due to automatic review settings November 13, 2025 05:19
@jkotas

Copy link
Copy Markdown
Member

/azp run runtime-nativeaot-outerloop

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

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.

FileDescription
src/libraries/Common/src/Interop/Windows/Interop.Errors.csAdded 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.csAdded ERROR_NETNAME_DELETED to the IsPathUnreachableError pattern match, grouping it logically with other network path errors

@jozkee

Copy link
Copy Markdown
Member

/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 mainNov 13, 2025
104 of 119 checks passed
@jozkee
jozkee deleted the copilot/fix-system-io-tests-error branch November 13, 2025 17:36
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Dec 14, 2025
@jozkee

Copy link
Copy Markdown
Member

/backport to release/10.0

@github-actionsgithub-actionsBot unlocked this conversation Feb 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/10.0 (link to workflow run)

@github-actionsgithub-actionsBot locked as resolved and limited conversation to collaborators Feb 25, 2026
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

4 participants

@jkotas@jozkee