Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Breaking change]: Remove file path backslash to slash mapping in CoreCLR native runtime and PAL on Unix #32906

Closed
2 tasks done
janvorli opened this issue Dec 7, 2022 · 0 comments · Fixed by #33790
Closed
2 tasks done
Assignees
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.

Comments

@janvorli
Copy link
Member

janvorli commented Dec 7, 2022

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 and ildasm 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

  • Binary incompatible: Existing binaries may encounter a breaking change in behavior, such as failure to load/execute or different run-time behavior.
  • Source incompatible: Source code may encounter a breaking change in behavior when targeting the new runtime/component/SDK, such as compile errors or different run-time behavior.

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 the dotnet host, hosting APIs, ilasm and ildasm tools or various DOTNET_xxx configuration variables.

Feature area

Core .NET libraries, Other (please put exact area in description textbox)

Affected APIs

  • Hosting APIs
  • System.Runtime.InteropServices.DllImportAttribute.Value property
  • System.Runtime.InteropServices.NativeLibrary class
    • Load method - all overloads
    • TryLoad method - all overloads
  • System.Reflection.Assembly class
    • LoadFrom
    • LoadFile
    • UnsafeLoadFrom
  • System.Runtime.Loader.AssemblyLoadContext
    • LoadFromAssemblyPath
    • LoadFromNativeImagePath
    • LoadUnmanagedDllFromPath
  • Various DOTNET_xxx configuration variables that contain file paths
  • File paths passed to the ilasm and ildasm tools
  • File paths passed to the dotnet host

Associated WorkItem - 61504

@janvorli janvorli added doc-idea Indicates issues that are suggestions for new topics [org][type][category] breaking-change Indicates a .NET Core breaking change Pri1 High priority, do before Pri2 and Pri3 labels Dec 7, 2022
@dotnet-bot dotnet-bot added ⌚ Not Triaged Not triaged binary incompatible Existing binaries may encounter a breaking change in behavior. source incompatible Source code may encounter a breaking change in behavior when targeting the new version. labels Dec 7, 2022
@gewarren gewarren removed the ⌚ Not Triaged Not triaged label Dec 7, 2022
@gewarren gewarren added the 🏁 Release: .NET 8 Work items for the .NET 8 release label Dec 14, 2022
@gewarren gewarren added the 🗺️ reQUEST Triggers an issue to be imported into Quest. label Jan 10, 2023
@ghost ghost added the in-pr This issue will be closed (fixed) by an active pull request. label Jan 31, 2023
@github-actions github-actions bot added 📌 seQUESTered Identifies that an issue has been imported into Quest. and removed 🗺️ reQUEST Triggers an issue to be imported into Quest. labels Jan 31, 2023
@ghost ghost removed the in-pr This issue will be closed (fixed) by an active pull request. label Jan 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants