Repository navigation
Enable full dotnet --info output in the AOT CLI - #55084
Merged
Merged
Conversation
The AOT CLI (dotnet-aot) previously omitted the workload version, MSBuild version, and the .NET workloads installed section from dotnet --info; they were gated behind #if !CLI_AOT. They now render in AOT and match the managed CLI output line-for-line. MSBuild version: reference Microsoft.Build so ILC compiles ProjectCollection.DisplayVersion. The path is AOT-clean with no trim/AOT warnings. Workload version and section: gate the eager workload installer (NuGet/MSI) out of WorkloadInfoHelper under #if CLI_AOT and build the installation-record repository directly (mirroring WorkloadInstallDetector), so the installer subsystem is not compiled into AOT. Visual Studio workload detection (COM) is compiled into AOT using the AOT-safe COM interop helpers in Microsoft.DotNet.Cli.Utils. Select the NuGet System.Text.Json deserialization path in the AOT binary via the NuGet.UseSystemTextJsonDeserialization feature switch so the reflection-based Newtonsoft.Json path is trimmed away. Update the AOT --info tests to assert the now-included workload and MSBuild sections.
Contributor
There was a problem hiding this comment.
Pull request overview
Enables the NativeAOT dotnet-aot CLI to emit the full dotnet --info output (matching the managed CLI), including workload version, MSBuild version, and the “.NET workloads installed” section, while keeping installer-heavy workload machinery out of the AOT closure.
Changes:
- Print Workload/MSBuild version lines and the workloads section in the AOT
--infopath. - Refactor workload reporting to be AOT-friendly by constructing the installation-record repository directly under
#if CLI_AOT, and gate installer-only code out. - Update AOT tests to assert the newly included
--infosections (including a non-empty MSBuild version check).
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/dotnet-aot.Tests/AotParserTests.cs | Updates --info tests to expect workload/MSBuild sections and validate MSBuild version is non-empty. |
| test/dotnet-aot.Tests/AotIntegrationTests.cs | Updates integration test expectations for AOT --info output. |
| src/Cli/dotnet/ParserOptionActions.cs | Enables printing workload/MSBuild info + workload listing for --info under CLI_AOT. |
| src/Cli/dotnet/Commands/Workload/WorkloadInfoHelper.cs | Adds AOT-specific, read-only workload reporting construction (no installer) and adjusts interface implementation. |
| src/Cli/dotnet/Commands/Workload/List/VisualStudioWorkloads.cs | Gates installer-dependent VS workload record-writing logic out of AOT builds. |
| src/Cli/dotnet-aot/dotnet-aot.csproj | Forces NuGet to use STJ deserialization via runtime host config to avoid reflection-based JSON in AOT. |
| src/Cli/dotnet-aot/AotSourceFiles.props | Adds Microsoft.Build runtime to the AOT closure and includes workload reporting sources (plus VS workload query on Windows). |
Member
|
Love this! Would love perf and size analyses for this just to checkpoint each enhancement we make to the AOT space. |
baronfel
approved these changes
Jun 30, 2026
Member
Author
|
/aot-size |
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.
Summary
The AOT
dotnetCLI (dotnet-aot) previously omitted the Workload version, MSBuild version, and the.NET workloads installedsection fromdotnet --info(they were gated behind#if !CLI_AOT). This enables all of them so the AOT--infooutput matches the managed CLI line-for-line.Changes
Microsoft.Buildin the AOT closure so ILC compilesProjectCollection.DisplayVersion. This path is AOT-clean (zero trim/AOT warnings).WorkloadInfoHelperunder#if CLI_AOTand build the installation-record repository directly, mirroringWorkloadInstallDetector. The full installer subsystem is therefore not compiled into the AOT binary; only the read-only reporting surface is.ComClassFactory,ComScope,BSTR,HRESULT,CLSID) fromMicrosoft.DotNet.Cli.UtilsviaInternalsVisibleTo. Gated onTARGET_WINDOWS.NuGet.UseSystemTextJsonDeserializationruntime host configuration option (Trim="true") so the reflection-basedNewtonsoft.Jsonbranch is trimmed.--infotests to assert the now-included workload and MSBuild sections (including a non-empty value check on the MSBuild version line).The shared files (
ParserOptionActions.cs,WorkloadInfoHelper.cs,VisualStudioWorkloads.cs) use#if CLI_AOTso the managed CLI behavior is unchanged.Validation
dotnet-aotNativeAOT publish (win-x64): 0 trim/AOT warnings.--infooutput verified identical line-for-line (Compare-Object).--infotests pass in-process and as a native AOT binary; fullAotParserTests(42) pass; the manageddotnet.csprojbuilds clean.Sample output (identical for AOT and managed):
AOT size & startup impact
Measured with the
aot-impact-analysisskill (win-x64). Size is isolated to this PR: PR side is the merged squash commit3279708b, baseline is its parent110f3d0c.Size — native
dotnet-aot.dll110f3d0c)3279708b)Top real contributors all map to features this PR enables — nothing large maps to "nothing", so no sign of an unintended dependency in the AOT graph:
System.Private.CoreLibSystem.LinqWorkloadInfoHelper/ workload set reportingMicrosoft.NET.Sdk.WorkloadManifestReader.NET workloads installedsectionSystem.Text.JsonMicrosoft.Build.FrameworkMicrosoft.DotNet.Cli.UtilsStartup — managed vs AOT (same SDK build)
DOTNET_CLI_ENABLEAOToff = manageddotnet.dll(bridged in-process), on = nativeNativeEntryPoint. 15 iterations / 3 warmup, median wall-clock:dotnet --versiondotnet --infoThe expanded
--infofrom this PR is compiled natively into the AOT binary and still comes in ~5x faster than the managed equivalent.cli.runtime=aot+telemetry-setup/parse/invocationspans confirmed the AOT path was actually exercised (the info-gathering this PR added lives in theinvocationspan).win-x64 only; osx-arm64 (also in CI) not measured here.