Skip to content

[UIKit] Enable nullability and clean up UICollectionView.#24599

Merged
rolfbjarne merged 3 commits intomainfrom
dev/rolf/uikit-nullability-uicollectionview-05
Feb 3, 2026
Merged

[UIKit] Enable nullability and clean up UICollectionView.#24599
rolfbjarne merged 3 commits intomainfrom
dev/rolf/uikit-nullability-uicollectionview-05

Conversation

@rolfbjarne
Copy link
Member

This is file 5 of 30 files with nullability disabled in UIKit.

  • Enable nullability (#nullable enable).
  • Remove unused System.Threading.Tasks using directive.
  • Use ArgumentNullException.ThrowIfNull() instead of manual null checks.
  • Add nullable annotation for Source property (UICollectionViewSource?).
  • Simplify Source property getter with expression body.
  • Replace include file references with inlined XML documentation.
  • Remove inlined DocId entries from docs/api/UIKit/UICollectionView.xml.
  • Improve XML documentation comments: remove 'To be added.' placeholders, fix whitespace, add missing docs, add 'see cref' references.

Contributes towards #17285.

This is file 5 of 30 files with nullability disabled in UIKit.

* Enable nullability (#nullable enable).
* Remove unused System.Threading.Tasks using directive.
* Use ArgumentNullException.ThrowIfNull() instead of manual null checks.
* Add nullable annotation for Source property (UICollectionViewSource?).
* Simplify Source property getter with expression body.
* Replace include file references with inlined XML documentation.
* Remove inlined DocId entries from docs/api/UIKit/UICollectionView.xml.
* Improve XML documentation comments: remove 'To be added.' placeholders, fix whitespace, add missing docs, add 'see cref' references.

Contributes towards #17285.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Enables nullable reference types for UICollectionView and refreshes related API/documentation to reduce “nullable-disabled” surface area in UIKit.

Changes:

  • Enabled #nullable in src/UIKit/UICollectionView.cs and updated signatures/docs (notably Source and registration helpers).
  • Updated ObjCRuntime.Class.GetHandle to accept nullable Type and return NativeHandle.Zero for null.
  • Removed now-redundant XML DocId blocks from docs/api/UIKit/UICollectionView.xml after inlining docs into source.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
src/UIKit/UICollectionView.cs Enables nullability and updates helper APIs + XML docs for UICollectionView.
src/ObjCRuntime/Class.cs Adjusts Class.GetHandle nullability/behavior to support nullable call sites.
docs/api/UIKit/UICollectionView.xml Deletes DocId sections that are no longer referenced after doc inlining.

Comment on lines 82 to 84
ArgumentNullException.ThrowIfNull (cellType);

RegisterClassForCell (Class.GetHandle (cellType), reuseIdentifier);
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

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

RegisterClassForCell (Type? cellType, NSString reuseIdentifier) declares cellType as nullable and the XML remarks explicitly say callers may pass null to un-register, but the method now throws via ArgumentNullException.ThrowIfNull (cellType). This makes the API contract inconsistent and prevents un-registration. Either allow null by removing the throw (and passing a zero handle), or make cellType non-nullable and update the remarks accordingly.

Suggested change
ArgumentNullException.ThrowIfNull (cellType);
RegisterClassForCell (Class.GetHandle (cellType), reuseIdentifier);
var handle = cellType is null ? System.IntPtr.Zero : Class.GetHandle (cellType);
RegisterClassForCell (handle, reuseIdentifier);

Copilot uses AI. Check for mistakes.
@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [CI Build #b730897] Build passed (Build packages) ✅

Pipeline on Agent
Hash: b73089749f5d7e7944eb440a4e66fc5f7367991c [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [PR Build #b730897] Build passed (Detect API changes) ✅

Pipeline on Agent
Hash: b73089749f5d7e7944eb440a4e66fc5f7367991c [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
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: b73089749f5d7e7944eb440a4e66fc5f7367991c [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@rolfbjarne rolfbjarne enabled auto-merge (squash) February 2, 2026 20:10
@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [CI Build #b730897] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: b73089749f5d7e7944eb440a4e66fc5f7367991c [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #b730897] Tests on macOS X64 - Mac Sonoma (14) passed 💻

All tests on macOS X64 - Mac Sonoma (14) passed.

Pipeline on Agent
Hash: b73089749f5d7e7944eb440a4e66fc5f7367991c [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #b730897] Tests on macOS M1 - Mac Monterey (12) passed 💻

All tests on macOS M1 - Mac Monterey (12) passed.

Pipeline on Agent
Hash: b73089749f5d7e7944eb440a4e66fc5f7367991c [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #b730897] Tests on macOS M1 - Mac Ventura (13) passed 💻

All tests on macOS M1 - Mac Ventura (13) passed.

Pipeline on Agent
Hash: b73089749f5d7e7944eb440a4e66fc5f7367991c [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #b730897] Tests on macOS arm64 - Mac Sequoia (15) passed 💻

All tests on macOS arm64 - Mac Sequoia (15) passed.

Pipeline on Agent
Hash: b73089749f5d7e7944eb440a4e66fc5f7367991c [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #b730897] Tests on macOS arm64 - Mac Tahoe (26) passed 💻

All tests on macOS arm64 - Mac Tahoe (26) passed.

Pipeline on Agent
Hash: b73089749f5d7e7944eb440a4e66fc5f7367991c [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

🚀 [CI Build #b730897] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 120 tests passed 🎉

Tests counts

✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. [attempt 2] 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. [attempt 2] Html Report (VSDrops) Download
✅ generator: All 5 tests passed. [attempt 3] 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: All 44 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ monotouch (iOS): All 9 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 11 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ monotouch (macOS): All 12 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 9 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ msbuild: All 2 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

Pipeline on Agent
Hash: b73089749f5d7e7944eb440a4e66fc5f7367991c [PR build]

@rolfbjarne rolfbjarne merged commit 40cd174 into main Feb 3, 2026
46 checks passed
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.

4 participants