Skip to content

Add logic to muxer to invoke AOT-ed SDK#126596

Open
elinor-fung wants to merge 2 commits intodotnet:mainfrom
elinor-fung:launch-aot-sdk
Open

Add logic to muxer to invoke AOT-ed SDK#126596
elinor-fung wants to merge 2 commits intodotnet:mainfrom
elinor-fung:launch-aot-sdk

Conversation

@elinor-fung
Copy link
Copy Markdown
Member

@elinor-fung elinor-fung commented Apr 7, 2026

Fixes #126171

Updates the muxer to look for and natively invoke a \dotnet-aot\ shared library when it exists in the resolved SDK directory. When present, the muxer loads the library, resolves the \dotnet_execute\ entry point, and calls it with the host path, dotnet root, SDK directory, hostfxr path, and user arguments. If the AOT library is not available or doesn't have the expected entry point, the muxer falls back to the existing managed SDK path.

Changes

Native host

  • Add try_invoke_aot_sdk helper in fx_muxer_t::handle_cli that attempts to load dotnet-aot from the resolved SDK directory
  • Fall through to the existing dotnet.dll path if the AOT library is absent

Tests

  • Add mockaotsdk native test library that implements the dotnet_execute entry point and prints received arguments
  • Add DispatchToAotSdk test in SDKLookup.cs validating the muxer dispatches to the AOT SDK with the correct arguments

elinor-fung and others added 2 commits April 1, 2026 18:14
When the dotnet muxer resolves an SDK, it now checks for a dotnet-aot
native library in the SDK directory before falling back to the managed
dotnet.dll path. If the library exists and exports a dotnet_execute
entry point, the muxer loads it and calls it with the host path, dotnet
root, SDK directory, hostfxr path, and user arguments.

The AOT library handles its own fallback to the managed runtime path
when needed. If the library cannot be loaded or the entry point is
missing, the muxer gracefully falls back to the existing managed SDK
path.

Fixes dotnet#126171

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add DispatchToAotSdk test to verify the muxer correctly loads and
invokes the dotnet-aot library from the resolved SDK directory. The
test uses a mock AOT SDK shared library that prints the received
arguments for validation.

- Add mockaotsdk native test library with dotnet_execute entry point
- Add DotNetAot entry to Binaries.cs for test discovery
- Add DispatchToAotSdk test in SDKLookup.cs
- Move 'Using AOT-ed SDK' trace to just before invocation and remove
  redundant failure trace on load_library

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 7, 2026 02:18
Copy link
Copy Markdown
Contributor

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke, @jeffschwMSFT, @elinor-fung
See info in area-owners.md if you want to be subscribed.

@elinor-fung elinor-fung closed this Apr 7, 2026
@elinor-fung elinor-fung reopened this Apr 7, 2026
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.

Add logic to muxer to invoke AOT'ed CLI

2 participants