Neon.EntityFrameworkCore.Analyzers 4.0.21

dotnet add package Neon.EntityFrameworkCore.Analyzers --version 4.0.21
                    
NuGet\Install-Package Neon.EntityFrameworkCore.Analyzers -Version 4.0.21
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Neon.EntityFrameworkCore.Analyzers" Version="4.0.21" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Neon.EntityFrameworkCore.Analyzers" Version="4.0.21" />
                    
Directory.Packages.props
<PackageReference Include="Neon.EntityFrameworkCore.Analyzers" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Neon.EntityFrameworkCore.Analyzers --version 4.0.21
                    
#r "nuget: Neon.EntityFrameworkCore.Analyzers, 4.0.21"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Neon.EntityFrameworkCore.Analyzers@4.0.21
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Neon.EntityFrameworkCore.Analyzers&version=4.0.21
                    
Install as a Cake Addin
#tool nuget:?package=Neon.EntityFrameworkCore.Analyzers&version=4.0.21
                    
Install as a Cake Tool

Neon.EntityFrameworkCore.Analyzers

Roslyn analyzers for Entity Framework Core queries.

NEONEFC0001 — EF Core query should be tagged with its call site

EF Core's TagWithCallSite() prefixes the generated SQL with the source file and line the query was written on:

-- file: C:\Work\MyService\UserRepository.cs:42

SELECT u."Id", u."Name" FROM "Users" AS u WHERE u."Active"

That comment is what turns a slow query sitting in a database log into a line of code you can open. This rule reports EF Core queries that are executed without it.

// NEONEFC0001

var users = await context.Users
    .Where(user => user.Active)
    .ToListAsync(cancellationToken);

// OK

var users = await context.Users
    .TagWithCallSite()
    .Where(user => user.Active)
    .ToListAsync(cancellationToken);

The tag may appear anywhere in the chain, including on a query built up across several methods, so factoring a query out into a helper that tags it satisfies the rule at every call site that composes on top of it.

Where the rule stays quiet

It only fires where the tag can actually be applied and would actually reach the database:

  • The compilation must reference an EF Core that offers TagWithCallSite() (EF Core 6.0 or later).
  • The query must trace back to a DbSet<T> or DbContext.Set<T>(). A query the analyzer cannot follow to a root — one handed in as an IQueryable<T> parameter, say — is left alone rather than guessed at.
  • Queries composed inside an expression tree are skipped. They are translated as part of the enclosing query, which is where the tag belongs.
  • LINQ over in-memory sequences is not EF Core's business and is never reported.

Configuration

Add this to .editorconfig to accept a TagWith() call in place of TagWithCallSite():

neon_efcore_tag_with_call_site_allow_tag_with = true

The rule's severity is set the usual way:

dotnet_diagnostic.NEONEFC0001.severity = suggestion
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.21 98 9/11/2026
4.0.21-preview.0 70 9/9/2026