Skip to content

Skip null checks on required navigations and AsNoTracking before Select - #1428

Merged
SimonCropp merged 1 commit into
mainfrom
fix-verify-ef-beta7
Oct 2, 2026
Merged

SimonCropp merged 1 commit into
mainfrom
fix-verify-ef-beta7

Conversation

@SimonCropp

Copy link
Copy Markdown
Owner

Fixes the main build failing after the bump to Verify.EntityFramework 16.0.0-beta.7, which flags two query patterns the library generated:

  • A null check on a required navigation (_.BaseEntity == null), which EF translates to 0 = 1. The select projection now skips the check when the EF model marks the navigation required (NavigationReader.IsRequired). The flag is carried through NavigationProjectionInfo, including on the filter requirement path.
  • AsNoTracking() followed by Select, which has no effect. IncludeAppender.ApplyProjection now takes disableTracking and only applies AsNoTracking when it adds no Select.

Navigation gains an optional IsRequired parameter, which is a small public API addition.

There are 9 snapshot updates. Each one only removes a redundant null-check column from the SQL; the returned data is unchanged. The full test suite passes locally.

Verify.EntityFramework 16.0.0-beta.7 flags both patterns:
- a null check on a required navigation, which EF translates to an always false comparison
- AsNoTracking followed by Select, which has no effect

Required-ness comes from the EF model. AsNoTracking now applies only when ApplyProjection adds no Select.
@SimonCropp SimonCropp added this to the 35.3.5 milestone Oct 2, 2026
@SimonCropp
SimonCropp merged commit cb74b61 into main Oct 2, 2026
5 checks passed
@SimonCropp
SimonCropp deleted the fix-verify-ef-beta7 branch October 2, 2026 09:00
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.

1 participant