Open eerhardt opened 2 years ago
Tagging subscribers to this area: @dotnet/area-system-runtime See info in area-owners.md if you want to be subscribed.
Author: | eerhardt |
---|---|
Assignees: | - |
Labels: | `api-suggestion`, `area-System.Runtime` |
Milestone: | - |
Background and motivation
Environment.SpecialFolder
has two enum names that map to the same underlying enum valueMyDocuments
andPersonal
.https://github.com/dotnet/runtime/blob/62140229d9e222eb326e18207d166209330b2194/src/libraries/System.Private.CoreLib/src/System/Environment.SpecialFolder.cs#L30-L31
This is rather confusing, and also leads to bugs because consumers wrongly believe that
Environment.SpecialFolder.Personal
really meansEnvironment.SpecialFolder.UserProfile
. Further, with https://github.com/dotnet/runtime/pull/68610, we are fixing the path returned fromSpecialFolder.MyDocuments/Personal
to actually be a "Documents" folder on both Linux and macOS. When doing the breaking change analysis, I found more places usingEnvironment.SpecialFolder.Personal
to meanEnvironment.SpecialFolder.UserProfile
than I did for it to mean an actual "MyDocuments" folder.We should deprecate and hide the
Personal
enum value because people are using it wrong and it means the exact same thing as "MyDocuments".Examples of places that got it wrong:
API Proposal
API Usage
Don't use
Environment.SpecialFolder.Personal
, instead either pickSpecialFolder.MyDocuments
orSpecialFolder.UserProfile
, as appropriate.Alternative Designs
No response
Risks
No response