Bond is a cross-platform framework for working with schematized data. It supports cross-language de/serialization and powerful generic mechanisms for efficiently manipulating data. Bond is broadly used at Microsoft in high scale services.
MIT License
2.61k
stars
321
forks
source link
emit #nullable enable pragma in generated C# code #1196
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).
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).