-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Long path support fails with Unicode characters even with LongPathsEnabled=1 in .NET on Windows #126535
Copy link
Copy link
Open
Labels
area-System.IOuntriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner
Description
Description
Even after enabling LongPathsEnabled in the Windows registry (set to 1 and system rebooted), .NET applications still fail to handle file paths that exceed the 260-character MAX_PATH limit and contain Unicode characters (Thai, Japanese, Russian, Greek, etc.).
Actual Behavior
- File operations throw
PathTooLongExceptionorDirectoryNotFoundException - Drag-and-drop of such paths throws
HRESULT: 0x8007007A(The data area passed to a system call is too small) - Explorer.exe automatically redirects to default folders when path is too long
- .NET file APIs do not properly handle the
\\?\prefix for long path bypass
Environment - Windows 10/11 (latest version)
- .NET 6/7/8 (all versions affected)
- Reproduced in PCL 2(plain craft launcher)(a minecraft launcher) (C# .NET application) consistently
Reproduction Steps
- Enable long path support in Windows:
- Open
regeditas administrator - Navigate to
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem - Set
LongPathsEnabledDWORD value to1 - Reboot the system
- Open
- Create a test path longer than 260 characters with mixed Unicode characters:
C:\test\ภาษาไทยカタカナРусскийΑλφαβητα\1\2\3\4\5\6\7\8\9\0\1\2\3\4\5\6\7\8\9\0\test.txt - Use .NET
File.ReadAllText()orDirectory.GetFiles()to access the path - Observe the exception/error
Expected Behavior
.NET should fully support long paths with Unicode characters whenLongPathsEnabledis enabled, consistent with native Windows system behavior. The same path works correctly in PowerShell and native Win32 applications, confirming it's a .NET-specific bug.
Expected behavior
.NET should fully support long paths with Unicode characters when LongPathsEnabled is enabled, consistent with native Windows system behavior.
The same path works correctly in PowerShell and native Win32 applications, confirming it's a .NET-specific bug.
Actual behavior
- File operations throw
PathTooLongExceptionorDirectoryNotFoundExceptionwhen accessing paths longer than 260 characters with Unicode characters - Drag-and-drop of such paths throws
HRESULT: 0x8007007A(The data area passed to a system call is too small) - Explorer.exe automatically redirects to default folders when path is too long, even with
LongPathsEnabledenabled - .NET file APIs do not properly handle the
\\?\prefix for long path bypass
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-System.IOuntriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner