[runtime] Set the current directory to the root directory of the app bundle for all platforms in .NET. - #12104
Merged
Conversation
…bundle for all platforms in .NET. To have consistent behavior in .NET, set the current directory to the root of the app bundle for all platforms. This is a breaking change for legacy Xamarin.Mac, which used to set the current directory to the Contents/Resources subdirectory, but there's a simple workaround for customers that depend on the old behavior (change it in Main themselves), and I believe the consistent experience across platforms warrants this change. Note that we already had a breaking change here for macOS/.NET: we were (unintentionally) setting the current directory to the Contents/MonoBundle directory, which neither matched mobile platforms, nor the legacy Xamarin.Mac behavior. This solves the problem of what to do for Mac Catalyst apps, because there's no need to choose between the macOS or the mobile behavior, since they're the same. This required changing the launch of macOS apps using CoreCLR to pass the full path to the entry assembly, since the entry assembly isn't in the current directory anymore.
Collaborator
❌ [PR Build] Tests failed on Build ❌Tests failed on Build. API diff✅ API Diff from stable View API diffAPI & Generator diff✅ API Diff (from PR only) (no change) GitHub pagesResults can be found in the following github pages (it might take some time to publish): Test results2 tests failed, 113 tests passed.Failed tests
Pipeline on Agent XAMBOT-1094.BigSur' |
Member
Author
|
Test failures are unrelated
|
mandel-macaque
approved these changes
Jul 14, 2021
mandel-macaque
left a comment
Contributor
There was a problem hiding this comment.
+1 but lets ping VsMac just in case :)
stephen-hawley
approved these changes
Jul 14, 2021
Member
Author
|
CC @emaf just in case this is something that would affect you (I don't think it would though, but just to be sure). |
Member
Author
|
CC @Therzok is this something that would affect you? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
To have consistent behavior in .NET, set the current directory to the root of
the app bundle for all platforms.
This is a breaking change for legacy Xamarin.Mac, which used to set the
current directory to the Contents/Resources subdirectory, but there's a simple
workaround for customers that depend on the old behavior (change it in Main
themselves), and I believe the consistent experience across platforms warrants
this change.
Note that we already had a breaking change here for macOS/.NET: we were
(unintentionally) setting the current directory to the Contents/MonoBundle
directory, which neither matched mobile platforms, nor the legacy Xamarin.Mac
behavior.
This solves the problem of what to do for Mac Catalyst apps, because there's
no need to choose between the macOS or the mobile behavior, since they're the
same.
This required changing the launch of macOS apps using CoreCLR to pass the full
path to the entry assembly, since the entry assembly isn't in the current
directory anymore.