Skip to content

[tests] Improve trimmer warning diagnostics#11981

Open
simonrozsival wants to merge 1 commit into
mainfrom
dev/simonrozsival/buildtest2-trimmer-warning-diagnostics
Open

[tests] Improve trimmer warning diagnostics#11981
simonrozsival wants to merge 1 commit into
mainfrom
dev/simonrozsival/buildtest2-trimmer-warning-diagnostics

Conversation

@simonrozsival

@simonrozsival simonrozsival commented Jul 4, 2026

Copy link
Copy Markdown
Member

Improve the failure message in BuildHasTrimmerWarnings by parsing the warning summary and printing the warning lines found when the expected count does not match.

Split out from #11669 so the RuntimeFeature PR stays focused.

Report the parsed warning summary and the warning lines found when BuildHasTrimmerWarnings gets an unexpected warning count.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 4, 2026 19:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves diagnostics in the BuildHasTrimmerWarnings test to make trimmer-warning failures easier to understand by extracting the warning summary count and printing the warning lines found when expectations don’t match.

Changes:

  • Parse the MSBuild warning summary line (N Warning(s)) and compare the parsed count to the expected total.
  • Collect and print up to 25 warning lines (: warning ) in assertion failures to aid debugging.
  • Add a local helper (GetWarningCount) to parse the summary line.
Show a summary per file
File Description
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest2.cs Enhances BuildHasTrimmerWarnings failure output by parsing the warning summary and printing captured warning lines.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 1

Comment on lines +607 to +611
string warningSummaryLine = b.LastBuildOutput.LastOrDefault (line => line.Contains ("Warning(s)", StringComparison.Ordinal)) ?? "";
var actualWarnings = GetWarningCount (warningSummaryLine);

var allWarningLines = b.LastBuildOutput
.Where (line => line.Contains (": warning ", StringComparison.OrdinalIgnoreCase))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants