Add ERROR_NETNAME_DELETED to IsPathUnreachableError for Windows localhost removal#121569
Add ERROR_NETNAME_DELETED to IsPathUnreachableError for Windows localhost removal#121569
Conversation
|
Tagging subscribers to this area: @dotnet/area-system-io |
Co-authored-by: jkotas <[email protected]>
|
/azp run runtime-nativeaot-outerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
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 = 0x40constant toInterop.Errors.cs - Added
ERROR_NETNAME_DELETEDto theIsPathUnreachableErrorpattern match inFileSystem.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 |
|
/ba-g #114315 and
|
Windows removed localhost support in recent updates, causing
ERROR_NETNAME_DELETED(0x40/64) when accessing UNC paths like\\LOCALHOST\share\path. This triggers aDebug.Assertfailure inFillAttributeInfobecause the error code isn't recognized as a path unreachable condition.Changes
ERROR_NETNAME_DELETED = 0x40constantERROR_NETNAME_DELETEDtoIsPathUnreachableErrorpattern matchThis aligns handling with other network path errors (
ERROR_BAD_NETPATH,ERROR_BAD_NET_NAME, etc.) already in the unreachable path list.Context
Previously,
ERROR_NETNAME_DELETEDfell 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
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.