Skip to content

[net11.0] Obsolete legacy CollectionView handler APIs - #38049

Merged
kubaflo merged 8 commits into
net11.0from
mattleibow-obsolete-collectionview-v1
Sep 2, 2026
Merged

kubaflo merged 8 commits into
net11.0from
mattleibow-obsolete-collectionview-v1

Conversation

@mattleibow

@mattleibow mattleibow commented Sep 1, 2026 •

Copy link
Copy Markdown
Member

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

Marks the public APIs belonging exclusively to the legacy CollectionView/CarouselView handler implementations as obsolete on platforms where Items2 supersedes them. The attributes remain normal compiler warnings, identify the affected platform, and provide Items2 migration guidance. Runtime handler registration and feature-switch behavior are unchanged.

General iOS and Mac Catalyst device-test coverage now uses Items2, matching the default runtime path. Explicit CV1 compatibility tests and CI lanes remain in place during the obsolescence period.

The sample-content template no longer configures the obsolete Windows V1 CollectionViewHandler. That accessibility workaround targeted ListViewBase.SingleSelectionFollowsFocus; the default CollectionView2 handler uses WinUI ItemsView, so the V1 mapper was both obsolete and ineffective for generated .NET 11 projects.

This PR also corrects the handler-detection guidance, which still said Items2 was iOS-only even though .NET 11 includes a Windows CollectionView2 implementation.

How the API boundary was determined

The Handlers/Items directory cannot be treated as uniformly legacy. I classified types using two pieces of implementation evidence:

  1. Default handler registration in AppHostBuilderExtensions.AddControlsHandlers identifies which stack is active for each platform and control.
  2. Cross-stack references from Items2 into Items identify source, native-view, and helper types that remain active dependencies rather than legacy APIs.

That produced this platform matrix:

Platform CollectionView CarouselView Items status
iOS / Mac Catalyst Items2 Items2 Legacy handlers are superseded; shared source/helpers remain active
Windows Items2 by default; Items fallback behind IsWindowsCollectionView2HandlerEnabled Items Only the CollectionView-specific Items hierarchy is superseded
Android Items Items Active; no Items2 implementation
Tizen Items Items Active; no Items2 implementation

APIs made obsolete

iOS and Mac Catalyst: 27 public types

  • Handler hierarchy: ItemsViewHandler<TItemsView>, StructuredItemsViewHandler<TItemsView>, SelectableItemsViewHandler<TItemsView>, GroupableItemsViewHandler<TItemsView>, ReorderableItemsViewHandler<TItemsView>, CollectionViewHandler, and CarouselViewHandler.
  • Controllers: ItemsViewController<TItemsView>, StructuredItemsViewController<TItemsView>, SelectableItemsViewController<TItemsView>, GroupableItemsViewController<TItemsView>, ReorderableItemsViewController<TItemsView>, and CarouselViewController.
  • Delegators: ItemsViewDelegator<TItemsView, TViewController>, SelectableItemsViewDelegator<TItemsView, TViewController>, GroupableItemsViewDelegator<TItemsView, TViewController>, ReorderableItemsViewDelegator<TItemsView, TViewController>, and CarouselViewDelegator.
  • Cells/event data: ItemsViewCell, DefaultCell, TemplatedCell, CarouselTemplatedCell, and LayoutAttributesChangedEventArgs.
  • Legacy flow layouts: ItemsViewLayout, ListViewLayout, GridViewLayout, and CarouselViewLayout.

Windows: 5 public types

  • CollectionViewHandler.
  • The CollectionView-only StructuredItemsViewHandler<TItemsView>, SelectableItemsViewHandler<TItemsView>, GroupableItemsViewHandler<TItemsView>, and ReorderableItemsViewHandler<TItemsView> hierarchy.

The attributes are placed on platform-specific partial declarations. This avoids producing incorrect warnings for the same Items handler symbols on Android, Tizen, or framework-neutral targets.

APIs deliberately kept active

  • All Android and Tizen Items APIs.
  • Windows ItemsViewHandler<TItemsView> and CarouselViewHandler, because CarouselView still depends on them.
  • The controls and models themselves (CollectionView, CarouselView, ItemsView, item layouts, and related control APIs).
  • iOS/Mac Catalyst Items APIs reused by Items2: IItemsViewSource, IObservableItemsViewSource, ILoopItemsViewSource, MauiCollectionView, IndexPathHelpers, and ScrollToPositionExtensions.
  • Internal source factories/implementations plus template, index-path, snap, scroll-tracking, and reorder helpers that Items2 still calls.

Comparison with #37990

After the initial implementation, I compared this PR with #37990 and adopted two useful patterns:

  • obsolete messages now explicitly name iOS/Mac Catalyst or Windows, because the same Items symbols remain active on other target frameworks;
  • general iOS/Mac Catalyst device tests now select CollectionViewHandler2/CarouselViewHandler2, and the CV1-only duplicate of the reset/animation test was removed.

I intentionally did not copy #37990 wholesale:

Migration messages and internal compilation

Where Items2 exposes a public one-to-one replacement, the obsolete message names it directly. Legacy layout and cell extension points without a public one-to-one V2 type instead point developers to the Items2 handler/UICollectionViewLayout pattern.

The legacy implementation necessarily references its own newly obsolete public bases. Those internal inheritance declarations have narrowly scoped CS0618 suppressions. The same narrow treatment is used for:

  • the intentional Windows feature-switch fallback;
  • tests that explicitly exercise CV1 compatibility;
  • the UI test host's CollectionView1/CarouselView1 configurations.

Consumer uses remain unsuppressed and receive the migration warnings.

Validation

Succeeded locally:

  • dotnet build Microsoft.Maui.BuildTasks.slnf -v:minimal
  • dotnet build src/Controls/src/Core/Controls.Core.csproj -f net11.0-ios26.5 --no-restore -v:minimal
  • dotnet build src/Controls/src/Core/Controls.Core.csproj -f net11.0-maccatalyst26.5 --no-restore -v:minimal
  • dotnet build src/Controls/src/Core/Controls.Core.csproj -f net11.0-android37.0 --no-restore -v:minimal
  • dotnet build src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj -f net11.0-ios -warnaserror:CS0618 -v:minimal
  • dotnet build src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj -f net11.0-maccatalyst --no-restore -warnaserror:CS0618 -v:minimal
  • dotnet build src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj -f net11.0-ios -v:minimal
  • dotnet build src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj -f net11.0-maccatalyst -v:minimal
  • dotnet build src/Templates/src/Microsoft.Maui.Templates.csproj --restore --verbosity:minimal

The Windows cross-build was attempted from macOS. Restore succeeded, but native Windows SDK tools (MakePri.exe and XamlCompiler.exe) cannot execute on this host. Windows CI therefore remains the authoritative compile validation for the platform-specific attribute declarations, fallback suppression, and generated sample-content project.

No PublicAPI file changes were required by the analyzers during the Apple platform builds.

Issues Fixed

N/A - this is an API lifecycle change for the .NET 11 handler transition, not a fix for a tracked bug.

Mark superseded Items handler APIs obsolete on Apple platforms and Windows while preserving active and shared implementations.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 1, 2026 01:57
@github-actions

github-actions Bot commented Sep 1, 2026

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 -- 38049

Or

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

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

🟢 Approval recommended

Pull request overview

This PR updates the .NET MAUI Controls “Items/” (legacy) CollectionView/CarouselView handler surface for .NET 11 by marking legacy handler extension-point APIs as [Obsolete] on platforms where Items2/ is the active implementation (iOS/MacCatalyst and Windows CollectionView). It also scopes CS0618 suppressions to internal legacy inheritance and to tests that intentionally exercise CV1 behavior, and it corrects repository guidance to reflect that Items2/ includes a Windows CollectionView handler.

Changes:

  • Mark legacy Items handler public APIs as obsolete on iOS/MacCatalyst and Windows CollectionView (with migration guidance to Items2 types).
  • Add narrowly-scoped #pragma warning disable/restore CS0618 in tests and internal legacy implementation points that must continue to reference obsolete legacy APIs.
  • Update .github/instructions guidance to correctly reflect Items vs Items2 handler coverage on Windows and across platforms.
File summaries
File Description
src/Controls/tests/TestCases.HostApp/CollectionViewHostBuilderExtentions.cs Suppress CS0618 for CV1 test wiring
src/Controls/tests/DeviceTests/TestCases/ControlsViewTypesTestCases.cs Suppress CS0618 for legacy handler matrix
src/Controls/tests/DeviceTests/Memory/MemoryTests.cs Suppress CS0618 for legacy handler coverage
src/Controls/tests/DeviceTests/Elements/VisualElementTree/VisualElementTreeTests.cs Suppress CS0618 for legacy CollectionView handler
src/Controls/tests/DeviceTests/Elements/Shell/ShellTests.cs Suppress CS0618 for legacy CollectionView handler
src/Controls/tests/DeviceTests/Elements/NavigationPage/NavigationPageTests.cs Suppress CS0618 for legacy Items handlers
src/Controls/tests/DeviceTests/Elements/CollectionView/CollectionViewTests.Windows.cs File-scoped CS0618 suppression for legacy handler tests
src/Controls/tests/DeviceTests/Elements/CollectionView/CollectionViewTests.iOS.cs File-scoped CS0618 suppression for legacy handler tests
src/Controls/tests/DeviceTests/Elements/CollectionView/CollectionViewTests.cs Scoped CS0618 suppressions around legacy handler usage
src/Controls/tests/DeviceTests/Elements/CollectionView/CollectionViewCacheTests.ios.cs CS0618 suppression for legacy handler cache tests
src/Controls/tests/DeviceTests/Elements/CarouselView/CarouselViewTests.cs File-scoped CS0618 suppression for legacy CarouselView handler tests
src/Controls/src/Core/Hosting/AppHostBuilderExtensions.cs Keep Windows CV1 opt-out path; suppress CS0618
src/Controls/src/Core/Handlers/Items/StructuredItemsViewHandler.Windows.cs Obsolete legacy Windows structured handler base
src/Controls/src/Core/Handlers/Items/StructuredItemsViewHandler.iOS.cs Obsolete legacy iOS structured handler base
src/Controls/src/Core/Handlers/Items/SelectableItemsViewHandler.Windows.cs Obsolete legacy Windows selectable handler base
src/Controls/src/Core/Handlers/Items/SelectableItemsViewHandler.iOS.cs Obsolete legacy iOS selectable handler base
src/Controls/src/Core/Handlers/Items/ReorderableItemsViewHandler.Windows.cs Obsolete legacy Windows reorderable handler base
src/Controls/src/Core/Handlers/Items/ReorderableItemsViewHandler.iOS.cs Obsolete legacy iOS reorderable handler base
src/Controls/src/Core/Handlers/Items/ItemsViewHandler.iOS.cs Obsolete legacy iOS ItemsViewHandler base
src/Controls/src/Core/Handlers/Items/iOS/WidthConstrainedTemplatedCell.cs Suppress CS0618 for internal legacy cell inheritance
src/Controls/src/Core/Handlers/Items/iOS/VerticalDefaultSupplementalView.cs Suppress CS0618 for internal legacy cell inheritance
src/Controls/src/Core/Handlers/Items/iOS/VerticalDefaultCell.cs Suppress CS0618 for internal legacy cell inheritance
src/Controls/src/Core/Handlers/Items/iOS/TemplatedCell.cs Obsolete legacy templated cell extension point
src/Controls/src/Core/Handlers/Items/iOS/StructuredItemsViewController.cs Obsolete legacy controller API
src/Controls/src/Core/Handlers/Items/iOS/SelectableItemsViewDelegator.cs Obsolete legacy delegator API
src/Controls/src/Core/Handlers/Items/iOS/SelectableItemsViewController.cs Obsolete legacy controller API
src/Controls/src/Core/Handlers/Items/iOS/ReorderableItemsViewDelegator.cs Obsolete legacy delegator API
src/Controls/src/Core/Handlers/Items/iOS/ReorderableItemsViewController.cs Obsolete legacy controller API
src/Controls/src/Core/Handlers/Items/iOS/ListViewLayout.cs Obsolete legacy layout API
src/Controls/src/Core/Handlers/Items/iOS/LayoutAttributesChangedEventArgs.cs Obsolete legacy event args API
src/Controls/src/Core/Handlers/Items/iOS/ItemsViewLayout.cs Obsolete legacy layout base API
src/Controls/src/Core/Handlers/Items/iOS/ItemsViewDelegator.cs Obsolete legacy delegator base API
src/Controls/src/Core/Handlers/Items/iOS/ItemsViewController.cs Obsolete legacy controller base API
src/Controls/src/Core/Handlers/Items/iOS/ItemsViewCell.cs Obsolete legacy cell base API
src/Controls/src/Core/Handlers/Items/iOS/HorizontalDefaultSupplementalView.cs Suppress CS0618 for internal legacy cell inheritance
src/Controls/src/Core/Handlers/Items/iOS/HorizontalDefaultCell.cs Suppress CS0618 for internal legacy cell inheritance
src/Controls/src/Core/Handlers/Items/iOS/HeightConstrainedTemplatedCell.cs Suppress CS0618 for internal legacy cell inheritance
src/Controls/src/Core/Handlers/Items/iOS/GroupableItemsViewDelegator.cs Obsolete legacy delegator API
src/Controls/src/Core/Handlers/Items/iOS/GroupableItemsViewController.cs Obsolete legacy controller API
src/Controls/src/Core/Handlers/Items/iOS/GridViewLayout.cs Obsolete legacy layout API
src/Controls/src/Core/Handlers/Items/iOS/DefaultCell.cs Obsolete legacy default cell API
src/Controls/src/Core/Handlers/Items/iOS/CarouselViewLayout.cs Obsolete legacy carousel layout API
src/Controls/src/Core/Handlers/Items/iOS/CarouselViewDelegator.cs Obsolete legacy carousel delegator API
src/Controls/src/Core/Handlers/Items/iOS/CarouselViewController.cs Obsolete legacy carousel controller API
src/Controls/src/Core/Handlers/Items/iOS/CarouselTemplatedCell.cs Obsolete legacy carousel templated cell API
src/Controls/src/Core/Handlers/Items/GroupableItemsViewHandler.Windows.cs Obsolete legacy Windows groupable handler base
src/Controls/src/Core/Handlers/Items/GroupableItemsViewHandler.iOS.cs Obsolete legacy iOS groupable handler base
src/Controls/src/Core/Handlers/Items/CollectionViewHandler.Windows.cs Obsolete legacy Windows CollectionViewHandler
src/Controls/src/Core/Handlers/Items/CollectionViewHandler.iOS.cs Obsolete legacy iOS CollectionViewHandler
src/Controls/src/Core/Handlers/Items/CarouselViewHandler.iOS.cs Obsolete legacy iOS CarouselViewHandler
.github/instructions/collectionview-windows.instructions.md Update guidance: Items2 is default for Windows CollectionView
.github/instructions/collectionview-handler-detection.instructions.md Correct handler detection guidance + shared infra notes
Review details
  • Files reviewed: 52/52 changed files
  • Comments generated: 0
  • Review effort level: Lite

@mattleibow

This comment has been minimized.

@kubaflo

kubaflo commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

Clarify platform-scoped obsolete messages and route general Apple device tests through Items2 while retaining explicit CV1 compatibility and shared-helper coverage.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 1, 2026 16:15
@kubaflo

This comment has been minimized.

@kubaflo

kubaflo commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

@MauiBot

This comment has been minimized.

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

It introduces broad public API obsolescence across multiple platforms and relies on platform-specific compilation/validation (especially Windows) that should be confirmed by a human reviewer.

Review details
  • Files reviewed: 54/54 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@mattleibow

This comment has been minimized.

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

kubaflo commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

@MauiBot MauiBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

AI Review Summary

@mattleibow — new AI review results are available based on commit 17f2bd7.

Gate Inconclusive Confidence Low Platform iOS


🗂️ Review Sessions — click to expand
🚦 Gate — Test Before & After Fix

Gate Result: ⚠️ INCONCLUSIVE

Platform: IOS · Base: net11.0 · Merge base: 14797cb1

🩺 Could not verify — environment/infrastructure error. The gate ran the tests but hit an environment error (an emulator/simulator/Appium/XHarness flake, a device that would not boot, or an empty/invalid result file), so it could not record a real pass/fail. The ⚠️ ENV ERROR marks below are infrastructure, not test failures — this is not a problem with your PR. Comment /review to retry on a fresh agent.

XHarness did not produce the expected fresh result 'testResults.xml' for requested class(es) 'Microsoft.Maui.DeviceTests.CacheTestCollectionView' (the target tests did not run).

⚠️ Gate coverage limitations

  • The A/B gate did not verify 5 dropped DeviceTest group(s): CollectionViewTests (CellSizeAccountsForMargin, CollectionScrollToUngroupedWorks, CollectionScrollToGroupWorks, CollectionViewItemsWithFixedWidthAndDifferentHeight, SwipeViewInCollectionViewDoesNotCrash, ClearingItemsSourceClearsBindingContext, ItemsSourceGroupedClearDoestCrash, CollectionViewContentRespectsMargin, ClearingItemsSourceAfterCellMeasureInvalidationDoesNotCrash, CollectionViewCellContentShouldBeScrollViewDescendant), MemoryTests (HandlerDoesNotLeak, CollectionViewHeaderFooterDoesntLeak, CarouselViewController2ControllerDoesNotLeakAfterNavigationPop), NavigationPageTests, ShellTests, VisualElementTreeTests. Deep UI Tests runs HostApp UI categories only and does not execute DeviceTests; separate device-test validation is required.
Test Without Fix (expect FAIL) With Fix (expect PASS)
📱 CacheTestCollectionView CacheTestCollectionView ⚠️ ENV ERROR ⚠️ ENV ERROR
📱 CarouselViewTests Category=CarouselView ⚠️ ENV ERROR ⚠️ ENV ERROR
🔴 Without fix — 📱 CacheTestCollectionView: ⚠️ ENV ERROR · 180s

No log file found

🟢 With fix — 📱 CacheTestCollectionView: ⚠️ ENV ERROR · 63s

No log file found

🔴 Without fix — 📱 CarouselViewTests: ⚠️ ENV ERROR · 95s

No log file found

🟢 With fix — 📱 CarouselViewTests: ⚠️ ENV ERROR · 54s

No log file found

⚠️ Failure Details

  • ⚠️ CacheTestCollectionView without fix: XHarness did not produce the expected fresh result 'testResults.xml' for requested class(es) 'Microsoft.Maui.DeviceTests.CacheTestCollectionView' (the target tests did not run).
  • ⚠️ CarouselViewTests without fix: XHarness did not produce the expected fresh result 'testResults.xml' for requested class(es) 'Microsoft.Maui.DeviceTests.CarouselViewTests' (the target tests did not run).
  • ⚠️ CacheTestCollectionView with fix: XHarness did not produce the expected fresh result 'testResults.xml' for requested class(es) 'Microsoft.Maui.DeviceTests.CacheTestCollectionView' (the target tests did not run).
  • ⚠️ CarouselViewTests with fix: XHarness did not produce the expected fresh result 'testResults.xml' for requested class(es) 'Microsoft.Maui.DeviceTests.CarouselViewTests' (the target tests did not run).
📁 Fix files reverted (40 files)
  • src/Controls/src/Core/Handlers/Items/CarouselViewHandler.iOS.cs
  • src/Controls/src/Core/Handlers/Items/CollectionViewHandler.Windows.cs
  • src/Controls/src/Core/Handlers/Items/CollectionViewHandler.iOS.cs
  • src/Controls/src/Core/Handlers/Items/GroupableItemsViewHandler.Windows.cs
  • src/Controls/src/Core/Handlers/Items/GroupableItemsViewHandler.iOS.cs
  • src/Controls/src/Core/Handlers/Items/ItemsViewHandler.iOS.cs
  • src/Controls/src/Core/Handlers/Items/ReorderableItemsViewHandler.Windows.cs
  • src/Controls/src/Core/Handlers/Items/ReorderableItemsViewHandler.iOS.cs
  • src/Controls/src/Core/Handlers/Items/SelectableItemsViewHandler.Windows.cs
  • src/Controls/src/Core/Handlers/Items/SelectableItemsViewHandler.iOS.cs
  • src/Controls/src/Core/Handlers/Items/StructuredItemsViewHandler.Windows.cs
  • src/Controls/src/Core/Handlers/Items/StructuredItemsViewHandler.iOS.cs
  • src/Controls/src/Core/Handlers/Items/iOS/CarouselTemplatedCell.cs
  • src/Controls/src/Core/Handlers/Items/iOS/CarouselViewController.cs
  • src/Controls/src/Core/Handlers/Items/iOS/CarouselViewDelegator.cs
  • src/Controls/src/Core/Handlers/Items/iOS/CarouselViewLayout.cs
  • src/Controls/src/Core/Handlers/Items/iOS/DefaultCell.cs
  • src/Controls/src/Core/Handlers/Items/iOS/GridViewLayout.cs
  • src/Controls/src/Core/Handlers/Items/iOS/GroupableItemsViewController.cs
  • src/Controls/src/Core/Handlers/Items/iOS/GroupableItemsViewDelegator.cs
  • src/Controls/src/Core/Handlers/Items/iOS/HeightConstrainedTemplatedCell.cs
  • src/Controls/src/Core/Handlers/Items/iOS/HorizontalDefaultCell.cs
  • src/Controls/src/Core/Handlers/Items/iOS/HorizontalDefaultSupplementalView.cs
  • src/Controls/src/Core/Handlers/Items/iOS/ItemsViewCell.cs
  • src/Controls/src/Core/Handlers/Items/iOS/ItemsViewController.cs
  • src/Controls/src/Core/Handlers/Items/iOS/ItemsViewDelegator.cs
  • src/Controls/src/Core/Handlers/Items/iOS/ItemsViewLayout.cs
  • src/Controls/src/Core/Handlers/Items/iOS/LayoutAttributesChangedEventArgs.cs
  • src/Controls/src/Core/Handlers/Items/iOS/ListViewLayout.cs
  • src/Controls/src/Core/Handlers/Items/iOS/ReorderableItemsViewController.cs
  • src/Controls/src/Core/Handlers/Items/iOS/ReorderableItemsViewDelegator.cs
  • src/Controls/src/Core/Handlers/Items/iOS/SelectableItemsViewController.cs
  • src/Controls/src/Core/Handlers/Items/iOS/SelectableItemsViewDelegator.cs
  • src/Controls/src/Core/Handlers/Items/iOS/StructuredItemsViewController.cs
  • src/Controls/src/Core/Handlers/Items/iOS/TemplatedCell.cs
  • src/Controls/src/Core/Handlers/Items/iOS/VerticalDefaultCell.cs
  • src/Controls/src/Core/Handlers/Items/iOS/VerticalDefaultSupplementalView.cs
  • src/Controls/src/Core/Handlers/Items/iOS/WidthConstrainedTemplatedCell.cs
  • src/Controls/src/Core/Hosting/AppHostBuilderExtensions.cs
  • src/Templates/src/templates/maui-mobile/MauiProgram.cs

📋 Pre-Flight — Context & Validation

PR #38049 Pre-Flight

PR context

  • Title: [net11.0] Obsolete legacy CollectionView handler APIs
  • Base: net11.0 at merge base 14797cb136
  • Materialized review commit: c92e7f5868
  • Target platform for STEP 5a: iOS
  • Scope: API lifecycle change; there is no linked bug issue.

The PR marks public APIs that belong exclusively to superseded CollectionView/CarouselView implementations as obsolete while preserving the runtime legacy implementations and their compatibility switches. The platform boundary matters:

  • iOS and Mac Catalyst default to Items2 for both CollectionView and CarouselView.
  • Windows defaults to Items2 only for CollectionView; Items remains the feature-switch fallback, while Windows CarouselView still uses Items.
  • Android and Tizen continue to use Items.
  • Items2 still consumes selected Items source/native/helper infrastructure, so those shared APIs must not be made obsolete merely because they live under Handlers/Items.

Existing fix inspected

The PR changes 54 files (239 additions, 66 deletions). Its production strategy is:

  1. Put normal warning-level [Obsolete] attributes on platform-specific partial declarations: 27 public legacy types on iOS/Mac Catalyst and the five CollectionView-specific legacy handler types on Windows.
  2. Give each warning platform-specific migration guidance, naming an Items2 replacement where one exists and an Items2/UICollectionViewLayout pattern for legacy extension points without a one-to-one replacement.
  3. Add narrowly scoped CS0618 suppressions only where the retained legacy implementation inherits from or instantiates its own obsolete APIs, and around intentional compatibility registration.
  4. Leave runtime registration and feature-switch behavior intact.
  5. Switch general Apple device-test setup to Items2 while retaining explicit CV1 compatibility coverage.
  6. Remove the obsolete Windows V1 mapper customization from the .NET 11 sample template and correct handler-detection guidance.

The diff deliberately leaves active the Items APIs reused by Items2, including IItemsViewSource, IObservableItemsViewSource, ILoopItemsViewSource, MauiCollectionView, IndexPathHelpers, and ScrollToPositionExtensions, plus internal shared helpers.

Test contract

The prior gate is already complete and must not be re-run. It was INCONCLUSIVE, not a product failure: XHarness produced no fresh testResults.xml, so neither selector actually ran. Preserve gate/content.md.

Use only these detected iOS device-test commands for each candidate:

# Primary
pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform ios -TestFilter "CacheTestCollectionView"

# Mandatory regression
pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform ios -TestFilter "Category=CarouselView"

Do not run a full suite. Each candidate has one implementation/test pass and at most one focused correction followed by a retest of the affected selector(s). A simulator/XHarness/setup failure is Blocked, not Pass.

The gate also identified dropped test coverage outside these bounded selectors: portions of CollectionViewTests, MemoryTests, NavigationPageTests, ShellTests, and VisualElementTreeTests. Record that limitation; do not expand STEP 5a into those suites.

Baseline and edit boundary

EstablishBrokenBaseline.ps1 identified the following 40 fix files. After the skill establishes its own baseline, .github/.baseline-state.json is authoritative and only files in its RevertedFiles array may be edited:

  • Apple legacy handler roots: CarouselViewHandler.iOS.cs, CollectionViewHandler.iOS.cs, ItemsViewHandler.iOS.cs, StructuredItemsViewHandler.iOS.cs, SelectableItemsViewHandler.iOS.cs, GroupableItemsViewHandler.iOS.cs, and ReorderableItemsViewHandler.iOS.cs.
  • Windows legacy CollectionView roots: CollectionViewHandler.Windows.cs, StructuredItemsViewHandler.Windows.cs, SelectableItemsViewHandler.Windows.cs, GroupableItemsViewHandler.Windows.cs, and ReorderableItemsViewHandler.Windows.cs.
  • Apple legacy implementation files under src/Controls/src/Core/Handlers/Items/iOS/: CarouselTemplatedCell.cs, CarouselViewController.cs, CarouselViewDelegator.cs, CarouselViewLayout.cs, DefaultCell.cs, GridViewLayout.cs, GroupableItemsViewController.cs, GroupableItemsViewDelegator.cs, HeightConstrainedTemplatedCell.cs, HorizontalDefaultCell.cs, HorizontalDefaultSupplementalView.cs, ItemsViewCell.cs, ItemsViewController.cs, ItemsViewDelegator.cs, ItemsViewLayout.cs, LayoutAttributesChangedEventArgs.cs, ListViewLayout.cs, ReorderableItemsViewController.cs, ReorderableItemsViewDelegator.cs, SelectableItemsViewController.cs, SelectableItemsViewDelegator.cs, StructuredItemsViewController.cs, TemplatedCell.cs, VerticalDefaultCell.cs, VerticalDefaultSupplementalView.cs, and WidthConstrainedTemplatedCell.cs.
  • src/Controls/src/Core/Hosting/AppHostBuilderExtensions.cs
  • src/Templates/src/templates/maui-mobile/MauiProgram.cs

The worktree contains unrelated, pre-existing modifications under .github/scripts, .github/skills, and eng/scripts. They are not part of this PR candidate work and must remain untouched. Restoration must use only:

pwsh .github/scripts/EstablishBrokenBaseline.ps1 -Restore

Candidate requirements

Each attempt must propose one mechanism-level alternative to the existing platform-partial obsolescence strategy, preserve platform correctness and compatibility, perform the inline MAUI expert self-review required by try-fix, capture all required artifacts, and restore the baseline before returning. Candidate 2 must also avoid Candidate 1's recorded mechanism and must not reopen or rerun Candidate 1.


🔬 Code Review — Deep Analysis

Expert Code Review — PR #38049

Verdict

NEEDS_DISCUSSION

Confidence: low

The submitted change is mechanically sound on code inspection, and the expert review found no actionable file:line defect. Confidence remains low because the trusted Gate was inconclusive and required-check resolution was unavailable; that evidence gap is not itself a failing fix.

Independent Assessment

The PR adds platform-specific obsolescence warnings to legacy CollectionView and CarouselView handler APIs superseded by Items2 on iOS, Mac Catalyst, and (for CollectionView only) Windows. It retains the Windows feature-switch fallback and explicit legacy-test coverage through narrow CS0618 suppressions, moves general Apple device-test wiring to Items2, removes an obsolete Windows V1 mapper from the sample-content template, and corrects handler-detection guidance.

Findings

No actionable findings. inline-findings.json contains an empty JSON array.

Prior Review Reconciliation

Prior review concerns about warning messages, suppression scope, and Apple coverage intent are addressed in the submitted head. No unresolved prior error-level finding applies to the current diff.

Blast Radius and Failure Modes

  • The public warning surface affects consumers that compile against the obsolete platform APIs, but no new runtime path, startup work, static state, subscription, or handler lifecycle behavior is introduced.
  • The Windows V1 fallback remains reachable when RuntimeFeature.IsWindowsCollectionView2HandlerEnabled is disabled.
  • Default Apple registration and general test wiring remain aligned on Items2, while explicit legacy compatibility coverage remains identifiable.
  • No external-tool output classification or Trim/NativeAOT reachability contract is changed.

CI Evidence

The trusted Gate is inconclusive because its validation could not build or run. This is recorded as unverified rather than failed, and gate verification was not rerun.

Reviewer Improvement

The expert review proposed no corrective change, so there is no reviewer patch to apply to the submitted implementation.


🛠️ Try-Fix — Analysis & Comparison

Aggregate Try-Fix Results for PR #38049

Candidate 1 — Registration-boundary obsolescence

Model: gpt-5.3-codex
Result: Blocked
Candidate narrative: CustomAgentLogsTmp/PRState/38049/PRAgent/try-fix-1/content.md
Skill artifacts: CustomAgentLogsTmp/PRState/38049/PRAgent/try-fix/attempt-1

Candidate 1 proposed warning at explicit legacy compatibility registration/opt-in points rather than at every legacy type declaration. This is mechanism-level distinct from the PR, but baseline establishment rejected the unrelated pre-existing dirty worktree and created no edit allow-list, so the candidate made no source changes. Its tests ran against the unchanged PR and cannot validate the proposal. The CacheTestCollectionView selector unexpectedly expanded to 1,348 tests; later work must not repeat that broad execution.

Candidate 1 diff

# Empty: baseline blocked implementation.

Candidate 2 — Consumer-side legacy API analyzer

Model: gpt-5.6-sol
Result: Blocked
Candidate narrative: CustomAgentLogsTmp/PRState/38049/PRAgent/try-fix-2/content.md
Skill artifacts: CustomAgentLogsTmp/PRState/38049/PRAgent/try-fix/attempt-2

Candidate 2 proposed a platform-aware Roslyn analyzer that diagnoses semantic references to the legacy types. Unlike the PR's declaration metadata, this would not make retained implementation symbols obsolete; unlike Candidate 1's registration boundary, it would cover direct construction, derivation, and other symbol uses. Baseline establishment again produced no edit allow-list. More fundamentally, the analyzer requires new project/source and packaging files outside the baseline boundary, so the mechanism is infeasible within STEP 5a. It made no source changes and correctly skipped both test launches.

Candidate 2 diff

# Empty: baseline and file-boundary constraints blocked implementation.

Aggregate conclusion

Two candidates were attempted, in the required model order, and no further candidates were launched. Both are distinct from the PR and from each other, but neither produced a safely restorable implementation:

Candidate Alternative mechanism Result Key blocker
1 Warn at legacy registration/opt-in boundaries Blocked No baseline allow-list; direct public type use may bypass the warning
2 Consumer-side platform-aware Roslyn analyzer Blocked No baseline allow-list; requires new analyzer/package files outside the allowed boundary

The existing PR's platform-specific [Obsolete] declarations remain the only evaluated mechanism that supplies compiler warnings for direct public API use using the files available to this bounded try-fix phase. This aggregate does not claim that the existing PR is verified: the prior gate remains INCONCLUSIVE, and Candidate 1's successful test commands ran unchanged PR code rather than a candidate.


🏁 Report — Final Recommendation

✅ Final Recommendation: APPROVE

Winning candidate

Winner: pr

The raw submitted PR is the only implemented, reviewable solution and the expert review found no actionable code defect. pr-plus-reviewer is implementation-equivalent because there was no reviewer feedback to apply, while both STEP 5a alternatives were blocked before producing source changes.

Comparative ranking

Rank Candidate Implementation Regression evidence Assessment
1 pr Complete 54-file platform-specific obsolescence change Trusted Gate INCONCLUSIVE; no test failure established Best coverage with the least mechanism complexity; expert review found no actionable issue
2 pr-plus-reviewer Identical to pr; empty reviewer.patch Not run because no reviewer change was applied Correct but offers no improvement over the submitted fix
3 try-fix-2 Blocked; empty diff Both selectors correctly skipped A semantic analyzer could cover direct symbol use, but requires new analyzer and packaging surfaces outside the bounded change and is substantially more complex
4 try-fix-1 Blocked; empty diff Results came from unchanged PR code and do not validate the proposal Registration-boundary warnings can be bypassed by direct construction, inheritance, and other public type references

No candidate has a valid regression-test failure or a valid candidate-specific pass. Candidate 1's CacheTestCollectionView command expanded to 1,348 tests and its four CarouselView tests ran against unchanged PR code; Candidate 2 made no change and launched neither selector. The ranking therefore does not misclassify blocked or infrastructure outcomes as product failures.

Why pr wins

  • Platform-specific partial declarations give compiler warnings at every relevant public type use without incorrectly warning Android, Tizen, shared Items infrastructure consumed by Items2, or Windows CarouselView APIs that remain active.
  • The Windows CollectionView V1 feature-switch fallback and explicit legacy compatibility tests remain available through narrowly scoped CS0618 suppressions.
  • General Apple device-test registration follows the default Items2 runtime path, while explicit V1 compatibility coverage remains identifiable.
  • Removing the Windows V1 sample-template mapper matches the default ItemsView-based handler, and the handler-detection guidance now reflects the iOS/Mac Catalyst and Windows split.
  • The regression cross-reference found no overlap with recent labeled bug-fix removals, and the single expert pass produced [] inline findings.

Validation and residual uncertainty

The trusted Gate is INCONCLUSIVE: XHarness did not produce fresh results, so the requested iOS selectors did not establish pass or fail. It also identified unverified coverage in portions of CollectionView, memory, navigation, Shell, and visual-tree device tests. Per the supplied gate contract, this environment outcome is non-blocking and is not a reason by itself to request changes.

The expert evaluation's low-confidence NEEDS_DISCUSSION label reflects that missing authoritative validation evidence, not a code-level error or unresolved discussion item. On the implementation merits, the raw PR remains preferable to both unimplemented alternatives and the no-op reviewer candidate.


📱 UI Tests — CollectionView

Detected UI test categories: CollectionView

✅ Deep UI tests — 428 passed, 0 failed, 5 skipped across 1 category on platform-pool agent (replaces in-process counts above).

🧪 UI Test Execution Results (deep, platform pool)

Category Tests Snapshot diffs
CollectionView 428/433 (5 skipped) ✓ —
📎 Download drop-deep-uitests artifact (TRX + snapshot diffs)

🧭 Next Steps — review latest findings

No alternative fix was selected for this run. Review the session findings and CI results before merging.

@MauiBot MauiBot added s/agent-changes-requested AI agent recommends changes - found a better alternative or issues s/agent-fix-pr-picked AI could not beat the PR fix - PR is the best among all candidates s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review) and removed s/agent-review-in-progress AI review is currently running for this PR labels Sep 2, 2026
Copilot AI review requested due to automatic review settings September 2, 2026 22:09
@kubaflo
kubaflo merged commit dd86ae0 into net11.0 Sep 2, 2026
4 of 15 checks passed
@kubaflo
kubaflo deleted the mattleibow-obsolete-collectionview-v1 branch September 2, 2026 22:12
@github-actions github-actions Bot added this to the .NET 11.0-preview7 milestone Sep 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.

🔵 Needs a closer look

It touches a broad set of platform-specific handler APIs and test wiring across multiple targets, making it better suited for final human validation before approval.

Review details
  • Files reviewed: 54/54 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

kubaflo added a commit that referenced this pull request Sep 4, 2026
<!-- Please let the below note in for people that find this PR -->
> [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### Description of Change

This PR is stacked on #38049 and removes the remaining iOS/Mac Catalyst
CollectionView and CarouselView V1 test coverage. The Apple V1 handler
is obsolete, will receive no further fixes, and its dedicated test
coverage is flaky and time-consuming.

The change:

- removes the dedicated iOS CollectionView V1 and CarouselView V1
UI-test stages and filters;
- removes Apple `TEST_CONFIGURATION_ARGS=CollectionView1` handler
switching, `CollectionView1`/`CarouselView1` controls, and their
obsolete-warning suppressions;
- deletes the V1-only iOS cache device test and disabled legacy
`VerticalCell` leak test;
- migrates general CarouselView and CollectionView host fixtures to the
default Apple Items2 handlers;
- removes the Apple-only Issue 25433 V1 snapshot coverage while
preserving its Android Items test; and
- keeps Items types still consumed by Items2, including item-source,
index-path, template, snap, scroll, reorder, and `MauiCollectionView`
infrastructure.

### Coverage audit

| Removed Apple V1 coverage | Disposition | Replacement / rationale |
|---|---|---|
| Dedicated `ios_ui_tests_coreclr_cv1` CollectionView lane | **(a)
Equivalent Items2 test exists** | The normal iOS lane runs the same
`CollectionView` category with Items2. |
| Dedicated `ios_ui_tests_coreclr_carv1` CarouselView lane | **(a)
Equivalent Items2 test exists** | The normal iOS lane runs the same
`CarouselView` category with Items2. |
| Host `CollectionView1` / `CarouselView1` controls and environment
switch | **(a)/(b) Removed or migrated** | Dedicated V1 selection is
removed; explicit `CollectionView2` / `CarouselView2` fixtures remain. |
| `EnsureCellSizesAreCached` and its custom handler/controller/delegator
| **(c) V1 implementation-specific** | It introspected the legacy
flow-layout cache through `ReorderableItemsViewHandler`,
`ItemsViewController`, and `ItemsViewDelegator`. |
| Disabled `CellsDoNotLeak` device test | **(c) V1
implementation-specific** | It directly constructed the legacy
`VerticalCell`; current Apple handler/controller leak tests cover
Items2. |
| Carousel gallery next/previous and loop navigation tests | **(b)
Migrated to Items2 in this PR** | `CarouselViewCoreGalleryPage` now uses
standard `CarouselView`; these tests pass in the normal Apple lane. |
| `CarouselViewSetPosition` and
`CarouselViewKeepPositionChangingOrientation` | **(d) Apple Items2
coverage gap** | UI CI confirmed Items2 still reports position `0`
instead of `3` and loses the visible item after rotation. Android Items
coverage remains; Apple execution is excluded pending an Items2 fix. |
| `CarouselViewUpdateCurrentItem` host fixture | **(b)/(d) Migrated to
Items2; Apple execution needs follow-up** | The page now uses standard
`CarouselView`; Android Items coverage remains, while Apple execution is
excluded for open CV2 regression #29312. |
| Issue 25433 horizontal-grid spacing test and three Apple snapshots |
**(c) V1 implementation-specific** | Its fix (#25825) changed only
`Handlers/Items/iOS`. Android Items coverage and snapshots remain. |
| Issue 26066 CV1 comparison fixture | **(a) Equivalent Items2 test
exists** | `CollectionView2ShouldFindAncestorType` continues to validate
the Items2 scenario. |
| Issue 27711 dedicated-lane CV1 execution | **(a) Equivalent Items2
test exists** | The normal Apple lane continues
`RightToLeftFlowDirectionShouldWork` with Items2. |

Categories: **(a)** equivalent Items2 coverage, **(b)** migrated to
Items2 here, **(c)** V1 implementation-specific and intentionally
removed, **(d)** possible coverage gap.

### Needs follow-up investigation

- **(d) `CarouselViewUpdateCurrentItem.Issue9827Test`:** the host
fixture now targets Items2, but the Appium test is restricted to Android
while open CV2 regression #29312 is unresolved. Android Items coverage
remains; Apple coverage needs to be re-enabled when #29312 is fixed.
- **(d) `CarouselViewSetPosition` and
`CarouselViewKeepPositionChangingOrientation`:** the Items2 host
migration exposed failing Apple behavior in UI CI. Both remain enabled
for Android Items and are excluded on iOS/Mac Catalyst until the Items2
behavior is fixed.

### Windows CV1 preserved

- [x] `build_ui_tests_windows_cv1` and `winui_ui_tests_cv1` remain in
`eng/pipelines/common/ui-tests.yml`.
- [x] `useWindowsCV1`, `UseWindowsCV1:true`, and the
`ui-tests-samples-windows-cv1` artifact flow remain in the UI-test
templates.
- [x] `UITest.cs` still maps Windows CV1 runs to the `windows-cv1`
snapshot environment.
- [x] All 70 baselines under
`src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows-cv1/`
remain.
- [x] Windows CollectionView V1 device tests, handler aliases, and
feature-switch plumbing are unchanged.
- [x] No Windows or WinUI file is removed or modified by this PR.

### Validation

- Built `Controls.DeviceTests` for `net11.0-ios` and
`net11.0-maccatalyst` with `CS0618` treated as an error.
- Built `Controls.TestCases.HostApp` for `net11.0-ios` and
`net11.0-maccatalyst` with `CS0618` treated as an error.
- Built the iOS, Mac Catalyst, and Android Appium test projects with
`CS0618` treated as an error.
- Parsed `eng/pipelines/common/ui-tests.yml` successfully.
- Confirmed no Apple V1 handler fixture, selector, dedicated stage, or
legacy controller/cell reference remains in Apple test code.
- Confirmed shared Items helpers used by Items2 and all Windows CV1
selectors/snapshots remain.

### Issues Fixed

N/A

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo pushed a commit that referenced this pull request Sep 21, 2026
…38728)

<!-- Please let the below note in for people that find this PR -->
> [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### Issue Details
After PR #38049, the SwipeViewTests device tests report a CS0618
obsolete warning for CollectionViewHandler on iOS and Mac Catalyst. The
test explicitly registers the legacy CollectionViewHandler, which is now
marked obsolete on these platforms.

### Root Cause
PR #38049 marked the legacy CollectionViewHandler as obsolete on iOS and
Mac Catalyst because CollectionViewHandler2 is used on these platforms.
The SwipeViewTests setup still registers CollectionViewHandler for all
platforms, which results in a CS0618 warning on iOS and Mac Catalyst.

### Description of Change
Updated the CollectionViewHandler registration in SwipeViewTests to use
CollectionViewHandler2 on iOS and Mac Catalyst, while retaining the
existing CollectionViewHandler for other platforms. Added a
Windows-specific warning suppression since the legacy handler is
intentionally used for Windows coverage.

**Reference:**
https://github.com/dotnet/maui/blob/net11.0/src/Controls/tests/DeviceTests/Elements/NavigationPage/NavigationPageTests.cs#L97

### Issues Fixed
  
Fixes #38726

### Output

|Before|After|
|--|--|
| <img width="1500" height="200" alt="image"
src="https://github.com/user-attachments/assets/5d896b6f-1a44-4d85-9929-3b1b6f526090"
/> | <img width="900" height="100" alt="image"
src="https://github.com/user-attachments/assets/b2e3a7bc-f368-4912-9689-6bab92109b5d"
/> |
kubaflo pushed a commit that referenced this pull request Sep 21, 2026
<!-- Please let the below note in for people that find this PR -->
> [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### Issue Details
CollectionViewHandler should not be marked as obsolete on Windows in
.NET 11.

### Description of change
Reverted the CV1 obsoletion changes for Windows introduced in PR #38049.
CV2 is introduced for CollectionView on Windows in .NET 11. CV1
(CollectionViewHandler) will continue to be supported on Windows for now
instead of being marked as obsolete in the same release. The CV1 handler
will remain available for existing applications and can be marked as
obsolete in a future release.
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-controls-collectionview CollectionView, CarouselView, IndicatorView platform/ios platform/macos macOS / Mac Catalyst platform/windows s/agent-changes-requested AI agent recommends changes - found a better alternative or issues s/agent-fix-pr-picked AI could not beat the PR fix - PR is the best among all candidates s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants