trampster / JsonSrcGen

Json library that uses .NET 5 Source Generators
MIT License
148 stars 4 forks source link

NullableReferenceTypes cause warnings/errors #41

Closed trampster closed 3 years ago

trampster commented 3 years ago

If you have nullable reference types on in the consuming project then the generated code creates warnings.

trampster commented 3 years ago

Fix warnings caused by the generated code itself but annotation all the generated code.

However there is no way to tell for sure from a source generator if the consuming type is nullable or not. See https://github.com/dotnet/roslyn/issues/49555

This means that for now all generated code is nullalbe, and if you use a non nullalbe type you will get a warning.