-
Notifications
You must be signed in to change notification settings - Fork 554
[Foundation] Fix nullability in NSDictionary. #24478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Foundation] Fix nullability in NSDictionary. #24478
Conversation
This is file 42 of 47 files with nullability disabled in Foundation.
* Enabled nullable reference types.
* Made ObjectForKey return nullable TValue? since keys may not exist.
* Made TryGetValue parameter nullable with NotNullWhen(true) attribute.
* Kept IDictionary interface implementations non-nullable per .NET contract.
* Replaces 'To be added' XML comments with proper documentation.
* Verifies and improves XML comments for language, grammar, consistency and correctness.
* Adds see cref attributes for type references.
* Removes unnecessary whitespace in XML comments.
* Fixes typos ('pais' -> 'pairs').
* Updates System.Object references to use simpler 'object' syntax.
Contributes towards #17285.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR enables nullable reference types for NSDictionary and significantly improves its XML documentation as part of the ongoing effort to add nullability to Foundation types (issue #17285).
Key changes:
- Enabled nullable reference types throughout the file by adding
#nullable enableat the top - Made
ObjectForKeyreturnNSObject?to reflect that keys may not exist in the dictionary - Updated
TryGetValueto use[NotNullWhen(true)]attribute for better nullable semantics - Replaced placeholder "To be added" XML comments with comprehensive, accurate documentation
- Fixed typo "pais" → "pairs" in documentation
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Foundation/NSDictionary.cs | Enables nullable reference types, improves TryGetValue nullability semantics with NotNullWhen attribute, replaces placeholder documentation with detailed XML comments, fixes spelling errors, and adds proper see cref attributes for type references |
| src/VideoToolbox/VTVideoEncoder.cs | Updates TryGetValue call to use explicit type parameter syntax compatible with the new generic method signature |
✅ [PR Build #11cb476] Build passed (Detect API changes) ✅Pipeline on Agent |
✅ [CI Build #11cb476] Build passed (Build packages) ✅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 #11cb476] Build passed (Build macOS tests) ✅Pipeline on Agent |
💻 [CI Build #11cb476] Tests on macOS X64 - Mac Sonoma (14) passed 💻✅ All tests on macOS X64 - Mac Sonoma (14) passed. Pipeline on Agent |
💻 [CI Build #11cb476] Tests on macOS M1 - Mac Monterey (12) passed 💻✅ All tests on macOS M1 - Mac Monterey (12) passed. Pipeline on Agent |
💻 [CI Build #11cb476] Tests on macOS arm64 - Mac Sequoia (15) passed 💻✅ All tests on macOS arm64 - Mac Sequoia (15) passed. Pipeline on Agent |
💻 [CI Build #11cb476] Tests on macOS M1 - Mac Ventura (13) passed 💻✅ All tests on macOS M1 - Mac Ventura (13) passed. Pipeline on Agent |
💻 [CI Build #11cb476] 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 #11cb476] Test results 🚀Test results✅ All tests passed on VSTS: test results. 🎉 All 119 tests passed 🎉 Tests counts✅ cecil: All 1 tests passed. [attempt 2] Html Report (VSDrops) Download Pipeline on Agent |
This is file 42 of 47 files with nullability disabled in Foundation.
Contributes towards #17285.