Skip to content
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

Evolve null-checking approach #26459

Merged
merged 1 commit into from
Oct 28, 2021
Merged

Evolve null-checking approach #26459

merged 1 commit into from
Oct 28, 2021

Conversation

ajcvickers
Copy link
Member

Part of #19233

Removes a lot of null checks from code that is not intended to be called directly by application code.

@ajcvickers ajcvickers requested a review from a team October 25, 2021 17:51
@ajcvickers
Copy link
Member Author

@AndriySvyryd @smitpatel @maumar @bricelam @roji Sending this out with only changes to the Cosmos provider for now to make sure people get a chance to provide feedback before I do more. We discussed this a couple of years ago, so it would be good to validate that we still want to do this.

@ajcvickers
Copy link
Member Author

@dotnet/efteam Today is your last chance to look at this before I merge and continue with more of the codebase.

Part of #19233

Removes a lot of null checks from code that is not intended to be called directly by application code.
Copy link
Member

@roji roji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of the removals seem a bit user-facing to me; shouldn't we just remove null checks from private/internal/pubternal APIs?

Note that C# 10 almost got "simplified parameter null validation"; if this comes back in C# 11, the check would be as simple as a single bang after the parameter name (so less incentive to go remove it).

But am OK as-is as well.

@@ -37,7 +37,6 @@ public static class CosmosEntityTypeBuilderExtensions
this EntityTypeBuilder entityTypeBuilder,
string? name)
{
Check.NotNull(entityTypeBuilder, nameof(entityTypeBuilder));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this a pretty user-facing API? Or did we say we don't care about checking null "this" for extension methods?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this for this.

@ajcvickers ajcvickers merged commit 90f0808 into main Oct 28, 2021
@ajcvickers ajcvickers deleted the NotYourDaddysNulls1025 branch October 28, 2021 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants