[Breaking change]: Remove file path backslash to slash mapping in CoreCLR native runtime and PAL on Unix #32906
Closed
2 tasks done
Labels
binary incompatible
Existing binaries may encounter a breaking change in behavior.
breaking-change
Indicates a .NET Core breaking change
🏁 Release: .NET 8
Work items for the .NET 8 release
doc-idea
Indicates issues that are suggestions for new topics [org][type][category]
Pri1
High priority, do before Pri2 and Pri3
📌 seQUESTered
Identifies that an issue has been imported into Quest.
source incompatible
Source code may encounter a breaking change in behavior when targeting the new version.
Description
Backslash (
\
) characters are valid in directory and file names on Unix. We have stopped converting them to directory separators - forward slashes ('/') on Unix in the native CoreCLR runtime. This enables .NET applications to be located on paths with names containing backslash characters and also allows the native runtime,dotnet
host,ilasm
andildasm
tools access files on paths containing backslash characters.Version
.NET 8 Preview 1
Previous behavior
Backslash (
\
) characters in file paths in the native CoreCLR runtime were automatically converted to forward slashes (/
).New behavior
No character conversion in file paths is done in the native CoreCLR runtime on Unix.
Type of breaking change
Reason for change
Without this change, .NET applications located in directories with paths containing backslash characters fail to start.
Recommended action
Use
System.IO.Path.DirectorySeparatorChar
as a directory separator in .NET apps instead of hardcoding it to\
or/
. Use the/
as a directory separator on Unix in file paths passed to thedotnet
host, hosting APIs,ilasm
andildasm
tools or variousDOTNET_xxx
configuration variables.Feature area
Core .NET libraries, Other (please put exact area in description textbox)
Affected APIs
System.Runtime.InteropServices.DllImportAttribute.Value
propertySystem.Runtime.InteropServices.NativeLibrary
classLoad
method - all overloadsTryLoad
method - all overloadsSystem.Reflection.Assembly
classLoadFrom
LoadFile
UnsafeLoadFrom
System.Runtime.Loader.AssemblyLoadContext
LoadFromAssemblyPath
LoadFromNativeImagePath
LoadUnmanagedDllFromPath
DOTNET_xxx
configuration variables that contain file pathsilasm
andildasm
toolsdotnet
hostAssociated WorkItem - 61504
The text was updated successfully, but these errors were encountered: