Skip to content

Response is always nullable under generateNullableReferenceTypes? #211

Closed Answered by jods4
jods4 asked this question in Q&A
Discussion options

You must be logged in to vote

I understand your concerns; we had to "fix" this ourselves as well.
I don't see many ways to work around the current codegen: we either use ?. or ! when accessing the response (I guess you could also check x == null).

So I just verified this on SharpLab: none of those patterns warn when the type is changed to a non-nullable reference.

I guess the risk of breaking things is low?

Long term I think this is something worth fixing because when working with nullable reference the current behavior is just annoying and objectively wrong. If you want zero risk you could provide a setting to configure the codegen but that's maintenance burden for you.

Replies: 3 comments 8 replies

Comment options

You must be logged in to vote
3 replies
@jods4
Comment options

@christianhelle
Comment options

@jods4
Comment options

Comment options

You must be logged in to vote
5 replies
@jods4
Comment options

Answer selected by christianhelle
@christianhelle
Comment options

@jods4
Comment options

@christianhelle
Comment options

@jods4
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
enhancement New feature, bug fix, or request question Further information is requested
2 participants