Allow disabling runtime versions via an environment variable - #119343
Conversation
|
Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov |
There was a problem hiding this comment.
Pull Request Overview
This PR implements functionality to allow disabling specific runtime versions during framework resolution via the DOTNET_DISABLE_RUNTIME_VERSIONS environment variable. The feature enables users to prevent the framework resolver from selecting specified versions, even if they would normally be chosen through roll-forward logic.
Key changes:
- Added environment variable parsing for semicolon-separated disabled versions
- Modified framework resolution logic to skip disabled versions during search
- Added comprehensive test coverage for various disable scenarios
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/native/corehost/fxr/fx_resolver.h | Moved constructor to implementation file and added member variable for disabled versions |
| src/native/corehost/fxr/fx_resolver.cpp | Implemented environment variable parsing, constructor, and disabled version checking in resolution logic |
| src/installer/tests/TestUtils/Constants.cs | Added constant for the new environment variable name |
| src/installer/tests/HostActivation.Tests/FrameworkResolution/FrameworkResolution.cs | Added comprehensive test cases covering single/multiple disabled versions and roll-forward scenarios |
…o indicate disabled
|
/backport to release/10.0 |
|
Started backporting to release/10.0: https://github.com/dotnet/runtime/actions/runs/17601140737 |
|
@elinor-fung backporting to "release/10.0" failed, the patch most likely resulted in conflicts: $ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch
Applying: Allow disabling runtime versions via an environment variable
Applying: Update get_all_framework_infos, add test cases
.git/rebase-apply/patch:35: trailing whitespace.
{
warning: 1 line adds whitespace errors.
Using index info to reconstruct a base tree...
M src/installer/tests/HostActivation.Tests/NativeHostApis.cs
Falling back to patching base and 3-way merge...
Auto-merging src/installer/tests/HostActivation.Tests/NativeHostApis.cs
CONFLICT (content): Merge conflict in src/installer/tests/HostActivation.Tests/NativeHostApis.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0002 Update get_all_framework_infos, add test cases
Error: The process '/usr/bin/git' failed with exit code 128Please backport manually! |
…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
#119518) - 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
Allow disabling specific runtime versions during framework resolution via an environment variable
DOTNET_DISABLE_RUNTIME_VERSIONSenvironment variable as one or more versions separated by semi-colons - for example,9.0.7or9.0.2;9.0.7Resolves #118553
cc @dotnet/appmodel @AaronRobinsonMSFT