Skip to content

[net11.0][Testing] Preserve grouped CollectionView handler constructors - #39572

Closed
kubaflo wants to merge 1 commit into
net11.0from
kubaflo-net11-collection-fixture-activation
Closed

kubaflo wants to merge 1 commit into
net11.0from
kubaflo-net11-collection-fixture-activation

Conversation

@kubaflo

@kubaflo kubaflo commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Description of Change

Superseded by #39536. This exact test-only fix is now included in the consolidated PR at 63ef2602a7b7350595f10236097056991a55550e, with identical file contents and preserved attribution. This standalone PR is being closed without merging. The per-fix evidence below remains historical evidence for this PR's original head, not new native validation of the combined head; combined-head checks and pending CI are documented in #39536.

Fix the pre-existing grouped CollectionView device-test activation failure on net11.0, independently of the GC fixture changes in #39536. This PR intentionally targets net11.0, based on 7b0ea7800db3f3faccbaecb665d32b7c61eaf932.

VerifyGroupedCollectionViewEmptyViewTracksGroups<THandler> registers its handler through AddHandler<CollectionView, THandler>(), whose handler parameter requires DynamicallyAccessedMembers(PublicConstructors). The test helper did not propagate that contract. The trimmed iOS Mono app retained the legacy Items.CollectionViewHandler type but removed both public constructors, causing ActivatorUtilities to throw CtorNotLocated before the empty/group assertions ran.

This was verified in the actual exact-base device build 1643729 binaries: the pre-link assembly has both constructors, whereas the deployed iOS Mono app has zero. The modern CollectionViewHandler2 retains both. The same legacy activation failures also occur in device build 1644557, with identical exact-base stacks.

Propagate PublicConstructors on the helper's generic parameter. One test file, two insertions and one deletion. Keep both legacy/modern facts, their inherited navigation-handler fixture executions, normal DI activation, and every original native empty-view/group assertion. No product, dependency, pipeline, GC, navigation, skip, retry, delay, or tolerance changes.

Native causal validation -- LIMITED local evidence, not supported-Xcode hosted certification

The complete repository Controls.DeviceTests iOS Mono application was rebuilt separately for every arm using the pinned SDK 11.0.100-rtm.26514.118 (product 11.0.100), iOS workload 27.0.12230, and Mono 11.0.0. Runs used a task-owned headless iPhone 11 Pro / iOS 18.5 simulator and XHarness xUnit, with an explicit mlaunch --quiet-simulator wrapper.

The local machine has Xcode 26.6, not the workload's required Xcode 27. The build used only the repository-documented /p:ValidateXcodeVersion=false compatibility override and the device runner's standard /p:TreatWarningsAsErrors=false; the existing MAUI1001 and legacy-handler CS0618 warnings remained visible. No header/linker/runtime errors, code-signing checks, or OS warnings were bypassed. The actual native executable links libmonosgen-2.0.dylib.

Native arm Fresh runs Legacy public constructors Class-pair XML per run
Unchanged net11.0 baseline 3/3 red 0 72 pass / 2 fail / 8 existing skips
Annotation applied 3/3 green 2 74 pass / 0 fail / 8 existing skips
Annotation removed and app rebuilt 3/3 red 0 72 pass / 2 fail / 8 existing skips
Annotation restored and app rebuilt 3/3 green 2 74 pass / 0 fail / 8 existing skips

Every fresh XML contains the same 82 class-pair records, the same eight pre-existing skipped identities, and zero assembly errors. The four target records are GroupedCollectionViewEmptyViewTracksGroups and GroupedCollectionViewEmptyViewTracksGroups2 in both CollectionViewTests and CollectionViewNavigationHandlerTests; none is skipped. Both modern-handler cases pass in every arm. Both legacy cases fail with identical CtorNotLocated messages/stacks in baseline/revert and pass every original assertion in candidate/restore. All 12 XML declarations, 984 test records, 48 target records, constructor metadata, generic annotations, and XML SHA-256 values were independently reconciled.

Commands/results (D is the read-only private copy of the pinned SDK/workloads; E is the preserved session evidence directory):

export DOTNET_ROOT="$D"
export PATH="$D:$PATH"

dotnet build Microsoft.Maui.BuildTasks.slnf -c Release \
  -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false \
  -p:IncludeMacOSTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false \
  -p:IncludeTizenTargetFrameworks=false -p:TreatWarningsAsErrors=false \
  -bl:"$E/local-buildtasks.binlog" --nologo -v:q
# Passed: 0 errors; 3 existing Gradle source/target-8 warnings.

dotnet build src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj \
  -c Release -f net11.0-ios -r iossimulator-arm64 \
  -p:IncludeAndroidTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false \
  -p:IncludeMacOSTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false \
  -p:IncludeTizenTargetFrameworks=false -p:UseMonoRuntime=true \
  -p:_DisableCheckForUnsupportedMonoMobileRuntime=true \
  -p:ValidateXcodeVersion=false -p:CodesignRequireProvisioningProfile=false \
  -p:TreatWarningsAsErrors=false -bl:"$E/local-$arm/build.binlog" --nologo -v:q
# Passed independently for baseline, candidate, reverted, and restored.
# Existing MAUI1001/CS0618 warnings remain visible.

dotnet xharness apple test --app "$E/local-$arm/Controls.DeviceTests.app" \
  --target ios-simulator-64_18.5 --device "$UDID" \
  --mlaunch "$E/mlaunch-headless.sh" \
  --output-directory "$E/local-$arm/repeat-$repeat" \
  --timeout 00:08:00 --launch-timeout 00:02:00 \
  --set-env=TestFilter=Category=CollectionView \
  --set-env=NUNIT_SKIPPED_CLASSES=Microsoft.Maui.DeviceTests.CollectionViewTests,Microsoft.Maui.DeviceTests.CollectionViewNavigationHandlerTests -v
# Three fresh processes per rebuilt arm; actual xunit-*.xml results above.

python3 "$E/verify-local-causal.py"
# Passed: all four arms, metadata transitions, exact identities/stacks, counts and XML hashes.

dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src \
  --exclude-diagnostics CA1822 \
  --include src/Controls/tests/DeviceTests/Elements/CollectionView/CollectionViewTests.iOS.cs \
  --verify-no-changes --verbosity quiet
# Passed.
git diff --check
# Passed.

Fresh hosted baseline: the single scoped device build 1645782, pinned to unchanged base 7b0ea780, completed. The Mono build succeeded; all seven excluded stages were actually skipped. The CollectionView work-item XML on both osx.15.arm64.maui.open and osx.26.arm64.open contains 83 total / 73 passed / 2 failed / 8 skipped / 0 errors. Both legacy base/inherited facts fail with the exact CtorNotLocated exception and both modern facts pass. No retry, requeue or further hosted run was requested. This is fresh hosted baseline-red evidence, not a hosted candidate result.

Coverage limits: the candidate's green causal evidence is genuine native iOS Mono execution, but only under the explicit local Xcode compatibility override. It is not Xcode 27 candidate certification, hosted candidate results, MacCatalyst/CoreCLR validation, full CollectionView-category candidate validation, or a claim that all net11.0 CI is green. The local matrix covers the 82-record class pair; the hosted baseline's full category has one additional passing record.

Open and recently merged PRs were checked for this helper, exception, file, and constructor-preservation mechanism. #37959 introduced the shared test helper; #38082 removed older Apple V1 coverage, but neither supplies this constructor contract. No equivalent fix was found. No approval or merge is requested from an agent.

Issues Fixed

No separate issue. Fixes the pre-existing CtorNotLocated failures for the two legacy grouped-empty-view fixture executions observed while investigating #39536; it does not modify that PR's GC fixture or address the other baseline failure families.

Propagate the public-constructor trimming contract through the generic empty-view fixture helper so both legacy and Items2 handler registrations remain activatable.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 88507d92-22fd-466c-86de-65cf187bf15b
Copilot AI balanced review requested due to automatic review settings October 22, 2026 19:17
@kubaflo
kubaflo temporarily deployed to copilot-pat-pool October 22, 2026 19:17 — with GitHub Actions Inactive
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 39572

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 39572"

@kubaflo
kubaflo temporarily deployed to copilot-pat-pool October 22, 2026 19:17 — with GitHub Actions Inactive
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

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.

🔵 Needs a closer look

Supported-Xcode candidate validation and current required-check results remain unverified, despite the reported local causal validation.

No open issues 🎉

What changed in this PR

This PR fixes constructor preservation for the grouped CollectionView device-test helper on net11.0, independently of the GC fixture changes in #39536.

Changes:

  • Adds DynamicallyAccessedMembers(PublicConstructors) to the helper’s handler type parameter to preserve constructors needed for dependency-injection activation.
  • Leaves legacy and modern handler tests, inherited fixture executions, and existing assertions unchanged.
File Description
src/​Controls/​tests/​DeviceTests/​Elements/​CollectionView/​CollectionViewTests.iOS.cs Imports the annotation namespace and propagates the public-constructor preservation contract.

Review effort: Balanced

@github-actions github-actions Bot added the s/agent-review-in-progress AI review is currently running for this PR label Oct 22, 2026
@kubaflo kubaflo closed this Oct 22, 2026

This branch was previously deployed

1 inactive deployment
copilot-pat-pool — 73ca647c Deployed Oct 22, 2026 by kubaflo via conclusion #2471
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

s/agent-review-in-progress AI review is currently running for this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants