Skip to content

Gate AOT fast path behind DOTNET_CLI_ENABLEAOT#54047

Open
JeremyKuhne wants to merge 2 commits intodotnet:mainfrom
JeremyKuhne:aotme2
Open

Gate AOT fast path behind DOTNET_CLI_ENABLEAOT#54047
JeremyKuhne wants to merge 2 commits intodotnet:mainfrom
JeremyKuhne:aotme2

Conversation

@JeremyKuhne
Copy link
Copy Markdown
Member

Gate AOT fast path behind DOTNET_CLI_ENABLEAOT and fix hostfxr initialization

The AOT parser in NativeEntryPoint is now only invoked when DOTNET_CLI_ENABLEAOT=true. When unset, the bridge falls through to the managed CLI immediately.

ManagedHost.RunApp now configures the runtime exactly as the muxer would for an SDK command:

  • Sets host_path in hostfxr_initialize_parameters so hostfxr uses the correct host executable identity instead of the current process.
  • Sets the HOSTFXR_PATH runtime property via hostfxr_set_runtime_property_value, matching the muxer's is_sdk_command=true behavior so the SDK can locate hostfxr directly.

All debug configurations (launchSettings.json, vcxproj.user, debug-dn.cmd, tasks.code-workspace) updated to set the new env var. DESIGN.md updated to reflect the DOTNET_CLI_ENABLEAOT gate and the muxer's existing try_invoke_aot_sdk integration.

…lization

The AOT parser in NativeEntryPoint is now only invoked when
DOTNET_CLI_ENABLEAOT=true. When unset, the bridge falls through to
the managed CLI immediately.

ManagedHost.RunApp now configures the runtime exactly as the muxer
would for an SDK command:
- Sets host_path in hostfxr_initialize_parameters so hostfxr uses the
  correct host executable identity instead of the current process.
- Sets the HOSTFXR_PATH runtime property via
  hostfxr_set_runtime_property_value, matching the muxer's
  is_sdk_command=true behavior so the SDK can locate hostfxr directly.

All debug configurations (launchSettings.json, vcxproj.user,
debug-dn.cmd, tasks.code-workspace) updated to set the new env var.
DESIGN.md updated to reflect the DOTNET_CLI_ENABLEAOT gate and the
muxer's existing try_invoke_aot_sdk integration.

Co-authored-by: Copilot <copilot@github.com>
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.

Pull request overview

Gates the NativeAOT “fast path” for dotnet-aot behind a new DOTNET_CLI_ENABLEAOT environment variable and adjusts hostfxr initialization so the managed fallback is configured like an SDK command invoked by the muxer.

Changes:

  • Add DOTNET_CLI_ENABLEAOT gate so the AOT parser only runs when explicitly enabled.
  • Update managed fallback hosting to pass host_path and set HOSTFXR_PATH as a runtime property.
  • Update dev/debug configurations and design documentation to reflect the new gate and hosting behavior.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tasks.code-workspace Sets DOTNET_CLI_ENABLEAOT=true for debug runs.
src/Common/EnvironmentVariableNames.cs Adds the DOTNET_CLI_ENABLEAOT env var name constant.
src/Cli/dotnet-aot/dotnet-aot.csproj Links EnvironmentVariableNames.cs into the AOT project.
src/Cli/dotnet-aot/NativeEntryPoint.cs Gates AOT parse/invoke behind env var; updates managed fallback call signature.
src/Cli/dotnet-aot/ManagedHost.cs Passes host_path to hostfxr init and sets HOSTFXR_PATH runtime property.
src/Cli/dotnet-aot/DESIGN.md Documents the gate and the updated slow-path hosting sequence.
src/Cli/dn/dn.csproj Updates generated debug artifacts to set DOTNET_CLI_ENABLEAOT=true.
src/Cli/dn/dn-native-debug.vcxproj Updates native debug project environment to enable AOT path.

Comment thread src/Cli/dotnet-aot/ManagedHost.cs Outdated
Comment thread src/Cli/dotnet-aot/ManagedHost.cs Outdated
…HOSTFXR_PATH

Address PR review feedback:
- Check the return value of hostfxr_set_runtime_property_value and throw
  on failure instead of silently ignoring it.
- Use Constants.RuntimeProperty.HostFxrPath instead of a string literal.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants