Skip to content

Conversation

elinor-fung
Copy link
Member

@elinor-fung elinor-fung commented Sep 10, 2025

Backport of #119343
cc @dotnet/appmodel @AaronRobinsonMSFT

Customer Impact

  • Customer reported
  • Found internally

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

  • Yes
  • No

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.

…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
@Copilot Copilot AI review requested due to automatic review settings September 10, 2025 05:28
Copy link
Contributor

@Copilot Copilot AI left a 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

Copy link
Contributor

Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov
See info in area-owners.md if you want to be subscribed.

@elinor-fung
Copy link
Member Author

All test failures have known issues linked.

@agocke agocke added the Servicing-consider Issue for next servicing release review label Sep 10, 2025
Copy link
Member

@agocke agocke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@jeffschwMSFT jeffschwMSFT left a 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

@jeffschwMSFT jeffschwMSFT added this to the 10.0.0 milestone Sep 14, 2025
@jeffschwMSFT jeffschwMSFT added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Sep 14, 2025
@agocke agocke merged commit a6f6bd4 into dotnet:release/10.0 Sep 22, 2025
162 of 168 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Host Servicing-approved Approved for servicing release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants