Eliminate Native AOT warnings from MSBuild-backed CLI commands
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 1.3k
- PR merge metrics
- PR metrics pending
Description
### Describe the bug
Enabling the MSBuild-backed command handlers in the Native AOT `dotnet` CLI currently produces trim/AOT diagnostics from the command layer's transitive dependency closure. The infrastructure-only layer publishes with zero detailed diagnostics; the warnings appear only once resolver activation and project-backed commands are enabled in #55497.
With `TrimmerSingleWarn=false`, the current warning set is 5 IL2026 diagnostics and 13 IL3050 diagnostics. The concrete origins are Newtonsoft.Json LINQ-to-JSON dynamic/public API paths and runtime `System.Linq.Expressions` / `Microsoft.CSharp` dynamic-binder paths.
### Steps to reproduce
1. Check out the command-enablement branch from #55497 after its infrastructure dependency from #55441.
2. Publish `src/Cli/dotnet-aot/dotnet-aot.csproj` for Native AOT with `TrimmerSingleWarn=false`.
3. Inspect the emitted IL2026 and IL3050 diagnostics.
### Expected behavior
The MSBuild-backed Native AOT command layer publishes without first-party or dependency trim/AOT diagnostics, and the temporary IL2104/IL3053 `WarningsNotAsErrors` policy can be removed.
### Actual behavior
The detailed publish reports 18 diagnostics (5 IL2026 and 13 IL3050). #55497 must temporarily keep IL2104 and IL3053 as non-errors so its Native AOT publish can complete while the dependency closure is migrated or annotated.
### Is this a regression?
No. This warning closure becomes reachable when #55497 enables the MSBuild-backed commands in the Native AOT CLI.
### Are there any workarounds?
Keep only the IL2104 and IL3053 aggregate diagnostics in `WarningsNotAsErrors` in the command-enablement layer. Do not apply that policy to the infrastructure-only #55441 layer, which publishes with zero detailed warnings.
### dotnet --info output
N/A
### IDE version
N/A
### Other details
Track the exact detailed warnings with `TrimmerSingleWarn=false`; do not infer reachability merely because an assembly is referenced. The NuGet packages.lock.json read-path migration materially reduces the Newtonsoft closure, but remaining writer/public API metadata and dynamic-binder roots still need separate attribution before removing the temporary policy.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.