-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[release/10.0] Allow disabling runtime versions via an environment variable #119518
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
[release/10.0] Allow disabling runtime versions via an environment variable #119518
Conversation
…119343) - Read the `DOTNET_DISABLE_RUNTIME_VERSIONS` environment variable as one or more versions separated by semi-colons - for example, `9.0.7` or `9.0.2;9.0.7` - Must be the exact version string. An invalid or non-existent version has no effect. - Resolver reads and stores this when it is created - Update the framework resolution logic to skip disabled versions when searching for compatible frameworks - If all matching versions are disabled, resolution fails
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements the ability to disable specific runtime versions via the DOTNET_DISABLE_RUNTIME_VERSIONS
environment variable, which serves as a faster mitigation strategy for problematic runtime versions in large-scale deployments compared to uninstalling them.
Key changes:
- Adds support for parsing a semicolon-separated list of versions from
DOTNET_DISABLE_RUNTIME_VERSIONS
- Integrates disabled version checking into framework resolution and enumeration logic
- Adds comprehensive test coverage for the new functionality
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
src/native/corehost/fxr/hostfxr.cpp | Updates framework enumeration call to exclude disabled versions by default |
src/native/corehost/fxr/fx_resolver.messages.cpp | Modifies error reporting to include disabled versions and show their disabled status |
src/native/corehost/fxr/fx_resolver.h | Adds disabled versions storage and parsing method declaration |
src/native/corehost/fxr/fx_resolver.cpp | Implements disabled version parsing and integrates checks into framework resolution |
src/native/corehost/fxr/framework_info.h | Updates framework_info structure to track disabled status and adds include_disabled_versions parameter |
src/native/corehost/fxr/framework_info.cpp | Implements disabled version filtering in framework enumeration |
src/installer/tests/TestUtils/Constants.cs | Adds constant for the new environment variable |
src/installer/tests/HostActivation.Tests/NativeHostApis.cs | Adds test for disabled versions in hostfxr API and refactors existing test |
src/installer/tests/HostActivation.Tests/HostCommands.cs | Adds test for disabled versions in --list-runtimes command |
src/installer/tests/HostActivation.Tests/FrameworkResolution/FrameworkResolution.cs | Adds comprehensive tests for disabled version behavior in framework resolution |
Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov |
All test failures have known issues linked. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approved. we can merge when ready
Backport of #119343
cc @dotnet/appmodel @AaronRobinsonMSFT
Customer Impact
Issue: #118553
New versions of a runtime can have changes that cause issues and require investigation. For large-scale deployments, it can be expensive to roll back the installation of a new runtime. This change allows disabling specific runtime versions via an environment variable, which should be a faster mitigation for large deployments than uninstalling a specific version.
Regression
Testing
Automated tests added.
Risk
Medium-low. This is in a code path that affects the launch of every single application. However, for the vast majority of cases (where this environment variable is not set), the impact is checking an environment variable and allocating an empty vector, so the risk pretty contained.