[UIKit] Enable nullability and clean up UIAccessibility.#24568
[UIKit] Enable nullability and clean up UIAccessibility.#24568rolfbjarne merged 2 commits intomainfrom
Conversation
This is file 1 of 30 files with nullability disabled in UIKit. * Enable nullability (#nullable enable). * Remove redundant [SupportedOSPlatform] attributes (groups of 4 without version numbers and no [UnsupportedOSPlatform] or [ObsoletedOSPlatform] attributes). * Use ArgumentNullException.ThrowIfNull() instead of manual null checks. * Add nullable annotations (NSObject?, UIView?). * Improve XML documentation comments: remove 'To be added.' placeholders, fix typos, add missing docs, add 'see cref' references, fix formatting. Contributes towards #17285.
There was a problem hiding this comment.
Pull request overview
This pull request enables nullable reference types and improves documentation for the UIAccessibility class in UIKit, which is the first of 30 files requiring nullability updates.
Changes:
- Enabled nullable reference types (#nullable enable) for the UIAccessibility.cs file
- Added nullable annotations to method parameters and return types (NSObject?, UIView?)
- Replaced manual null checks with ArgumentNullException.ThrowIfNull() for better consistency
- Removed redundant [SupportedOSPlatform] attributes from individual members (now inherited from class/enum level)
- Added comprehensive XML documentation for properties and methods, removing "To be added" placeholders
- Removed five properties from Documentation.KnownFailures.txt after adding proper documentation
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/cecil-tests/Documentation.KnownFailures.txt | Removed 5 UIAccessibility property documentation warnings that have now been resolved with proper XML comments |
| src/UIKit/UIAccessibility.cs | Enabled nullability, added platform attributes to enums and class, added nullable annotations to parameters/returns, improved XML documentation, replaced manual null checks with ArgumentNullException.ThrowIfNull(), removed redundant platform attributes from class members, and removed partial keyword from class declaration |
| public static NSObject? FocusedElement (string assistiveTechnologyIdentifier) | ||
| { | ||
| using (var s = new NSString (assistiveTechnologyIdentifier)) | ||
| return Runtime.GetNSObject (UIAccessibilityFocusedElement (s.Handle)); | ||
| } |
There was a problem hiding this comment.
The assistiveTechnologyIdentifier parameter should have a null check. Since the method creates an NSString from it, passing null would cause an exception. Consider adding ArgumentNullException.ThrowIfNull (assistiveTechnologyIdentifier); at the beginning of the method.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ [CI Build #ab23bef] Build passed (Build packages) ✅Pipeline on Agent |
✅ [PR Build #ab23bef] Build passed (Detect API changes) ✅Pipeline on Agent |
✅ API diff for current PR / commitNET (empty diffs)✅ API diff vs stableNET (empty diffs)ℹ️ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes) Pipeline on Agent |
✅ [CI Build #ab23bef] Build passed (Build macOS tests) ✅Pipeline on Agent |
💻 [CI Build #ab23bef] Tests on macOS X64 - Mac Sonoma (14) passed 💻✅ All tests on macOS X64 - Mac Sonoma (14) passed. Pipeline on Agent |
💻 [CI Build #ab23bef] Tests on macOS M1 - Mac Monterey (12) passed 💻✅ All tests on macOS M1 - Mac Monterey (12) passed. Pipeline on Agent |
💻 [CI Build #ab23bef] Tests on macOS arm64 - Mac Sequoia (15) passed 💻✅ All tests on macOS arm64 - Mac Sequoia (15) passed. Pipeline on Agent |
💻 [CI Build #ab23bef] Tests on macOS M1 - Mac Ventura (13) passed 💻✅ All tests on macOS M1 - Mac Ventura (13) passed. Pipeline on Agent |
💻 [CI Build #ab23bef] Tests on macOS arm64 - Mac Tahoe (26) passed 💻✅ All tests on macOS arm64 - Mac Tahoe (26) passed. Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
🚀 [CI Build #ab23bef] Test results 🚀Test results✅ All tests passed on VSTS: test results. 🎉 All 117 tests passed 🎉 Tests counts✅ cecil: All 1 tests passed. Html Report (VSDrops) Download Pipeline on Agent |
This is file 1 of 30 files with nullability disabled in UIKit.
Contributes towards #17285.