fix: recognise applied AutoInclude in LC045#303
Conversation
Follow exact source-visible IEntityTypeConfiguration applications while preserving conservative invalidation for conditional, runtime, helper, disablement, and lookalike paths.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 21afb4738f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review Please review the current head |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f6f0fa84bc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review Please review current head |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 226e23933e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review Please review current head |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1323049523
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review Please review current head |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d4f471f2ee
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review Please review current head |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7f48532c16
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review Please review current head |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5a4116574a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review Please review current head |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5976c030bf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review Please review current head |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d02cbec06d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review Please review current head |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f5dcbe6f76
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review Please review current head |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 61921ab225
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review Please review current head |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d2edc262a9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if ( | ||
| configurationArgument?.Value.UnwrapConversions() | ||
| is not IObjectCreationOperation configurationCreation | ||
| || configurationCreation.Arguments.Length != 0 |
There was a problem hiding this comment.
Reject applied configurations with object initializers
When ApplyConfiguration receives new Config { Builder = modelBuilder.Entity<Order>() }, this check accepts it because the constructor has zero arguments. The initializer's property setter can call AutoInclude(false) before an otherwise empty Configure; TryApplyConfigurationAutoIncludes then returns true without clearing an earlier enable, so LC045 is suppressed even though the final model disables eager loading. Require the object creation to have no initializer, or analyze the initializer's effects.
Useful? React with 👍 / 👎.
| } | ||
|
|
||
| foreach ( | ||
| var invocationSyntax in syntax.DescendantNodes().OfType<InvocationExpressionSyntax>() |
There was a problem hiding this comment.
Inspect implicit collection-initializer calls
When Configure evaluates a custom collection initializer such as new BuilderSink { builder }, Roslyn represents Add(builder) as an implicit invocation without an InvocationExpressionSyntax, so this syntax-only loop never validates it. A user-defined Add can call AutoInclude(false) after the recorded enable, leaving LC045 incorrectly suppressed; traverse invocation operations in the complete operation tree, including implicit calls.
Useful? React with 👍 / 👎.
| operation is IConversionOperation { OperatorMethod: not null } conversion | ||
| && ReferencesParameter( | ||
| conversion.Operand, | ||
| builderParameter, | ||
| cancellationToken | ||
| ) | ||
| ) |
There was a problem hiding this comment.
Reject other user-defined operators on the builder
When Configure uses an overloaded operator such as var ignored = builder + new Mutator();, the operator can disable the navigation but appears as an IBinaryOperation with an OperatorMethod, not as a conversion or invocation syntax. This scan therefore retains a preceding enable and can suppress LC045 incorrectly; treat all user-defined operator operations consuming the builder as unproven boundaries.
Useful? React with 👍 / 👎.
Summary
ApplyConfiguration(new TConfiguration())AutoInclude evidence for LC045Navigationpaths while preserving final fluentAutoIncludeorderingTDD evidence
Verification
dotnet test tests/LinqContraband.Tests/LinqContraband.Tests.csproj --framework net10.0 --no-restore— 2,293/2,293Meaningful improvement
Configuration classes are the standard way many EF Core projects organise models. LC045 can now distinguish proven model-level eager loading from a real missing Include without weakening its conservative false-negative boundaries.