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

Nullability in TrackGraph signature #27257

Closed
sjb-sjb opened this issue Jan 24, 2022 · 1 comment · Fixed by #27261
Closed

Nullability in TrackGraph signature #27257

sjb-sjb opened this issue Jan 24, 2022 · 1 comment · Fixed by #27261
Assignees
Labels
area-change-tracking closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. customer-reported type-bug
Milestone

Comments

@sjb-sjb
Copy link

sjb-sjb commented Jan 24, 2022

A very very minor issue for cleanup whenever convenient.

The type of TrackGraph is

public virtual void TrackGraph<TState> (object rootEntity, TState? state,  Func<EntityEntryGraphNode<TState>,bool> callback);

The callback however should have the argument type annotated with ?,

Func<EntityEntryGraphNode<TState?>, bool> callback

so that the ability to pass null into TrackGraph will be matched by the ability of the callback to accept null as the state arg.

Workaround: specify TState? explicitly as the type argument to TrackGraph.

@roji
Copy link
Member

roji commented Jan 24, 2022

I think we need to do the opposite, i.e. remove the question mark on the state parameter. Since this is an unconstrained generic parameter, you can pass any type to it (including nullable).

@roji roji self-assigned this Jan 24, 2022
@roji roji added the type-bug label Jan 24, 2022
roji added a commit to roji/efcore that referenced this issue Jan 24, 2022
@roji roji added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Jan 24, 2022
@ghost ghost closed this as completed in #27261 Jan 25, 2022
ghost pushed a commit that referenced this issue Jan 25, 2022
@ajcvickers ajcvickers added this to the 7.0.0 milestone Jan 25, 2022
@ajcvickers ajcvickers modified the milestones: 7.0.0-preview2, 7.0.0 Nov 5, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-change-tracking closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. customer-reported type-bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants