Use Environment.SpecialFolder.UserProfile, not SpecialFolder.Personal.#16017
Conversation
Context: dotnet/runtime#68610 Context: dotnet/android-tools@0be567a9 In Mono and .NET prior to .NET 8, the [`System.Environment.SpecialFolder`][0]`.Personal` enum value would refer to `$HOME` on Unix platforms. This will be changing in .NET 8, such that `Environment.SpecialFolder.Personal` will instead refer to `$XDG_DOCUMENTS_DIR` (if set) or `$HOME/Documents`. This is for "semantic compatibility" with .NET on Windows. Replace usage of `Environment.SpecialFolder.Personal` with `Environment.SpecialFolder.UserProfile`, so that our code continues to work as expected under .NET 8. [0]: https://docs.microsoft.com/en-us/dotnet/api/system.environment.specialfolder?view=net-6.0 Requesting a pull to xamarin:main from rolfbjarne:no-more-personal-special-folder Write a message for this pull request. The first block of text is the title and the rest is the description.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
eerhardt
left a comment
There was a problem hiding this comment.
LGTM. Thanks for fixing this up!
Note that Environment.SpecialFolder.MyDocuments is the same underlying enum value as Environment.SpecialFolder.Personal. It would be good to audit all the calls to MyDocuments and ensure they actually meant a "Documents" folder, and not the UserProfile as well.
Also note, the .NET 8 change doesn't affect iOS/tvOS/etc. It only affects macOS and Linux.
💻 [PR Build] Tests on macOS Mac Catalina (10.15) passed 💻✅ All tests on macOS Mac Catalina (10.15) passed. Pipeline on Agent |
💻 [PR Build] Tests on macOS M1 - Mac Big Sur (11.5) passed 💻✅ All tests on macOS M1 - Mac Big Sur (11.5) passed. Pipeline on Agent |
✅ API diff for current PR / commitLegacy Xamarin (No breaking changes)
NET (empty diffs)
✅ API diff vs stableLegacy Xamarin (No breaking changes).NET (No breaking changes)✅ Generator diffGenerator diff is empty Pipeline on Agent |
🔥 [CI Build] Test results 🔥Test results❌ Tests failed on VSTS: simulator tests 0 tests crashed, 1 tests failed, 222 tests passed. Failures❌ msbuild testsDetails
Html Report (VSDrops) Download Successes✅ bcl: All 69 tests passed. Html Report (VSDrops) Download Pipeline on Agent |
|
Test failure is unrelated (https://github.com/xamarin/maccore/issues/2620). |
Context: dotnet/runtime#68610
Context: dotnet/android-tools@0be567a9
In Mono and .NET prior to .NET 8, the
System.Environment.SpecialFolder.Personalenum value would refer to$HOMEon Unix platforms.This will be changing in .NET 8, such that
Environment.SpecialFolder.Personalwill instead refer to$XDG_DOCUMENTS_DIR(if set) or$HOME/Documents. This is for "semanticcompatibility" with .NET on Windows.
Replace usage of
Environment.SpecialFolder.PersonalwithEnvironment.SpecialFolder.UserProfile, so that our code continues to work asexpected under .NET 8.