[release/10.0] Allow disabling runtime versions via an environment variable - #119518
Merged
agocke merged 1 commit intoSep 22, 2025
Merged
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
Contributor
There was a problem hiding this comment.
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 |
Contributor
|
Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov |
This was referenced Sep 10, 2025
Member
Author
|
All test failures have known issues linked. |
jtschuster
approved these changes
Sep 10, 2025
jeffschwMSFT
approved these changes
Sep 14, 2025
jeffschwMSFT
left a comment
Member
There was a problem hiding this comment.
approved. we can merge when ready
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
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.