You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Source generator in System.Text.Json does not handle shadowed members correctly #97621
Luckly there is a intesting way to overcome it, chang the line "public string? Region { get; init; }" to "public string? Region { get; set; }", it works again.
Luckly there is a intesting way to overcome it, chang the line "public string? Region { get; init; }" to "public string? Region { get; set; }", it works again.
Yes, this is related to how required and/or init properties are being handled by the source generator. Removing either should result in the duplicate code not being generated.
changed the title [-]Source generator in System.Text.Json fails due to nullability override of property in inheritance[/-][+]Source generator in System.Text.Json does not handle shadowed members correctly[/+]on Jan 29, 2024
ghost added
in-prThere is an active PR which will close this issue when it is merged
Activity
garryxiao commentedon Jan 28, 2024
Luckly there is a intesting way to overcome it, chang the line "public string? Region { get; init; }" to "public string? Region { get; set; }", it works again.
Report bug: dotnet/runtime#97621
eiriktsarpalis commentedon Jan 29, 2024
Presumably you meant to have
PlaceCommon : PlaceBase? I can reproduce the issue.garryxiao commentedon Jan 29, 2024
Sorry, Yes. :)
eiriktsarpalis commentedon Jan 29, 2024
Yes, this is related to how
requiredand/orinitproperties are being handled by the source generator. Removing either should result in the duplicate code not being generated.[-]Source generator in System.Text.Json fails due to nullability override of property in inheritance[/-][+]Source generator in System.Text.Json does not handle shadowed members correctly[/+]