Skip to content

Fix nullable Func delegate, whitespace, and csproj comment in PostTrimmingPipeline#10981

Merged
sbomer merged 3 commits intodev/sbomer/addkeepalives-innerfrom
copilot/sub-pr-10952
Mar 20, 2026
Merged

Fix nullable Func delegate, whitespace, and csproj comment in PostTrimmingPipeline#10981
sbomer merged 3 commits intodev/sbomer/addkeepalives-innerfrom
copilot/sub-pr-10952

Conversation

Copy link
Contributor

Copilot AI commented Mar 20, 2026

  • Review copilot reviewer comment about repeated resolution attempts
  • Memoize corlib assembly resolution in PostTrimmingPipeline.cs using a corlibResolutionAttempted flag and corlibAssembly local so resolution and error logging happen at most once per task execution

📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

…ated csproj comment

Co-authored-by: sbomer <787361+sbomer@users.noreply.github.com>
Copilot AI changed the title [WIP] Move AddKeepAlives trimmer step to standalone MSBuild task Fix nullable Func delegate, whitespace, and csproj comment in PostTrimmingPipeline Mar 20, 2026
Copilot AI requested a review from sbomer March 20, 2026 17:07
@sbomer sbomer marked this pull request as ready for review March 20, 2026 17:08
Copilot AI review requested due to automatic review settings March 20, 2026 17:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the post-trimming pipeline implementation in Xamarin.Android.Build.Tasks to align nullable delegate signatures, improve robustness when resolving System.Private.CoreLib, and keep the project file’s linker-source documentation accurate.

Changes:

  • Add AssemblyResolutionException handling around resolver.Resolve("System.Private.CoreLib") in PostTrimmingPipeline.
  • Update corlib factory delegate types from Func<AssemblyDefinition> to Func<AssemblyDefinition?> in the post-trimming keep-alives path, plus minor whitespace cleanup.
  • Refresh the .csproj comment describing which linker sources are included.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/Xamarin.Android.Build.Tasks/Tasks/PostTrimmingPipeline.cs Adds try/catch + error logging for corlib resolution used by post-trimming keep-alives.
src/Xamarin.Android.Build.Tasks/Linker/MonoDroid.Tuner/PostTrimmingAddKeepAlivesStep.cs Updates the corlib factory delegate type to nullable to match new behavior.
src/Xamarin.Android.Build.Tasks/Linker/MonoDroid.Tuner/AddKeepAlivesHelper.cs Propagates nullable delegate return type through helper methods and fixes indentation.
src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.csproj Updates comment documenting linker source inclusions for build tasks.

@sbomer
Copy link
Member

sbomer commented Mar 20, 2026

@copilot apply changes based on the comments in this thread

…esolution attempts

Co-authored-by: sbomer <787361+sbomer@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/android/sessions/399b2f01-0576-42f4-a1d4-d0f0d31f5eb7
Copy link
Contributor Author

Copilot AI commented Mar 20, 2026

@copilot apply changes based on the comments in this thread

Applied in commit e6b2e5b. The corlib resolution is now memoized using a corlibResolutionAttempted flag and a corlibAssembly local captured in the lambda closure — resolution and error logging happen at most once per task execution regardless of how many assemblies/methods need KeepAlive injection.

@sbomer sbomer merged commit cfc21e1 into dev/sbomer/addkeepalives-inner Mar 20, 2026
2 checks passed
@sbomer sbomer deleted the copilot/sub-pr-10952 branch March 20, 2026 17:51
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.

3 participants