Gate AOT fast path behind DOTNET_CLI_ENABLEAOT#54047
Open
JeremyKuhne wants to merge 2 commits intodotnet:mainfrom
Open
Gate AOT fast path behind DOTNET_CLI_ENABLEAOT#54047JeremyKuhne wants to merge 2 commits intodotnet:mainfrom
JeremyKuhne wants to merge 2 commits intodotnet:mainfrom
Conversation
…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>
Contributor
There was a problem hiding this comment.
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_ENABLEAOTgate so the AOT parser only runs when explicitly enabled. - Update managed fallback hosting to pass
host_pathand setHOSTFXR_PATHas 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. |
…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.
NikolaMilosavljevic
approved these changes
Apr 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
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.