Skip to content

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

Open
rolfbjarne wants to merge 4 commits into
mainfrom
dev/rolf/trimmable-registrar-no-param-names
Open

[dotnet-linker] Don't emit parameter names for generated proxy methods.#26363
rolfbjarne wants to merge 4 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
Comment thread tools/dotnet-linker/Steps/ManagedRegistrarStep.cs
@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

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: 553ab80e7dd11527c3e9c3453d7463c9b10e0301 [PR build]

@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

🔥 [CI Build #51389b6] Test results 🔥

Test results

❌ Tests failed on VSTS: test results

1 tests crashed, 45 tests failed, 153 tests passed.

Failures

❌ dotnettests tests (iOS)

1 tests failed, 0 tests passed.

Failed tests

  • DotNet tests: Failed (Execution failed with exit code 1)
    • Xamarin.Tests.AppIconTest.AlternateAppIcon_Failure(iOS,"ios-arm6...: Failure when comparing error messages:
      Unexpected error message #0:
      Expected: Can't find the AlternateAppIcon 'InexistentAppI...
    • Xamarin.Tests.AppIconTest.AlternateAppIcon(iOS,"ios-arm64"): 'dotnet build' failed with exit code 1
      Full command: /Users/cloudtest/vss/_work/1/s/macios/builds/downloads/dotnet-sdk-10.0.400-...
    • Xamarin.Tests.AppIconTest.AlternateAppIcons(iOS,"ios-arm64"): 'dotnet build' failed with exit code 1
      Full command: /Users/cloudtest/vss/_work/1/s/macios/builds/downloads/dotnet-sdk-10.0.400-...
    • ... and 62 more

Html Report (VSDrops) Download

❌ dotnettests tests (MacCatalyst)

1 tests failed, 0 tests passed.

Failed tests

  • DotNet tests: Failed (Execution failed with exit code 1)
    • Xamarin.Tests.AppSizeTest.NativeAOT_TrimmableStatic(MacCatalyst,...: App size changed significantly (-33,056 bytes (-32.3 KB = -0.0 MB) different > tolerance of +-10,240 bytes (10.0 KB = 0.0 MB)). ...

Html Report (VSDrops) Download

❌ dotnettests tests (macOS)

1 tests failed, 0 tests passed.

Failed tests

  • DotNet tests: Failed (Execution failed with exit code 1)
    • Xamarin.Tests.AppSizeTest.CoreCLR_Interpreter_TrimmableStatic(Ma...: App size changed significantly (-700,289 bytes (-683.9 KB = -0.7 MB) different > tolerance of +-10,240 bytes (10.0 KB = 0.0 MB))...
    • Xamarin.Tests.AppSizeTest.CoreCLR_Interpreter(MacOSX,"osx-arm64;...: App size changed significantly (-441,233 bytes (-430.9 KB = -0.4 MB) different > tolerance of +-10,240 bytes (10.0 KB = 0.0 MB))...
    • Xamarin.Tests.AppSizeTest.NativeAOT_TrimmableStatic(MacOSX,"osx-...: App size changed significantly (-65,815 bytes (-64.3 KB = -0.1 MB) different > tolerance of +-10,240 bytes (10.0 KB = 0.0 MB)). ...
    • ... and 1 more

Html Report (VSDrops) Download

❌ dotnettests tests (tvOS)

1 tests failed, 0 tests passed.

Failed tests

  • DotNet tests: Failed (Execution failed with exit code 1)
    • Xamarin.Tests.AppIconTest.AlternateAppIcon_Failure(TVOS,"tvos-ar...: Failure when comparing error messages:
      Unexpected error message #0:
      Expected: Can't find the AlternateAppIcon 'InexistentAppI...
    • Xamarin.Tests.AppIconTest.AlternateAppIcon(TVOS,"tvos-arm64"): 'dotnet build' failed with exit code 1
      Full command: /Users/cloudtest/vss/_work/1/s/macios/builds/downloads/dotnet-sdk-10.0.400-...
    • Xamarin.Tests.AppIconTest.AlternateAppIcons(TVOS,"tvos-arm64"): 'dotnet build' failed with exit code 1
      Full command: /Users/cloudtest/vss/_work/1/s/macios/builds/downloads/dotnet-sdk-10.0.400-...
    • ... and 31 more

Html Report (VSDrops) Download

❌ monotouch tests (iOS)

19 tests failed, 0 tests passed.

Failed tests

  • monotouch-test/iOS - simulator/Debug: BuildFailure
  • monotouch-test/iOS - simulator/Release (link sdk): BuildFailure
  • monotouch-test/iOS - simulator/Release (link all): BuildFailure
  • monotouch-test/iOS - simulator/Debug (PrepareAssemblies): BuildFailure
  • monotouch-test/iOS - simulator/Debug (PrepareAssemblies, inline dlfcn, dont link): BuildFailure
  • monotouch-test/iOS - simulator/Debug (LinkSdk): BuildFailure
  • monotouch-test/iOS - simulator/Debug (static registrar): BuildFailure
  • monotouch-test/iOS - simulator/Release (all optimizations): BuildFailure
  • monotouch-test/iOS - simulator/Release (NativeAOT): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
  • monotouch-test/iOS - simulator/Release (trimmable static registrar, NativeAOT): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
  • monotouch-test/iOS - simulator/Debug (managed static registrar): BuildFailure
  • monotouch-test/iOS - simulator/Release (managed static registrar, all optimizations): BuildFailure
  • monotouch-test/iOS - simulator/Debug (interpreter): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
  • monotouch-test/iOS - simulator/Release (interpreter): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
  • monotouch-test/iOS - simulator/Release (compat inline Class.GetHandle): BuildFailure
  • monotouch-test/iOS - simulator/Release (strict inline Class.GetHandle): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
  • monotouch-test/iOS - simulator/Release (compat inline dlfcn): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
  • monotouch-test/iOS - simulator/Release (strict inline dlfcn, link sdk): BuildFailure
  • monotouch-test/iOS - simulator/Release (NativeAOT, .NET 11 defaults): BuildFailure

Html Report (VSDrops) Download

❌ monotouch tests (tvOS)

19 tests failed, 0 tests passed.

Failed tests

  • monotouch-test/tvOS - simulator/Debug: BuildFailure
  • monotouch-test/tvOS - simulator/Release (link sdk): BuildFailure
  • monotouch-test/tvOS - simulator/Release (link all): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
  • monotouch-test/tvOS - simulator/Debug (PrepareAssemblies): BuildFailure
  • monotouch-test/tvOS - simulator/Debug (PrepareAssemblies, inline dlfcn, dont link): BuildFailure
  • monotouch-test/tvOS - simulator/Debug (LinkSdk): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
  • monotouch-test/tvOS - simulator/Debug (static registrar): BuildFailure
  • monotouch-test/tvOS - simulator/Release (all optimizations): BuildFailure
  • monotouch-test/tvOS - simulator/Release (NativeAOT): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
  • monotouch-test/tvOS - simulator/Release (trimmable static registrar, NativeAOT): BuildFailure
  • monotouch-test/tvOS - simulator/Debug (managed static registrar): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
  • monotouch-test/tvOS - simulator/Release (managed static registrar, all optimizations): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
  • monotouch-test/tvOS - simulator/Debug (interpreter): BuildFailure
  • monotouch-test/tvOS - simulator/Release (interpreter): BuildFailure
  • monotouch-test/tvOS - simulator/Release (compat inline Class.GetHandle): BuildFailure
  • monotouch-test/tvOS - simulator/Release (strict inline Class.GetHandle): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
  • monotouch-test/tvOS - simulator/Release (compat inline dlfcn): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
  • monotouch-test/tvOS - simulator/Release (strict inline dlfcn, link sdk): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
  • monotouch-test/tvOS - simulator/Release (NativeAOT, .NET 11 defaults): BuildFailure

Html Report (VSDrops) Download

❌ msbuild tests

1 tests failed, 1 tests passed.

Failed tests

  • MSBuild tasks tests: Failed (Execution failed with exit code 1)
    • Xamarin.MacDev.Tasks.DetectSigningIdentityTaskTests.CustomEntitl...: #RunTask-ErrorCount
      : error: No valid iOS code signing keys found in keychain. You need to request a codesigning certificate ...
    • Xamarin.MacDev.Tasks.DetectSigningIdentityTaskTests.EmptyEntitle...: #RunTask-ErrorCount
      : error: No valid iOS code signing keys found in keychain. You need to request a codesigning certificate ...
    • Xamarin.MacDev.Tasks.DetectSigningIdentityTaskTests.EmptyEntitle...: #RunTask-ErrorCount
      : error: No valid iOS code signing keys found in keychain. You need to request a codesigning certificate ...
    • ... and 7 more

Html Report (VSDrops) Download

❌ windows tests

1 tests failed, 2 tests passed.

Failed tests

  • Remote .NET tests/Xamarin.Tests.DotNetProjectTest.BuildProjectsWithExtensionsOnRemoteWindows(iOS,"ios-arm64",False): Failed: 'dotnet build' failed with exit code 1

  • Remote .NET tests/Xamarin.Tests.DotNetProjectTest.AppWithLibraryWithResourcesReferenceOnRemoteWindows(iOS,"ios-arm64",True): Failed: 'dotnet build' failed with exit code 1

  • Remote .NET tests/Xamarin.Tests.WindowsTest.StripTest(iOS,"ios-arm64","Release"): Failed: 'dotnet build' failed with exit code 1

  • Remote .NET tests/Xamarin.Tests.PostBuildTest.BuildIpaAndArchiveOnRemoteWindowsTest(iOS,"ios-arm64"): Failed: 'dotnet build' failed with exit code 1

  • Remote .NET tests/Xamarin.Tests.WindowsTest.PluralRuntimeIdentifiersWithRemoteMac(iOS,"ios-arm64","Debug"): Failed: 'dotnet build' failed with exit code 1

  • Remote .NET tests/Xamarin.Tests.WindowsTest.PluralRuntimeIdentifiersWithRemoteMac(iOS,"ios-arm64","Release"): Failed: 'dotnet build' failed with exit code 1

  • Remote .NET tests/Xamarin.Tests.WindowsTest.RemoteTest(iOS,"ios-arm64"): Failed: 'dotnet build' failed with exit code 1

  • Remote .NET tests/Xamarin.Tests.WindowsTest.BundleStructureWithRemoteMac(iOS,"ios-arm64",All,"Debug"): Failed: 'dotnet build' failed with exit code 1

  • Remote .NET tests/Xamarin.Tests.WindowsTest.AssemblyPreparerRemoteTest(iOS,"ios-arm64"): Failed: 'dotnet build' failed with exit code 1

  • Remote .NET tests/Xamarin.Tests.DotNetProjectTest.AppWithLibraryWithResourcesReferenceOnRemoteWindows(iOS,"ios-arm64",False): Failed: 'dotnet build' failed with exit code 1

Html Report (VSDrops) Download

❌ Tests on macOS Ventura (13) tests

1 tests failed, 4 tests passed.

Failed tests

  • macOS/osx-arm64 monotouch-test: Failed (exit code 137)
    • No test failure details available. Output tail:
      • [PASS] TestNSUrlSessionDefaultDisableCookiesWithManagedContainer
      • [PASS] TestNSUrlSessionDefaultDisabledCookies
      • [PASS] TestNSUrlSessionEphemeralDisabledCookies
      • [PASS] TestNSUrlSessionEphemeralHandlerCookieContainer
      • [PASS] TestNSUrlSessionEphemeralHandlerCookies
      • [PASS] TestNSUrlSessionHandlerCookieContainer
      • [PASS] TestNSurlSessionHandlerCookieContainerSetCookie
      • [PASS] TestNSUrlSessionHandlerCookies
      • Execution timed out after 600 seconds.
      • Execution completed with exit code 137

Html Report (VSDrops) Download

❌ Tests on macOS Sonoma (14) tests

🔥 Failed catastrophically on VSTS: test results - mac_sonoma (no summary found).

Html Report (VSDrops) Download

Successes

✅ assembly-processing: All 1 tests passed. Html Report (VSDrops) Download
✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): 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 (MacCatalyst): All 18 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 19 tests passed. Html Report (VSDrops) Download
✅ sharpie: All 1 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 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: 51389b60681cd8f2623ba12b76c464eaf995aacb [PR build]

@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]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants