LinqContraband analyzer diagnostics shown beside EF Core query code

EF Core LINQ analyzer

LinqContraband

Catch costly query shapes at compile time: N+1 loops, premature materialization, raw SQL risks, sync-over-async calls, tracking mistakes, and missing includes.

  • 45compile-time EF Core rules
  • 0runtime dependency in your app
  • MITopen source and source linked

What it catches

Query bugs that usually wait until production.

LinqContraband turns EF Core review knowledge into analyzer diagnostics that show up in the IDE and CI while the code is still cheap to change.

N+1 and loading traps

Find database calls inside loops, missing includes, deep eager-loading chains, cartesian explosion risks, and untagged complex queries.

Translation failures

Catch local methods, string conversions, untranslatable overloads, nondeterministic pagination, and query shapes EF Core cannot safely move to SQL.

Security and tracking mistakes

Flag interpolated raw SQL, constructed SQL strings, query-filter bypasses, mixed tracking modes, and silent no-tracking writes.

Install

Add the analyzer, keep the runtime clean.

LinqContraband runs during compilation in Visual Studio, Rider, VS Code, and CI. Your application does not load it at runtime.

dotnet add package LinqContraband

Official reference

Everything points back to the canonical project.

The package is distributed through NuGet and the official GitHub repository. LinqContraband is not shipped as a standalone ZIP installer or executable.