-
Notifications
You must be signed in to change notification settings - Fork 5.4k
crossgen2 crashes with CommandLineException when --strip-debug-info is passed via ExtraArgs on Apple mobile #126510
Description
Description
crossgen2 crashes with an unhandled System.CommandLine.CommandLineException when --strip-debug-info is passed on Apple mobile platforms (iOS, MacCatalyst). The System.CommandLine parser treats the next argument (--instruction-set:apple-m1) as a file path value for --strip-debug-info, then fails in AppendExpandedPaths trying to glob-expand it.
Exception
Microsoft.NET.CrossGen.targets(501,5): error :
Unhandled exception. System.CommandLine.CommandLineException: No files matching --strip-debug-info --instruction-set:apple-m1
at System.CommandLine.Helpers.AppendExpandedPaths(Dictionary`2, String, Boolean)
at System.CommandLine.Helpers.BuildPathDictionary(IReadOnlyList`1, Boolean)
at System.CommandLine.Argument`1.<>c__DisplayClass8_0.<set_CustomParser>b__0(ArgumentResult, Object&)
at System.CommandLine.Parsing.ArgumentResult.ValidateAndConvert(Boolean)
at System.CommandLine.Parsing.CommandResult.ValidateAndAddDefaultResults(Boolean)
at System.CommandLine.Parsing.ParseOperation.ValidateAndAddDefaultResults()
at System.CommandLine.Parsing.ParseOperation.Parse()
at System.CommandLine.Parsing.CommandLineParser.Parse(Command, IReadOnlyList`1, String, ParserConfiguration)
at ILCompiler.Program.Main(String[] args)
Root Cause
dotnet/runtime#124604 added --strip-debug-info and --strip-inlining-info as boolean flags to crossgen2. dotnet/sdk#53514 passes these via PublishReadyToRunCrossgen2ExtraArgs in Microsoft.NET.CrossGen.targets for Apple mobile RIDs.
The issue appears to be that --strip-debug-info is not correctly declared as a zero-arity (boolean) option in crossgen2's System.CommandLine configuration. The parser consumes the next positional argument (--instruction-set:apple-m1) as its value and attempts to resolve it as a file path.
Reproduction
- SDK:
11.0.100-preview.3.26202.110(first build containing sdk#53514) - Target:
net11.0-maccatalystornet11.0-ioswith CoreCLR (PublishReadyToRun=true) - Platform: Apple ARM64
Previous SDK builds (26171.106 and earlier) do not have this issue as they predate sdk#53514.
Affected CI Builds
- dotnet/maui PR Compiler optimizing needed variable away #34799: Build #1365537 —
maui-pr-devicetests, "Build Device Tests (CoreCLR)" step - Only affects CoreCLR builds on Apple mobile RIDs; Mono builds are unaffected
Related PRs
- [clr-ios] Add options to strip inlining and debug info in Crossgen2 on Apple mobile #124604 — Added
--strip-debug-infoand--strip-inlining-infoto crossgen2 - Add --strip-inlining-info and --strip-debug-info crossgen2 args for Apple mobile RIDs sdk#53514 — SDK targets to pass these args for Apple mobile RIDs
/cc @kotlarmilos
Metadata
Metadata
Assignees
Labels
Type
Projects
Status