-
Notifications
You must be signed in to change notification settings - Fork 554
[Foundation] Fix nullability in NSObject. #24481
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
Conversation
This is file 43 of 47 files with nullability disabled in Foundation. * Enables nullability. * Removes SupportedOSPlatform attributes without version numbers from NSObject and NSObservedChange classes. * Replaces XML include attributes with inlined content from NSObjectFlag.xml and NSObservedChange.xml. * Removes 'To be added' XML comments with proper documentation. * Adds missing XML documentation for public and protected members. * Improves XML comments for language, grammar, consistency and correctness. * Adds see cref attributes for type and member references. * Removes unnecessary whitespace in XML comments. 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 the NSObject class in Foundation, which is a critical component of the .NET for iOS/Mac/tvOS bindings. The changes ensure proper null safety throughout the Foundation framework by fixing nullability annotations and improving documentation quality.
- Enables
#nullable enablein NSObject2.cs and removes redundant#nullabledirectives throughout the file - Updates method signatures to properly reflect nullable return types (e.g.,
ToString()now returnsstring?) - Improves XML documentation by inlining content from external XML files and replacing "To be added" placeholders with detailed descriptions
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Foundation/NSObject2.cs | Enables nullability, inlines XML documentation from external files, adds comprehensive documentation for NSObjectFlag and NSObservedChange classes, and updates method signatures with proper nullable annotations |
| src/Foundation/NSUrlRequest.cs | Updates ToString() return type to nullable string? to match base class nullability |
| src/Foundation/NSUrl.cs | Updates ToString() return type to nullable string? to match base class nullability |
| src/Foundation/NSString.cs | Adds null-forgiving operator for NSObject.FromObject() call since the result is guaranteed non-null for non-null input |
| src/Foundation/NSSet.cs | Updates Contains() to accept nullable parameters and handle null inputs correctly |
| src/Foundation/NSOrderedSet.cs | Updates Contains() to accept nullable parameters and handle null inputs correctly |
| src/Foundation/NSAction.cs | Updates internal dispatcher classes to accept nullable state parameters |
| src/Foundation/DictionaryContainer.cs | Adds null-forgiving operator for NSObject.FromObject() call in array conversion |
| src/CoreImage/CIDetectorOptions.cs | Adds null-forgiving operators for NSObject.FromObject() calls with value types that cannot be null |
| src/CoreFoundation/CFException.cs | Adds null-coalescing operators to handle nullable ToString() results when populating exception data |
| src/CoreBluetooth/CBUUID.cs | Updates Equals() parameter to accept nullable object? |
| src/AppKit/NSColor.cs | Updates ToString() return type to nullable string? to match base class nullability |
| docs/api/Foundation/NSObservedChange.xml | Removed - content inlined into NSObject2.cs |
| docs/api/Foundation/NSObjectFlag.xml | Removed - content inlined into NSObject2.cs |
| tests/cecil-tests/Documentation.KnownFailures.txt | Removes SetValueForKeyPath(NativeHandle, NSString) from known failures list as it now has proper documentation |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
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 #b257485] Build passed (Build packages) ✅Pipeline on Agent |
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.
This comment has been minimized.
This comment has been minimized.
✅ [CI Build #b257485] Build passed (Build macOS tests) ✅Pipeline on Agent |
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.
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.
✅ [PR Build #b257485] 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 |
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 #b257485] Tests on macOS arm64 - Mac Tahoe (26) passed 💻✅ All tests on macOS arm64 - Mac Tahoe (26) passed. Pipeline on Agent |
🚀 [CI Build #b257485] 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 43 of 47 files with nullability disabled in Foundation.
Contributes towards #17285.