Skip to content
Discussion options

You must be logged in to vote

We recently met and discussed how to alleviate issues we've found with the [AllowNull] string s parameter scenario. Our proposal is to modify the rules for nullable argument analysis as follows:

  • An input parameter doesn't update the argument state after the call based on its declared type.
  • When we give a safety warning on an argument, we update the argument state to not-null.

Discussion

AllowNull/DisallowNull and MaybeNull/NotNull were initially designed with an emphasis on the respective concepts of "input state" and "output state" of members and parameters. However, we found that in the absence of T?, developers used [AllowNull] a stand-in for T? on input parameters. For example, the J…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@RikkiGibson
Comment options

RikkiGibson Nov 13, 2020
Maintainer Author

@RikkiGibson
Comment options

RikkiGibson Nov 23, 2020
Maintainer Author

Answer selected by RikkiGibson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant