AutoInject's generated code warns CS8669 for nullable members

Open
#13,685 0 comments 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@msynk is already working on this.

Since Oct 5, 2026.

Assessment

This issue has not been assessed yet.

Description

area / source generators

When a component injects a nullable member with [AutoInject], for example [AutoInject] IServiceProvider? serviceProvider in bit Boilerplate's Routes.razor.cs, the code the AutoInject source generator emits keeps the ? annotation but has no #nullable enable directive. Every build of such a project then reports:

warning CS8669: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.

Every project generated from bit Boilerplate shows it, on Routes_autoInject.g.cs.

Expected: the generated code builds without warnings for nullable members.

Dominant language
C#
Stars
1.4k
Forks
264
Avg merge
7h 38m
Merged PRs (30d)
544

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from bitfoundation/bitplatform

All issues in bitfoundation/bitplatform

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.