-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
System.Text.Json source generator produces nullability warnings for NRT properties #59464
Comments
Tagging subscribers to this area: @eiriktsarpalis, @layomia Issue DetailsDescriptionThe System.Text.Json source generator produces nullability warnings (CS8260, and CS8604) during a build. using System.Text.Json.Serialization;
Console.WriteLine("JSON Source Generator test");
public class Class
{
public Uri? NullableUri { get; set; }
public byte[]? ByteArray { get; set; }
}
[JsonSourceGenerationOptions(PropertyNamingPolicy = JsonKnownNamingPolicy.CamelCase)]
[JsonSerializable(typeof(Class))]
internal partial class Context : JsonSerializerContext
{
} The above code produces 2 warnings:
ImpactThis breaks CI builds set up to fail if there are any warnings present in the project. Are there any workarounds that can be done in the meantime, other than disabling the warnings in CI builds? Configuration.NET Version: NET 6 RC1
|
I see https://github.com/dotnet/roslyn/blob/main/docs/compilers/CSharp/Nullability%20Public%20API%20Design%20Notes.md that describes this API in roslyn. Presumably the serializer isn't really doing anything different for nullable annotated types today since it wasn't observing that. |
Description
The System.Text.Json source generator produces nullability warnings (CS8260, and CS8604) during a build.
The above code produces 2 warnings:
Runnable repro here.
Impact
This breaks CI builds set up to fail if there are any warnings present in the project.
Are there any workarounds that can be done in the meantime, other than disabling the warnings in CI builds?
Configuration
.NET Version: NET 6 RC1
The text was updated successfully, but these errors were encountered: