Skip to content

[tools] Enable nullability in the registrars.#24589

Merged
rolfbjarne merged 6 commits intomainfrom
dev/rolf/nullable-registrar
Feb 4, 2026
Merged

[tools] Enable nullability in the registrars.#24589
rolfbjarne merged 6 commits intomainfrom
dev/rolf/nullable-registrar

Conversation

@rolfbjarne
Copy link
Copy Markdown
Member

@rolfbjarne rolfbjarne commented Jan 30, 2026

No description provided.

Copy link
Copy Markdown
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 pull request enables nullable reference types (#nullable enable) across the registrar codebase for .NET for iOS, macOS, tvOS, and Mac Catalyst. The PR is marked as "WIP WIP WIP" indicating it's a work in progress.

Changes:

  • Enables nullability in registrar files (StaticRegistrar.cs, Registrar.cs, DynamicRegistrar.cs)
  • Adds nullable annotations to method signatures and return types throughout the codebase
  • Introduces explicit null checks and error handling where nullability was previously implicit
  • Refactors constructors for ObjCType, ObjCField, ObjCProperty, and related classes to require non-null parameters
  • Adds TryGetEnumUnderlyingType pattern alongside GetEnumUnderlyingType to handle null cases more explicitly
  • Unifies DerivedLinkContext constructor signature across LEGACY_TOOLS and non-LEGACY_TOOLS builds
  • Adds LinkerConfiguration parameter to Application constructor

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tools/mtouch/LinkerConfiguration.cs New empty LinkerConfiguration class for LEGACY_TOOLS compatibility
tools/mtouch/mtouch.cs Updated to pass LinkerConfiguration to Application constructor
tools/mtouch/mtouch.csproj Added LinkerConfiguration.cs to compilation
tools/dotnet-linker/LinkerConfiguration.cs Removed Application(LinkerConfiguration) constructor, moved to Application.cs
tools/dotnet-linker/Compat.cs Removed duplicate Application constructor
tools/dotnet-linker/Steps/ManagedRegistrarStep.cs Added null checks for BindAsAttribute.OriginalType and constrained types
tools/linker/MobileExtensions.cs Added nullable annotations to DerivedLinkContext parameters
tools/common/Target.cs Made LinkContext non-nullable for non-LEGACY_TOOLS, simplified GetLinkContext()
tools/common/Application.cs Updated constructor to take LinkerConfiguration and initialize LinkContext for non-LEGACY_TOOLS
tools/common/DerivedLinkContext.cs Unified constructor to always take LinkerConfiguration parameter
tools/common/StaticRegistrar.cs Major nullability enablement with comprehensive nullable annotations and null checks
tools/common/ErrorHelper.tools.cs Added nullable annotations to all error creation methods
src/ObjCRuntime/Registrar.cs Core registrar with full nullable annotations, new TryGetEnumUnderlyingType method, updated constructors
src/ObjCRuntime/Registrar.core.cs Added NotNullIfNotNull attributes and null-safety checks to helper methods
src/ObjCRuntime/DynamicRegistrar.cs Full nullable annotations, TryGetEnumUnderlyingType implementation
src/ObjCRuntime/Class.cs Added null-forgiving operator for Marshal.PtrToStringAuto

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ [CI Build #18c16b0] Build passed (Build packages) ✅

Pipeline on Agent
Hash: 18c16b0794963c7fe70b381bf01ffdcc18b4b226 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

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

Pipeline on Agent
Hash: 18c16b0794963c7fe70b381bf01ffdcc18b4b226 [PR build]

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

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ [CI Build #18c16b0] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: 18c16b0794963c7fe70b381bf01ffdcc18b4b226 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

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

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

Pipeline on Agent
Hash: 18c16b0794963c7fe70b381bf01ffdcc18b4b226 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

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

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

Pipeline on Agent
Hash: 18c16b0794963c7fe70b381bf01ffdcc18b4b226 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

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

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

Pipeline on Agent
Hash: 18c16b0794963c7fe70b381bf01ffdcc18b4b226 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

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

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

Pipeline on Agent
Hash: 18c16b0794963c7fe70b381bf01ffdcc18b4b226 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

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

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

Pipeline on Agent
Hash: 18c16b0794963c7fe70b381bf01ffdcc18b4b226 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

🚀 [CI Build #18c16b0] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 124 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. [attempt 2] Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ introspection: All 4 tests passed. [attempt 2] 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. [attempt 2] Html Report (VSDrops) Download
✅ monotouch (macOS): All 12 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 11 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: 18c16b0794963c7fe70b381bf01ffdcc18b4b226 [PR build]

@rolfbjarne rolfbjarne marked this pull request as ready for review February 3, 2026 11:56
@rolfbjarne rolfbjarne enabled auto-merge (squash) February 3, 2026 11:57
@rolfbjarne rolfbjarne merged commit 800c7d1 into main Feb 4, 2026
46 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