Skip to content

Conversation

@rolfbjarne
Copy link
Member

  • Enabled nullable reference types
  • Made attribute parameters nullable where appropriate
  • Updated null checks to use proper null handling patterns
  • Improved XML documentation:
    • Removed 'To be added.' placeholders
    • Added comprehensive descriptions for all public members
    • Added see cref attributes for related types
    • Fixed formatting and consistency
  • Fixed potential null reference in Append method's ToString() call

This is file 35 of 47 files with nullability disabled in Foundation.

Contributes towards #17285.

- Enabled nullable reference types
- Made attribute parameters nullable where appropriate
- Updated null checks to use proper null handling patterns
- Improved XML documentation:
  - Removed 'To be added.' placeholders
  - Added comprehensive descriptions for all public members
  - Added see cref attributes for related types
  - Fixed formatting and consistency
- Fixed potential null reference in Append method's ToString() call

This is file 35 of 47 files with nullability disabled in Foundation.

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

This PR enables nullable reference types in NSMutableAttributedString as part of a broader effort to add nullability annotations to the Foundation namespace (file 35 of 47). The changes improve type safety by making attributes non-nullable in method parameters where Apple's API doesn't permit null, while allowing nullable attributes in constructors where appropriate. Additionally, comprehensive XML documentation replaces placeholder comments throughout both files.

Key changes:

  • Enabled #nullable enable and removed nullable disable pragma
  • Updated method parameters: made UIKit/CoreText attribute parameters non-nullable in SetAttributes and AddAttributes methods, nullable in constructors
  • Replaced conditional null checks (attrs is null ? null : attrs.Dictionary) with ArgumentNullException.ThrowIfNull pattern
  • Enhanced XML documentation with detailed parameter descriptions and cross-references

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/Foundation/NSMutableAttributedString.iOS.cs Enabled nullable reference types for UIKit-specific overloads; made UIStringAttributes parameters non-nullable in SetAttributes and AddAttributes methods; improved documentation
src/Foundation/NSMutableAttributedString.cs Enabled nullable reference types; made CTStringAttributes non-nullable in methods, nullable in constructors; added null-coalescing operator in Append method; made UIKit styling constructor parameters nullable; improved documentation

@vs-mobiletools-engineering-service2

This comment has been minimized.

@rolfbjarne rolfbjarne enabled auto-merge (squash) December 15, 2025 08:35
@vs-mobiletools-engineering-service2
Copy link
Collaborator

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

Pipeline on Agent
Hash: 6c787abefdacb7539b2ee08ca78226f5d8e099ac [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [CI Build #6c787ab] Build passed (Build packages) ✅

Pipeline on Agent
Hash: 6c787abefdacb7539b2ee08ca78226f5d8e099ac [PR build]

@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: 6c787abefdacb7539b2ee08ca78226f5d8e099ac [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [CI Build #6c787ab] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: 6c787abefdacb7539b2ee08ca78226f5d8e099ac [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

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

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

Pipeline on Agent
Hash: 6c787abefdacb7539b2ee08ca78226f5d8e099ac [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

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

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

Pipeline on Agent
Hash: 6c787abefdacb7539b2ee08ca78226f5d8e099ac [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

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

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

Pipeline on Agent
Hash: 6c787abefdacb7539b2ee08ca78226f5d8e099ac [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

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

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

Pipeline on Agent
Hash: 6c787abefdacb7539b2ee08ca78226f5d8e099ac [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

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

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

Pipeline on Agent
Hash: 6c787abefdacb7539b2ee08ca78226f5d8e099ac [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

🚀 [CI Build #6c787ab] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 119 tests passed 🎉

Tests counts

✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. 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. Html Report (VSDrops) Download
✅ generator: All 5 tests passed. 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. Html Report (VSDrops) Download
✅ monotouch (iOS): All 11 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 11 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 9 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 9 tests passed. 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: 6c787abefdacb7539b2ee08ca78226f5d8e099ac [PR build]

@rolfbjarne rolfbjarne merged commit 5129306 into main Dec 15, 2025
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants