dotnetup: classify PATH dotnet by managed hive; fix env config doc#55349
Open
dsplaisted wants to merge 4 commits into
Open
dotnetup: classify PATH dotnet by managed hive; fix env config doc#55349dsplaisted wants to merge 4 commits into
dsplaisted wants to merge 4 commits into
Conversation
Specify whether the active path is the dotnetup managed hive rather than whether it is a system-installed path
|
Azure Pipelines: Successfully started running 2 pipeline(s). 1 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refines dotnetup’s notion of the dotnet that wins on PATH to distinguish dotnetup-managed hives from arbitrary user-writable installs, preventing dotnetup dotnet/uninstall from acting on installs it does not own. It also aligns documentation with actual DotnetAccessMode JSON parsing behavior and updates a user-facing env message (with localization updates).
Changes:
- Replaces
InstallType (User/System)classification fromGetCurrentPathConfigurationwithIsDotnetupHiveand realignsDotnetCommand,UninstallWorkflow, andInitWorkflowsaccordingly. - Updates telemetry for “existing install type” to use
InstallPathClassifier.ClassifyInstallPathbuckets. - Updates tests and documentation; adjusts one env-related user-facing string and propagates it to XLFs.
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/dotnetup.Tests/UninstallWorkflowTests.cs | Updates uninstall path-resolution tests to reflect “dotnetup hive vs not” semantics and adds a regression test for unmanaged user installs. |
| test/dotnetup.Tests/DotnetCommandTests.cs | Updates dotnetup dotnet tests to gate use of the PATH-resolved root on IsDotnetupHive. |
| src/Installer/dotnetup.Library/xlf/Strings.zh-Hant.xlf | Updates localized resource unit for the changed env message. |
| src/Installer/dotnetup.Library/xlf/Strings.zh-Hans.xlf | Updates localized resource unit for the changed env message. |
| src/Installer/dotnetup.Library/xlf/Strings.tr.xlf | Updates localized resource unit for the changed env message. |
| src/Installer/dotnetup.Library/xlf/Strings.ru.xlf | Updates localized resource unit for the changed env message. |
| src/Installer/dotnetup.Library/xlf/Strings.pt-BR.xlf | Updates localized resource unit for the changed env message. |
| src/Installer/dotnetup.Library/xlf/Strings.pl.xlf | Updates localized resource unit for the changed env message. |
| src/Installer/dotnetup.Library/xlf/Strings.ko.xlf | Updates localized resource unit for the changed env message. |
| src/Installer/dotnetup.Library/xlf/Strings.ja.xlf | Updates localized resource unit for the changed env message. |
| src/Installer/dotnetup.Library/xlf/Strings.it.xlf | Updates localized resource unit for the changed env message. |
| src/Installer/dotnetup.Library/xlf/Strings.fr.xlf | Updates localized resource unit for the changed env message. |
| src/Installer/dotnetup.Library/xlf/Strings.es.xlf | Updates localized resource unit for the changed env message. |
| src/Installer/dotnetup.Library/xlf/Strings.de.xlf | Updates localized resource unit for the changed env message. |
| src/Installer/dotnetup.Library/xlf/Strings.cs.xlf | Updates localized resource unit for the changed env message. |
| src/Installer/dotnetup.Library/Strings.resx | Updates the source string shown after env changes so it’s clearer that restarts are required for other terminals/apps. |
| src/Installer/dotnetup.Library/IDotnetEnvironmentManager.cs | Updates the contract to return DotnetInstallRootConfiguration with IsDotnetupHive and adds clarifying XML docs. |
| src/Installer/dotnetup.Library/DotnetEnvironmentManager.cs | Implements hive classification by comparing the PATH-resolved root to the default dotnetup install path. |
| src/Installer/dotnetup.Library/Commands/Shared/UninstallWorkflow.cs | Ensures uninstall only targets the PATH-resolved root when it’s a dotnetup-managed hive. |
| src/Installer/dotnetup.Library/Commands/Shared/InstallWorkflow.cs | Records “existing install type” telemetry using path classification buckets rather than InstallType. |
| src/Installer/dotnetup.Library/Commands/Init/InitWorkflows.cs | Restores explicit “is system/admin install” checks where that’s the real requirement (migration display). |
| src/Installer/dotnetup.Library/Commands/Dotnet/DotnetCommand.cs | Ensures dotnetup dotnet only uses the PATH-resolved root when it’s the managed hive. |
| documentation/general/dotnetup/designs/dotnetup-env.md | Corrects the design doc to match actual JSON converter behavior (legacy spellings are not accepted). |
| { | ||
| var configuredRoot = _dotnetEnvironment.GetCurrentPathConfiguration(); | ||
| if (configuredRoot is not null && configuredRoot.InstallType == InstallType.User) | ||
| if (configuredRoot is { IsDotnetupHive: true }) |
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.
Follow-up to #54545 addressing review feedback (especially #54545 (comment)). Also includes improvement to some wording I noticed when testing.
Copilot description:
Changes
1. Classify the PATH dotnet by "is it a dotnetup-managed hive?" (not system vs user)
GetCurrentPathConfigurationpreviously returned anInstallType(User/System) derived fromIsAdminInstallPath. But the consumers actually need to know whether thedotnetwinning onPATHis a hive dotnetup owns — something it may run or uninstall from. Under the old axis, adotnetthat merely lives in a user-writable location (e.g. a hand-extractedC:\dotnetonPATH) was labeledUser, sodotnetup dotnetanddotnetup uninstall(without--install-path) would run or target an install dotnetup does not own.DotnetInstallRootConfiguration.InstallType→bool IsDotnetupHive.IsDotnetupHiveistrueonly when the resolved root is dotnetup's managed hive (today, the default install path; configurable hives tracked in dotnetup: Support custom dotnet roots #55346).DotnetCommand/UninstallWorkflowact on the configured path only when it's the hive;InitWorkflowsusesInstallPathClassifier.IsAdminInstallPathdirectly where it genuinely needs "is this a system install?"; install telemetry records the existing install's location bucket viaClassifyInstallPath.Behavior change:
dotnetup dotnet/uninstallno longer act on a non-manageddotnetthat happens to win onPATH; they fall back to the managed hive.2. Doc fix:
DotnetAccessModelegacy spellings are not acceptedThe
dotnetup envdesign doc claimed the JSON converter accepts legacy spellings (full/fullpathreplacement). It does not —DotnetAccessModeJsonConverteris a plain camel-case string-enum converter (integer values rejected), and unrecognized values are treated as a corrupt config that re-defaults on next write. Corrected the doc to match the code and the rest of the doc.Testing
Built
dotnetup.Tests(Release); the affectedUninstallWorkflowTestsandDotnetCommandTestspass (23/23).