WHIZ070: Missing Pgvector.EntityFrameworkCore Package¶
Verified by tests
VectorDependencyAnalyzerTests, VectorFieldPackageReferenceAnalyzerTests — library CI run #31657041675 (2026-08-13)
Severity: Error Category: Package Reference
Description¶
This error is reported when a property has the [VectorField] attribute but the project does not reference the Pgvector.EntityFrameworkCore package. This package is required for EF Core to map vector columns to PostgreSQL's vector type.
Two analyzers ship this ID, and either (or both) can fire:
VectorDependencyAnalyzer(inWhizbang.Generators) — fires on any property with[VectorField], reported at the attribute's location.VectorFieldPackageReferenceAnalyzer(inWhizbang.Data.EFCore.Postgres.Generators) — fires once per compilation, at compilation end with no source location, when a non-abstract class implementsIPerspectiveFor<TModel, TEvent...>(orIPerspectiveWithActionsFor/IPerspectiveBase) whose model has a[VectorField]property.
Diagnostic Message¶
From VectorDependencyAnalyzer (per property):
Property 'Embedding' uses [VectorField] but Pgvector.EntityFrameworkCore package is not referenced. Add <PackageReference Include="Pgvector.EntityFrameworkCore" Version="0.3.0" /> to your .csproj file.
From VectorFieldPackageReferenceAnalyzer (once per compilation):
Perspective model uses [VectorField] but Pgvector.EntityFrameworkCore package is not referenced. Add <PackageReference Include="Pgvector.EntityFrameworkCore" /> to your project.
Common Causes¶
- Forgot to add package reference - Added
[VectorField]attribute but didn't install the required NuGet package - Package accidentally removed - Package reference was removed during dependency cleanup
- Wrong package - Referenced
Pgvectorbase package but not the EF Core integration package
How to Fix¶
Add the Pgvector.EntityFrameworkCore package reference to your project:
Using .NET CLI¶
Using .NET CLI
Using Package Manager Console¶
Using Package Manager Console
Using PackageReference in .csproj¶
Using PackageReference in .csproj
<ItemGroup>
<PackageReference Include="Pgvector.EntityFrameworkCore" Version="0.3.0" />
</ItemGroup>
Using Central Package Management¶
In Directory.Packages.props:
Using Central Package Management
In your project file:
Using Central Package Management (2)
Code Example¶
Before (causes WHIZ070)¶
Before (causes WHIZ070)
// Missing: <PackageReference Include="Pgvector.EntityFrameworkCore" />
public record ProductDto {
public Guid Id { get; init; }
public string Name { get; init; } = string.Empty;
[VectorField(1536)] // WHIZ070: Package not referenced
public float[]? Embedding { get; init; }
}
After (compiles successfully)¶
After (compiles successfully)
// Added: <PackageReference Include="Pgvector.EntityFrameworkCore" />
public record ProductDto {
public Guid Id { get; init; }
public string Name { get; init; } = string.Empty;
[VectorField(1536)] // Works - package is referenced
public float[]? Embedding { get; init; }
}
Suppressing This Diagnostic¶
If you intentionally want to use [VectorField] without the EF Core package (e.g., for testing or code generation scenarios), add the assembly-level suppression attribute (defined in Whizbang.Core.Perspectives):
Suppressing This Diagnostic
Note: [assembly: SuppressVectorPackageCheck] only silences the perspective-model check in Whizbang.Data.EFCore.Postgres.Generators (WHIZ070 and WHIZ071 from that analyzer). The per-property check in Whizbang.Generators is not affected by the attribute — suppress it with a pragma at the property:
Suppressing This Diagnostic (2)
#pragma warning disable WHIZ070
[VectorField(1536)]
public float[]? Embedding { get; init; }
#pragma warning restore WHIZ070
To silence both analyzers project-wide, set the severity to none in a global analyzer config file (NoWarn does not suppress Error-severity diagnostics, and the compilation-end variant has no source location, so pragmas cannot reach it):
Suppressing This Diagnostic (3)
Why This Matters¶
The Pgvector.EntityFrameworkCore package provides:
- EF Core type mapping - Maps
float[]properties to PostgreSQLvectorcolumns - UseVector() extension - Configures EF Core options for pgvector support
- Query translation - Translates LINQ queries with vector operations to SQL
Without this package, EF Core cannot properly handle vector columns, leading to runtime errors.
Related Diagnostics¶
- WHIZ071 - Missing base Pgvector package (for NpgsqlDataSourceBuilder.UseVector())
See Also¶
- Vector Search - Complete vector search documentation
- VectorField Attribute - Using the VectorField attribute
- Turnkey Setup - Automatic vector configuration