Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

emit #nullable enable pragma in generated C# code #1196

@robinei

Description

@robinei

Right now the bond-generated C# code allows null references for all reference types.

This is because all generated code is excluded from nullability analysis and references are implicitly treated as nullable (<Nullable>enable</Nullable> in the .csproj does not apply to generated code). The reason for this is to not break code generators.

The intention is that code generators should opt in using the #nullable enable pragma at the top of emitted files. The bond compiler should do this, otherwise non-nullability does not apply.

This should be enabled with a command line option to the bond compiler. And possibly picked up from a property in the project settings (for the project that has and compiles the bondfile).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions