Skip to content

[release/11.0.1xx] [registrar] Cache registrar callback and protocol method lookups - #26826

Merged
dalexsoto merged 2 commits into
release/11.0.1xxfrom
dev/rolf/backport-pr-26733-release/11.0.1xx-2026-10-02
Oct 5, 2026
Merged

dalexsoto merged 2 commits into
release/11.0.1xxfrom
dev/rolf/backport-pr-26733-release/11.0.1xx-2026-10-02

Conversation

@rolfbjarne

Copy link
Copy Markdown
Member

Postprocessing previously searched all loaded assemblies for each relocated callback, rescanned each callback type's methods, and compared every pre-trim protocol method against an ever-growing list. Cache companion assembly and callback-name lookups, and use a set of protocol method names while preserving the original order and duplicate handling. Cover multiple relocated callbacks with a focused preparation/postprocessing regression test.

The regression test also simulates trimming a protocol method after preparation, verifying that surviving and pre-trim-only protocol methods each produce exactly one callback.

In a direct replay of captured MAUI HelloWorld inputs with both registrar fixes applied, post-ILLink ManagedRegistrarStep took 0.65-0.66 s on two runs versus 3.3-3.6 s in baseline logs. This is a step-only observation, not an end-to-end build-time measurement or an isolated A/B for this PR.

🤖 Pull request created by Copilot

Backport of #26733.

Postprocessing previously searched all loaded assemblies for each relocated callback, rescanned each callback type's methods, and compared every pre-trim protocol method against an ever-growing list. Cache companion assembly and callback-name lookups, and use a set of protocol method names while preserving the original order and duplicate handling. Cover multiple relocated callbacks with a focused preparation/postprocessing regression test.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: f3637ab8-80a2-44df-9ecc-97ddf253d54d
Copilot AI balanced review requested due to automatic review settings October 2, 2026 16:49
@rolfbjarne
rolfbjarne requested a review from dalexsoto as a code owner October 2, 2026 16:49
@rolfbjarne rolfbjarne added backported ready-to-review This PR is ready to review/merge. labels Oct 2, 2026
dalexsoto
dalexsoto previously approved these changes Oct 2, 2026

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.

Copilot review overview

🔵 Needs a closer look

The backport matches the merged source PR, but required CI checks are still queued or running.

Review effort: Balanced
Findings: None

What changed in this PR

Backports registrar postprocessing performance improvements from #26733 to release/11.0.1xx.

Changes:

  • Caches companion assemblies and callback-method lookups.
  • Uses a hash set to deduplicate protocol methods efficiently.
  • Adds regression coverage for relocated and trimmed protocol callbacks.
File Description
tools/​dotnet-linker/​Steps/​ManagedRegistrarStep.cs Adds registrar lookup caches.
tools/​common/​StaticRegistrar.cs Optimizes protocol-method deduplication.
tests/​assembly-preparer/​ManagedRegistrarStepTests.cs Tests preparation and postprocessing behavior.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@rolfbjarne
rolfbjarne enabled auto-merge (squash) October 2, 2026 17:46
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@dalexsoto

Copy link
Copy Markdown
Member

Merge blocker: conflicts with release/11.0.1xx

At head 5e4580e0b1c2e421e9cdaf65eba27ae72b7c0477, GitHub reports this PR as mergeable: false / mergeable_state: dirty. The existing simulator build 15551478 is already running its third iOS attempt, but passing CI alone will not resolve this merge blocker.

Required fix: update the PR branch against the current release/11.0.1xx base and resolve its conflicts while preserving the registrar callback/protocol lookup changes, then validate the updated head. This is a branch/source reconciliation requirement, not a failure that CI retries can fix.

I have not modified this PR's branch or started a duplicate retry.

Note

This CI analysis was generated by GitHub Copilot.

@dalexsoto

Copy link
Copy Markdown
Member

@copilot resolve the merge conflicts in this pull request

@dalexsoto

Copy link
Copy Markdown
Member

@copilot resolve the merge conflicts in this pull request

…backport-pr-26733-release/11.0.1xx-2026-10-02

# Conflicts:
#	tests/assembly-preparer/ManagedRegistrarStepTests.cs

Co-authored-by: dalexsoto <204671+dalexsoto@users.noreply.github.com>
auto-merge was automatically disabled October 3, 2026 18:46

Head branch was pushed to by a user without write access

Copilot AI balanced review requested due to automatic review settings October 3, 2026 18:46
@vs-mobiletools-engineering-service2

This comment has been minimized.

Copilot AI commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Resolved the conflict with release/11.0.1xx in merge commit a0ca9fa8b9, preserving both registrar tests and the original three-file PR diff. GitHub no longer reports the PR as dirty. The focused test could not run locally because the pinned .NET 11 RC SDK is unavailable; git diff --check and a targeted review passed. CodeQL skipped the oversized C# database.

Note

This response was generated by GitHub Copilot.

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.

Copilot review overview

🟢 Approval recommended

The backport preserves upstream behavior and includes focused regression coverage; the remaining allocation feedback is non-blocking.

Review effort: Balanced
Findings: 1 Low severity

Open (1)

callbackMethods = callbackType.Methods.ToLookup (v => v.Name);
callbackMethodsByName.Add (callbackType, callbackMethods);
}
var candidates = callbackMethods [ucoName].ToArray ();
@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: a0ca9fa8b914d91895db2d24bf54331d1e655946 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@dalexsoto

Copy link
Copy Markdown
Member

Distinct iOS stress-test hang needs investigation; this is not the known redirect-stall signature

At head a0ca9fa8b914d91895db2d24bf54331d1e655946, simulator build 15561324 times out in both Debug (static registrar) and Debug (trimmable static registrar, all optimizations).

In both configurations, the stderr log shows the entire MessageHandlerTest fixture completing successfully, followed by NSUrlSessionHandlerTest. AlreadyCanceledRequestCompletesAsCanceled and BasicAuthWorksWhenBearerIsAdvertisedFirst pass, then the /race traffic used by ConcurrentResponseDisposeAndCancellationDoesNotCrash continues with connection-reset messages and no subsequent test result before xharness kills the run at 900 seconds.

The stress test is configured for 15 seconds in CI and wraps its work in TestRuntime.TryRunAsync with a 45-second limit. The process instead reaches the 15-minute harness timeout. This is a different hang from #26221: these two configurations get past the credential/cross-origin redirect tests.

Required investigation: determine where the stress workers, cancellation/disposal paths, or teardown stop completing, and ensure the test's timeout/cleanup can terminate and report a useful failure. Inspect the captured run/thread diagnostics before deciding whether the underlying problem is in the handler, test/harness, or simulator. I have not established that this PR's registrar changes caused it, or that these two stress hangs are merely retryable infrastructure failures.

The same build also has a separate Release (interpreter) launch timeout with the known SpringBoard RBSAssertion/snapshot crash (#26227). Build 15561323's single monotouch failure is the known credential-redirect stall (#26221). Those signatures should not be conflated with this stress-test hang.

Detailed evidence is in HtmlReport-simulator_testsmonotouch_ios-1, configurations monotouch-test/122 and monotouch-test/138, including their stderr logs and timeout reports. No source files have been changed by this monitor.

Note

This CI analysis was generated by GitHub Copilot.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🚀 [CI Build #a0ca9fa] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 269 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 7 tests passed. Html Report (VSDrops) Download
✅ linker (iOS): All 31 tests passed. [attempt 3] Html Report (VSDrops) Download
✅ linker (MacCatalyst): All 31 tests passed. Html Report (VSDrops) Download
✅ linker (macOS): All 21 tests passed. Html Report (VSDrops) Download
✅ linker (tvOS): All 31 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 25 tests passed. [attempt 3] Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 25 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 20 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 25 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 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
✅ Tests on macOS Golden Gate (27): All 5 tests passed. Html Report (VSDrops) Download

Linux Build Verification

✅ Linux build succeeded

Pipeline on Agent
Hash: a0ca9fa8b914d91895db2d24bf54331d1e655946 [PR build]

@dalexsoto
dalexsoto merged commit 1cf2ab2 into release/11.0.1xx Oct 5, 2026
62 checks passed
@dalexsoto
dalexsoto deleted the dev/rolf/backport-pr-26733-release/11.0.1xx-2026-10-02 branch October 5, 2026 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants