Skip to content

[bgen] Enable nullability everywhere.#25023

Merged
rolfbjarne merged 6 commits intomainfrom
dev/rolf/nullability-bgen
Apr 1, 2026
Merged

[bgen] Enable nullability everywhere.#25023
rolfbjarne merged 6 commits intomainfrom
dev/rolf/nullability-bgen

Conversation

@rolfbjarne
Copy link
Copy Markdown
Member

And fix any resulting issues.

Also add a convenience make target to build bgen.

Contributes towards #17285.

And fix any resulting issues.

Also add a convenience make target to build bgen.
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 PR enables nullable reference types across the bgen tool and adjusts the generator/tooling code to compile cleanly under #nullable enable, while also adding Makefile convenience targets to build/install bgen (part of the work toward #17285).

Changes:

  • Enabled #nullable enable in key bgen sources and updated signatures/annotations to reflect nullability.
  • Added/refactored helper APIs (e.g., TryCanRead/TryCanWrite/TryIsArray/..., GetOne*Attribute helpers) to reduce nullable warnings and tighten invariants.
  • Added bgen / install-bgen targets and factored DOTNET_BGEN_TARGETS in src/Makefile.generator.

Reviewed changes

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

Show a summary per file
File Description
src/bgen/TypeManager.cs Updated nullability of type-formatting helpers and related APIs.
src/bgen/Nomenclator.cs Adjusted attribute lookup to nullable result.
src/bgen/Models/TrampolineInfo.cs Made trampoline parameter names nullable to satisfy nullable flow.
src/bgen/Models/MemberInformation.cs Nullability fixes in member metadata processing/casts.
src/bgen/Models/AsyncMethodInfo.cs Allowed nullable category extension type in ctor signature.
src/bgen/Generator.cs Broad nullability enablement + many flow tweaks and new “GetOne*” helpers.
src/bgen/Filters.cs Added explicit null checks for required attributes; adjusted method signature.
src/bgen/Extensions/StringExtensions.cs Made casing helpers null-safe + added nullability annotations.
src/bgen/Extensions/ExtensionMethods.cs Added reflection/type helper Try* methods and nullability changes.
src/bgen/Enums.cs Nullability enablement and safer dictionary lookups.
src/bgen/BindingTouch.cs Null-forgiving for temp dir after initialization flow.
src/bgen/Attributes.cs Enabled nullability and made multiple attribute properties nullable.
src/bgen/AttributeManager.cs Enabled nullability and added GetOneCustomAttribute helper.
src/Makefile.generator Added bgen/install-bgen targets and split bgen targets variable.

@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.

GitHub Actions Autoformatter and others added 2 commits March 26, 2026 12:50
The nullability changes accidentally dropped the 'virtual' keyword
from GetCustomAttribute<T>, which broke Moq-based tests that mock
this method.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@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.

@rolfbjarne rolfbjarne marked this pull request as ready for review March 30, 2026 07:06
@rolfbjarne rolfbjarne enabled auto-merge (squash) March 30, 2026 07:06
@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

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

Pipeline on Agent
Hash: f0eb34f8f752c0ab7bcec787b27c3af36d6c0025 [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: f0eb34f8f752c0ab7bcec787b27c3af36d6c0025 [PR build]

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

✅ [CI Build #f0eb34f] Build passed (Build packages) ✅

Pipeline on Agent
Hash: f0eb34f8f752c0ab7bcec787b27c3af36d6c0025 [PR build]

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

✅ [CI Build #f0eb34f] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: f0eb34f8f752c0ab7bcec787b27c3af36d6c0025 [PR build]

@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 #f0eb34f] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 156 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. [attempt 2] 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. [attempt 2] Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. [attempt 3] 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 6 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ linker: All 44 tests passed. [attempt 3] Html Report (VSDrops) Download
✅ monotouch (iOS): All 11 tests passed. [attempt 3] Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 15 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ monotouch (macOS): All 12 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ monotouch (tvOS): All 11 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ sharpie: All 1 tests passed. [attempt 2] 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

macOS tests

✅ Tests on macOS Monterey (12): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Ventura (13): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Sonoma (14): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Sequoia (15): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Tahoe (26): All 5 tests passed. Html Report (VSDrops) Download

Linux Build Verification

Linux build succeeded

Pipeline on Agent
Hash: f0eb34f8f752c0ab7bcec787b27c3af36d6c0025 [PR build]

@rolfbjarne rolfbjarne merged commit d0d53e8 into main Apr 1, 2026
48 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