Skip to content

[dotnet-linker] Don't emit parameter names for generated proxy methods. - #26363

Merged
rolfbjarne merged 11 commits into
mainfrom
dev/rolf/trimmable-registrar-no-param-names
Aug 5, 2026
Merged

rolfbjarne merged 11 commits into
mainfrom
dev/rolf/trimmable-registrar-no-param-names

Conversation

@rolfbjarne

Copy link
Copy Markdown
Member

Don't emit parameter names in the generated registrar code. Cecil only emits a Param row for parameters that have a name (or attributes, marshalling info or a default value), and the parameter names of these generated methods have no value to anyone.

Copilot-Session: 6aeeddfd-3bd8-4129-ad90-7292860c4b66

Don't emit parameter names in the generated registrar code. Cecil only emits a Param row for parameters that have a name (or attributes, marshalling info or a default value), and the parameter names of these generated methods have no value to anyone.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 6aeeddfd-3bd8-4129-ad90-7292860c4b66
Copilot AI review requested due to automatic review settings July 30, 2026 10:17

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

This PR aims to reduce metadata size in linker-generated registrar/proxy code by avoiding emitting parameter names for generated methods, since Mono.Cecil can omit Param table rows when parameters are unnamed.

Changes:

  • Added a MethodDefinition.AddParameter (TypeReference) helper intended to create unnamed parameters for generated methods.
  • Updated multiple linker steps (registrar generation and lookup table generation) to use unnamed parameters, keeping intent via inline comments.
  • Updated AppBundleRewriter factory-method emission to omit parameter names for generated _Xamarin_Construct* methods.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tools/dotnet-linker/Steps/TrimmableRegistrarStep.cs Uses unnamed parameters for generated proxy methods in trimmable registrar generation.
tools/dotnet-linker/Steps/ManagedRegistrarStep.cs Uses unnamed parameters for generated unmanaged-callback signatures and cloned ctor signatures.
tools/dotnet-linker/Steps/ManagedRegistrarLookupTablesStep.cs Uses unnamed parameters in generated registrar lookup/construct methods.
tools/dotnet-linker/CecilExtensions.cs Introduces the new unnamed-parameter helper overload.
tools/dotnet-linker/AppBundleRewriter.cs Uses unnamed parameters for generated _Xamarin_ConstructNSObject/_Xamarin_ConstructINativeObject methods.

Comment thread tools/dotnet-linker/CecilExtensions.cs Resolved
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@rolfbjarne
rolfbjarne requested a review from dalexsoto as a code owner July 31, 2026 14:07
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

⚠️ AppSizeTest expected files changed ⚠️

The AppSizeTest detected changes in the expected app size files.

To update the expected files, add a comment with the following command:

/apply-gist https://gist.github.com/vs-mobiletools-engineering-service2/e662e57b468ab5ed9c9af688537a2464
Updated files
  • iOS-NativeAOT-TrimmableStatic-size.txt
  • MacCatalyst-NativeAOT-TrimmableStatic-size.txt
  • MacOSX-CoreCLR-Interpreter-size.txt
  • MacOSX-CoreCLR-Interpreter-TrimmableStatic-size.txt
  • MacOSX-NativeAOT-TrimmableStatic-size.txt
  • TVOS-NativeAOT-size.txt
  • TVOS-NativeAOT-TrimmableStatic-size.txt

Pipeline on Agent
Hash: 51389b60681cd8f2623ba12b76c464eaf995aacb [PR build]

@rolfbjarne
rolfbjarne enabled auto-merge (squash) August 3, 2026 20:29
@rolfbjarne rolfbjarne added the ready-to-review This PR is ready to review/merge. label Aug 3, 2026
@vs-mobiletools-engineering-service2

This comment has been minimized.

dalexsoto
dalexsoto previously approved these changes Aug 3, 2026
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@rolfbjarne
rolfbjarne requested a review from dalexsoto August 4, 2026 15:43
dalexsoto
dalexsoto previously approved these changes Aug 4, 2026
@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

βœ… API diff for current PR / commit

NET (empty diffs)

βœ… API diff vs stable

NET (empty diffs)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: 159481100fc85b906f2c305d022a0dc869ac003e [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

πŸš€ [CI Build #1594811] Test results πŸš€

Test results

βœ… All tests passed on VSTS: test results.

πŸŽ‰ All 203 tests passed πŸŽ‰

Tests counts

βœ… assembly-processing: All 1 tests passed. Html Report (VSDrops) Download
βœ… cecil: All 1 tests passed. Html Report (VSDrops) Download
βœ… dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
βœ… dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
βœ… dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
βœ… dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
βœ… dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
βœ… framework: All 2 tests passed. Html Report (VSDrops) Download
βœ… fsharp: All 4 tests passed. Html Report (VSDrops) Download
βœ… generator: All 5 tests passed. Html Report (VSDrops) Download
βœ… interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
βœ… introspection: All 4 tests passed. Html Report (VSDrops) Download
βœ… linker (iOS): All 15 tests passed. Html Report (VSDrops) Download
βœ… linker (MacCatalyst): All 15 tests passed. Html Report (VSDrops) Download
βœ… linker (macOS): All 21 tests passed. Html Report (VSDrops) Download
βœ… linker (tvOS): All 15 tests passed. Html Report (VSDrops) Download
βœ… monotouch (iOS): All 19 tests passed. Html Report (VSDrops) Download
βœ… monotouch (MacCatalyst): All 18 tests passed. Html Report (VSDrops) Download
βœ… monotouch (macOS): All 19 tests passed. [attempt 2] Html Report (VSDrops) Download
βœ… monotouch (tvOS): All 19 tests passed. Html Report (VSDrops) Download
βœ… msbuild: All 2 tests passed. Html Report (VSDrops) Download
βœ… sharpie: All 1 tests passed. Html Report (VSDrops) Download
βœ… windows: All 3 tests passed. Html Report (VSDrops) Download
βœ… xcframework: All 4 tests passed. Html Report (VSDrops) Download
βœ… xtro: All 1 tests passed. Html Report (VSDrops) Download

macOS tests

βœ… Tests on macOS Monterey (12): All 5 tests passed. Html Report (VSDrops) Download
βœ… Tests on macOS Ventura (13): All 5 tests passed. Html Report (VSDrops) Download
βœ… Tests on macOS Sonoma (14): All 5 tests passed. Html Report (VSDrops) Download
βœ… Tests on macOS Sequoia (15): All 5 tests passed. Html Report (VSDrops) Download
βœ… Tests on macOS Tahoe (26): All 5 tests passed. Html Report (VSDrops) Download

Linux Build Verification

βœ… Linux build succeeded

Pipeline on Agent
Hash: 159481100fc85b906f2c305d022a0dc869ac003e [PR build]

@rolfbjarne
rolfbjarne merged commit 93f9d03 into main Aug 5, 2026
56 checks passed
@rolfbjarne
rolfbjarne deleted the dev/rolf/trimmable-registrar-no-param-names branch August 5, 2026 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

copilot ready-to-review This PR is ready to review/merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants