Skip to content

Remove multi-level lookup completely - #132335

Open
elinor-fung wants to merge 3 commits into
dotnet:mainfrom
elinor-fung:remove-multilevel-lookup
Open

Remove multi-level lookup completely#132335
elinor-fung wants to merge 3 commits into
dotnet:mainfrom
elinor-fung:remove-multilevel-lookup

Conversation

@elinor-fung

@elinor-fung elinor-fung commented Aug 14, 2026

Copy link
Copy Markdown
Member

Resolves #131555

cc @dotnet/appmodel @AaronRobinsonMSFT

@elinor-fung elinor-fung added this to the 12.0.0 milestone Aug 14, 2026
Copilot AI lite review requested due to automatic review settings August 14, 2026 18:48
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 4 pipeline(s).
12 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 removes the remaining multi-level lookup behavior from the native hosting layer, including the associated helpers, probing of global locations/shared store, and test coverage that was specific to the feature.

Changes:

  • Remove multi-level lookup decision logic (TFM-based compat gating, DOTNET_MULTILEVEL_LOOKUP, and global-dir probing) from corehost resolution paths.
  • Simplify framework/shared-store probing to only consider the selected dotnet_root (and other explicit/known locations such as self-registered/default install where applicable).
  • Delete/adjust installer/host activation tests and docs that asserted or described multi-level lookup behavior.
Show a summary per file
File Description
src/native/corehost/runtime_config.h Removes MLL-related API and compat helpers from runtime config.
src/native/corehost/runtime_config.cpp Removes TFM major parsing and MLL-disable logic.
src/native/corehost/hostpolicy/shared_store.cpp Stops probing global shared store locations; keeps env + muxer-relative paths.
src/native/corehost/hostmisc/utils.h Removes MLL helper declarations.
src/native/corehost/hostmisc/utils.cpp Removes DOTNET_MULTILEVEL_LOOKUP parsing and framework-location aggregation.
src/native/corehost/hostmisc/pal.windows.cpp Removes global dotnet dir enumeration for MLL.
src/native/corehost/hostmisc/pal.unix.cpp Removes stub global dotnet dir API (no longer needed).
src/native/corehost/hostmisc/pal.h Removes get_global_dotnet_dirs from PAL surface.
src/native/corehost/hostfxr.h Updates API docs to no longer describe multi-level lookup ordering/behavior.
src/native/corehost/fxr/sdk_info.cpp Updates comments to reflect tie-breaking for custom search locations rather than MLL.
src/native/corehost/fxr/hostfxr.cpp Adds empty-dotnet_root validation for startupinfo entrypoints; adjusts framework enumeration call signature.
src/native/corehost/fxr/fx_resolver.messages.cpp Removes MLL parameter plumbing when collecting framework infos for diagnostics.
src/native/corehost/fxr/fx_resolver.h Removes MLL state/parameter from resolver type and error display helper signature.
src/native/corehost/fxr/fx_resolver.cpp Removes multi-hive framework probing; resolves frameworks from the selected dotnet_root only.
src/native/corehost/fxr/framework_info.h Removes hive depth tracking and MLL parameter from framework enumeration API.
src/native/corehost/fxr/framework_info.cpp Enumerates frameworks only under <dotnet_root>/shared, without multi-hive ordering.
src/installer/tests/TestUtils/DotNetCli.cs Removes default test opt-out of MLL (no longer applicable).
src/installer/tests/TestUtils/Constants.cs Removes DOTNET_MULTILEVEL_LOOKUP constant.
src/installer/tests/TestUtils/CommandExtensions.cs Removes .MultilevelLookup(...) command helper.
src/installer/tests/HostActivation.Tests/SDKLookup.cs Removes calls to .MultilevelLookup(false).
src/installer/tests/HostActivation.Tests/NativeHosting/SharedTestStateBase.cs Removes .MultilevelLookup(false) usage when constructing native host commands.
src/installer/tests/HostActivation.Tests/NativeHosting/Nethost.cs Removes .MultilevelLookup(...) usage in nethost tests.
src/installer/tests/HostActivation.Tests/NativeHosting/Ijwhost.cs Removes .MultilevelLookup(false) usage.
src/installer/tests/HostActivation.Tests/NativeHosting/ComhostSideBySide.cs Removes .MultilevelLookup(false) usage.
src/installer/tests/HostActivation.Tests/InstallLocation.cs Removes .MultilevelLookup(false) usage.
src/installer/tests/HostActivation.Tests/HostVersionCompatibility.cs Updates comment to remove MLL-specific rationale.
src/installer/tests/HostActivation.Tests/FrameworkResolution/MultilevelLookup.cs Deletes test suite dedicated to multi-level lookup behavior.
src/installer/tests/HostActivation.Tests/FrameworkDependentAppLaunch.cs Removes .MultilevelLookup(false) usage.
src/installer/tests/HostActivation.Tests/DependencyResolution/ComponentSharedTestStateBase.cs Removes .MultilevelLookup(false) usage.
src/installer/tests/AppHost.Bundle.Tests/BundledAppWithSubDirs.cs Removes .MultilevelLookup(false) usage.
src/installer/tests/AppHost.Bundle.Tests/AppLaunch.cs Removes .MultilevelLookup(false) usage.
docs/design/features/hosting-layer-apis.md Updates description to remove MLL from SDK resolution doc.
docs/design/features/host-probing.md Removes Windows global-location probing notes tied to MLL/shared store global usage.
docs/design/features/host-component-dependencies-resolution.md Removes MLL references from component dependency resolution design doc.

Review details

Suppressed comments (1)

src/native/corehost/fxr/hostfxr.cpp:59

  • This validation now treats an empty dotnet_root as invalid, but the error message only mentions null. Updating the message avoids confusion when callers pass an empty string.
    if (host_path == nullptr || dotnet_root == nullptr || app_path == nullptr || dotnet_root[0] == _X('\0'))
    {
        trace::error(_X("Invalid startup info: host_path, dotnet_root, and app_path should not be null."));
        return StatusCode::InvalidArgFailure;
  • Files reviewed: 34/34 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread src/native/corehost/fxr/hostfxr.cpp

@AaronRobinsonMSFT AaronRobinsonMSFT left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

:shipit:

@vitek-karas You better sign off too!

Comment thread src/installer/tests/HostActivation.Tests/NativeHosting/Nethost.cs
Copilot AI review requested due to automatic review settings August 15, 2026 04:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review details

Suppressed comments (3)

Previously missed (1) — in code that hasn't changed since the last review.

src/native/corehost/hostfxr.h:334

  • This comment says "dotnet root directory (if any)" but the implementation treats dotnet_root == nullptr as the signal to use the global default location. Consider tightening the wording here to explicitly call out that nullptr is what triggers the global default behavior, so native hosts don’t misinterpret empty strings as the same thing.
// Resolves the existing SDKs and frameworks from a dotnet root directory (if
// any), or the global default location.

src/native/corehost/fxr/hostfxr.cpp:38

  • The validation now rejects an empty dotnet_root (checks dotnet_root[0] == '\0'), but the error message only mentions null values. This makes failures harder to diagnose since an empty string will report the wrong cause.
    if (host_path == nullptr || dotnet_root == nullptr || app_path == nullptr || dotnet_root[0] == _X('\0'))
    {
        trace::error(_X("Invalid startup info: host_path, dotnet_root, and app_path should not be null."));
        return StatusCode::InvalidArgFailure;
    }

src/native/corehost/fxr/hostfxr.cpp:60

  • Same issue as above: this check now treats an empty dotnet_root as invalid, but the error message only mentions null. Update the message so it accurately describes the validation being performed.
    if (host_path == nullptr || dotnet_root == nullptr || app_path == nullptr || dotnet_root[0] == _X('\0'))
    {
        trace::error(_X("Invalid startup info: host_path, dotnet_root, and app_path should not be null."));
        return StatusCode::InvalidArgFailure;
    }
  • Files reviewed: 34/34 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Remove multi-level lookup completely

3 participants