csharp Errors
132 error patterns
AOT unsupported type usage
Type '.*' is not supported by the AOT compiler
- •Replace with AOT-compatible type
- •Add [DynamicallyAccessedMembers] attribute
Trimming unsafe code detected
Trim analysis warning IL2026.*RequiresUnreferencedCode
- •Add [UnconditionalSuppressMessage]
- •Replace reflection with source generators
Minimal API DI failure
No service for type '.*' has been registered
- •Register service in Program.cs
- •Check service lifetime
Minimal API body binding failure
Failed to read parameter.*from the request body
- •Add [FromBody] attribute
- •Ensure Content-Type is application/json
JSON property name collision
JSON property name for '.*' collides with another
- •Use [JsonPropertyName]
- •Rename conflicting properties
JSON deserialization type mismatch
JSON value could not be converted to
- •Add custom JsonConverter
- •Match JSON value to CLR type
Service activation missing dependency
Unable to resolve service.*while attempting to activate
- •Register all dependencies
- •Check for circular dependencies
Blazor component not found
Cannot find component type '.*'
- •Add @using directive
- •Register in _Imports.razor
Blazor incompatible render mode
Render mode '.*' is not compatible with the parent
- •Match child render mode to parent
- •Use consistent InteractiveServer/WebAssembly
Blazor circuit disconnected
circuit.*has been disconnected
- •Implement reconnection handler
- •Add CircuitHandler service
Blazor JS interop after disconnect
JavaScript interop calls cannot be issued
- •Check CircuitState before JS interop
- •Wrap in try-catch for JSDisconnectedException
Blazor EditForm missing model
EditForm requires either a Model or an EditContext
- •Provide Model parameter
- •Create EditContext manually
Blazor event handler not found
no event handler.*for this event
- •Ensure @on* handler method exists
- •Check for typos in callback name
Blazor JS function not found
Could not find '.*' in 'window'
- •Ensure JS file loaded before interop
- •Register JS module with correct path
Blazor cascading parameter missing
Cannot provide a value for property.*no cascading parameter
- •Wrap tree with CascadingValue
- •Add [SupplyParameterFromQuery]
EF Core duplicate key violation
Cannot insert duplicate key
- •Check for existing entity before insert
- •Use AddOrUpdate pattern
EF Core missing primary key
entity type '.*' requires a primary key
- •Add [Key] attribute
- •Configure HasKey() in OnModelCreating
EF Core navigation not configured
not a navigation property of entity type
- •Configure relationship in OnModelCreating
- •Add navigation property with FK
EF Core 8 complex type with key
Complex type.*cannot have a key
- •Remove [Key] from complex type
- •Use ComplexProperty() without key
EF Core 8 complex type as entity
Complex type '.*' cannot be used as an entity
- •Use ComplexProperty<T>() configuration
- •Remove DbSet<T> for complex types
EF Core unmapped property
Property '.*' on entity type '.*' is unmapped
- •Add [NotMapped] attribute
- •Configure Ignore() in OnModelCreating
EF Core property vs navigation conflict
cannot be used as a property.*configured as a navigation
- •Separate FK from navigation property
- •Configure relationship explicitly
EF Core TPH discriminator conflict
discriminator property.*cannot be mapped to a different column
- •Use HasDiscriminator() consistently
- •Use same discriminator column across hierarchy
EF Core TPT missing table mapping
part of a hierarchy.*must also be mapped to a table
- •Add ToTable() for each derived type
- •Use UseTptMappingStrategy()
EF Core compiled query stale
compiled query.*has become stale
- •Rebuild compiled query after model changes
- •Don't modify DbContext after compilation
EF Core compiled query closure
Cannot create a compiled query.*closure
- •Pass parameters as method arguments
- •Use explicit parameter types
SignalR unauthorized hub invocation
Failed to invoke '.*' because user is unauthorized
- •Add [Authorize] to hub/method
- •Pass JWT in connection query string
SignalR send on disconnected connection
Connection.*is not in the Connected state
- •Check connection state before sending
- •Use WithAutomaticReconnect()
SignalR connection aborted
connection was aborted.*SignalR
- •Increase KeepAliveInterval
- •Implement IHubLifetimeManager
SignalR Redis backplane failure
RedisConnectionException.*SignalR backplane
- •Verify Redis connection string
- •Configure retry policy in Redis options
gRPC deadline exceeded
StatusCode=.*DeadlineExceeded
- •Increase deadline in CallOptions
- •Optimize server processing time
gRPC service unavailable
StatusCode=.*Unavailable.*failed to connect
- •Verify server running and port correct
- •Configure retry policy
gRPC metadata after request started
Request headers must be sent.*gRPC
- •Set headers before calling RPC method
- •Use CallOptions for metadata
gRPC call initialization error
Error starting gRPC call
- •Ensure HTTP/2 configured on channel
- •Check server proto service definition
gRPC write to completed stream
stream has already been completed
- •Check stream completion before writing
- •Use CancellationToken for lifecycle
MAUI XAML type resolution failure
Cannot resolve type.*MAUI
- •Add xmlns namespace declaration
- •Register handler with ConfigureMauiHandlers
MAUI data binding property not found
property not found on.*MAUI|Binding.*property not found
- •Verify property name on BindingContext type
- •Implement INotifyPropertyChanged
MAUI handler not registered
No handler.*registered for view
- •Register in ConfigureMauiHandlers
- •Create platform-specific handler
MAUI platform-specific not supported
not supported on (iOS|Android|Windows|MacCatalyst)
- •Use #if ANDROID/IOS compilation
- •Check DeviceInfo.Platform
Source generator no output
Source generator '.*' produced no output
- •Verify partial keyword on targets
- •Check Initialize registers correct syntax
Source generator diagnostic error
SG\d+.*source generator
- •Check GeneratorDiagnostics for details
- •Verify SyntaxReceiver predicate
Incremental generator pipeline failure
IncrementalGenerator.*pipeline.*failed
- •Ensure valid source text in RegisterSourceOutput
- •Check for null in transforms
Source generator syntax receiver miss
SyntaxReceiver.*did not receive expected
- •Check OnVisitSyntaxNode SyntaxKind
- •Log candidate nodes for debugging
AOT generic requires runtime codegen
IL3050.*generic.*requires runtime code generation
- •Use [DynamicallyAccessedMembers]
- •Pre-instantiate generics with rd.xml
AOT missing method after publish
MissingMethodException.*not found.*PublishAot
- •Add [DynamicDependency] attribute
- •Configure TrimmerRootAssembly
Reflection.Emit not available in AOT
Reflection\.Emit.*not supported.*AOT
- •Replace with source generators
- •Use compiled expressions
Auth metadata without auth middleware
contains authorization metadata.*no authentication
- •Add UseAuthentication() before UseAuthorization()
- •Configure authentication scheme
Minimal API ambiguous route
No route matches.*ambiguous
- •Add route constraints
- •Use specific HTTP method attributes
Blazor streaming incompatible render mode
streaming rendering.*not supported.*render mode
- •Use [StreamRendering] only with Server mode
- •Remove from WebAssembly components
EF Core 8 complex type with navigation
Complex type.*cannot contain navigation
- •Move navigation to owning entity
- •Use owned entity for relationships
SignalR MessagePack serialization failure
MessagePack.*cannot serialize type
- •Add [MessagePackObject] and [Key] attributes
- •Register custom formatter
SignalR hub method not accessible
Hub method '.*' is not accessible
- •Make hub method public
- •Remove [NonAction] conflict
gRPC unimplemented method
StatusCode=.*Unimplemented
- •Implement method in service class
- •Regenerate proto stubs
gRPC HTTP/2 not configured
HTTP/2.*not supported.*Kestrel
- •Set Protocols = Http2 in Kestrel
- •Use Http1AndHttp2 for mixed traffic
MAUI UI operation from background thread
must be called from the UI thread|MainThread
- •Use MainThread.BeginInvokeOnMainThread()
- •Use Dispatcher.DispatchAsync()
Service from disposed scope
IServiceProvider.*disposed.*scope
- •Don't capture scoped in singletons
- •Create new scope with IServiceScopeFactory
Scoped service in singleton
Cannot consume scoped service.*from singleton
- •Inject IServiceScopeFactory into singleton
- •Change lifetime to singleton if stateless
Blazor enhanced nav antiforgery missing
enhanced navigation.*antiforgery
- •Add @rendermode InteractiveServer
- •Include AntiforgeryToken in form
EF Core IAsyncEnumerable cast error
Unable to cast.*IAsyncEnumerable
- •Use ToAsyncEnumerable() extension
- •Await ToListAsync() before casting
EF Core client evaluation blocked
client.*evaluation.*not allowed
- •Rewrite to server-translatable LINQ
- •Call AsEnumerable() at right point
EF Core duplicate tracking
is being tracked.*cannot track another.*same key
- •Use AsNoTracking() for read-only
- •Detach existing before attaching
EF Core concurrency conflict
DbUpdateConcurrencyException.*affected 0 row
- •Reload entity and retry
- •Add [ConcurrencyCheck] or [Timestamp]
EF Core table sharing conflict
Cannot use table '.*' for entity.*already used
- •Use ToTable() with different names
- •Configure table splitting with shared PK
Source generator attribute not found
attribute '.*' not found in compilation
- •Add attribute to generator output
- •Reference containing assembly
Blazor render batch too large
maximum batch size exceeded
- •Implement virtualization
- •Paginate data
MAUI Shell route not registered
Shell.*route.*not registered
- •Register with Routing.RegisterRoute()
- •Use correct route pattern
NativeAOT type not preserved
dynamically accessed.*not preserved
- •Add [DynamicallyAccessedMembers]
- •Include in rd.xml
Blazor render mode wrong context
IComponentRenderMode.*not supported in this context
- •Move outside static rendering
- •Apply at page level
gRPC channel used after shutdown
channel.*already shut down
- •Check channel state before calls
- •Implement channel lifecycle management
SignalR send buffer overflow
send.*buffer.*full
- •Increase MaximumReceiveMessageSize
- •Implement backpressure with Channel<T>
EF Core owned type shared
owned type.*cannot be shared between multiple owners
- •Create separate instances per owner
- •Use complex type for value semantics
MAUI duplicate BindableProperty
BindableProperty.*already registered
- •Make field static readonly
- •Check base class definitions
Minimal API TypedResults conversion
TypedResults.*cannot be converted
- •Use Results<T1,T2> union type
- •Use TypedResults.* consistently
EF Core query filter cycle
query filter.*causes cycle
- •Use IgnoreQueryFilters() to break cycle
- •Restructure to avoid self-reference
SignalR all transports failed
long polling.*transport.*fallback failed
- •Verify WebSocket support on server
- •Configure CORS for negotiation
AOT MakeGenericType unsupported
MakeGenericType.*not supported
- •Pre-instantiate generics at compile time
- •Use source generator for concrete types
Blazor component disposed in async
component.*disposed.*during async
- •Use CancellationToken from lifetime
- •Check IsDisposed before state update
EF Core shadow property missing
shadow property.*not configured
- •Configure with Property<T>(name)
- •Access via EF.Property<T>()
MAUI CollectionView no template
CollectionView.*ItemTemplate.*null
- •Set ItemTemplate with DataTemplate
- •Use ItemsLayout configuration
gRPC reflection not enabled
server reflection.*not enabled
- •Add AddGrpcReflection()
- •Install Grpc.AspNetCore.Server.Reflection
Incremental generator invalidation loop
incremental.*input changed.*re-run
- •Ensure value equality on pipeline values
- •Use record types for intermediates
Blazor PersistComponentState unavailable
persist component state.*not available
- •Register PersistentComponentState
- •Use [SupplyParameterFromPersistentComponentState]
Minimal API filter conflict
filter.*short-circuit.*conflict
- •Order filters correctly
- •Return Results.* to short-circuit
AOT type initializer exception
type initializer.*threw.*AOT|TypeLoadException.*AOT
- •Move init out of static constructors
- •Use Lazy<T> for deferred init
EF Core temporal table period missing
temporal table.*period.*not configured
- •Configure with .IsTemporal()
- •Set PeriodStart/PeriodEnd columns
Blazor render mode changed after init
render mode.*cannot be changed after.*initialized
- •Set render mode before first render
- •Use static assignment at declaration
SignalR parameter binding failure
hub.*method.*parameter.*cannot be bound
- •Ensure type is JSON-serializable
- •Match client arg types to signature
gRPC proto import not found
proto file.*import.*not found
- •Add proto to Protobuf ItemGroup
- •Set ProtoRoot correctly
MAUI page not registered in DI
MAUI.*page.*not registered
- •Register with AddTransient<MyPage>()
- •Register ViewModel in DI
EF Core value converter null handling
value converter.*cannot convert.*null
- •Handle null in converter logic
- •Mark property as nullable
AOT JSON unsupported type
JsonSerializer.*not supported.*type.*AOT
- •Add [JsonSerializable(typeof(T))]
- •Use source-generated JsonSerializerContext
Blazor SectionOutlet not found
section.*outlet.*not found
- •Add SectionOutlet with matching name
- •Ensure name matches SectionContent
SignalR invoke during reconnection
reconnecting.*cannot invoke
- •Queue messages during reconnection
- •Listen to Reconnecting events
EF Core split query with projection
split query.*cannot be applied.*projection
- •Remove AsSplitQuery() with Select
- •Use single query for projections
AOT method access restriction
method.*not accessible.*security.*AOT
- •Add [UnsafeAccessor] attribute
- •Use public API surface
MAUI handler reuse conflict
handler.*already connected.*different virtual view
- •Create new handler per view
- •Disconnect before reassigning
Blazor interactive root static render
root component.*cannot be rendered statically
- •Apply render mode at App level
- •Use @rendermode on declaration
Source generator file not found
AdditionalText.*file not found
- •Add as AdditionalFiles in csproj
- •Verify path relative to project
gRPC stream read timeout
stream.*read.*timed out.*gRPC
- •Set ReadTimeout on options
- •Implement heartbeat messages
EF Core JSON column unsupported type
JSON column.*not supported for type
- •Use ToJson() with owned types only
- •Ensure parameterless constructor
Event Store Concurrency Conflict
EventStore.*WrongExpectedVersion.*concurrency conflict
- •Reload aggregate and retry command
- •Use optimistic concurrency with expected version
Event Store Projection Faulted
EventStore.*projection.*faulted.*checkpoint
- •Reset projection to last good checkpoint
- •Fix projection code causing the fault
NullReferenceException: Object reference not set
System\.NullReferenceException.*Object reference not set to an instance of an object
- •Add null check before accessing the object: if (obj != null) { ... }
- •Use null-conditional operator: obj?.Property
InvalidOperationException: Sequence contains no elements
InvalidOperationException.*Sequence contains no elements
- •Use FirstOrDefault() instead of First()
- •Use SingleOrDefault() instead of Single()
InvalidOperationException: Collection modified during enumeration
InvalidOperationException.*Collection was modified.*enumeration
- •Call .ToList() before iterating: foreach (var item in list.ToList())
- •Use a for loop with reverse index when removing items
ArgumentNullException: Value cannot be null
System\.ArgumentNullException.*Value cannot be null.*Parameter name: (\w+)
- •Ensure the argument is not null before passing it to the method
- •Add a guard clause: ArgumentNullException.ThrowIfNull(param)
ArgumentException: Invalid argument value
System\.ArgumentException.*is not a valid value
- •Validate input before passing to method
- •Check enum values with Enum.IsDefined() before casting
InvalidCastException: Unable to cast object
System\.InvalidCastException.*Unable to cast object of type '(.+)' to type '(.+)'
- •Use 'as' operator with null check instead of direct cast: var x = obj as TargetType
- •Use pattern matching: if (obj is TargetType typed) { ... }
CS0103: Name does not exist in current context
error CS0103.*The name '(.+)' does not exist in the current context
- •Add the missing using directive for the namespace
- •Check for typos in the variable/method name
CS0234: Type or namespace not found
error CS0234.*The type or namespace name '(.+)' does not exist in the namespace '(.+)'
- •Install the missing NuGet package: dotnet add package <PackageName>
- •Add a project reference: dotnet add reference <ProjectPath>
CS1061: Type does not contain definition for member
error CS1061.*'(.+)' does not contain a definition for '(.+)'
- •Check for typos in the member name
- •Add the missing using directive for extension methods
CS0029: Cannot implicitly convert type
error CS0029.*Cannot implicitly convert type '(.+)' to '(.+)'
- •Add an explicit cast: (TargetType)value
- •Use a conversion method: int.Parse(), ToString(), Convert.ToInt32()
CS8600: Possible null to non-nullable conversion
warning CS8600.*Converting null literal or possible null value to non-nullable type
- •Declare the variable as nullable: string? result = ...
- •Add a null check or guard before assignment
CS8602: Dereference of possibly null reference
warning CS8602.*Dereference of a possibly null reference
- •Add a null check before dereferencing: if (obj != null) obj.Method()
- •Use null-conditional operator: obj?.Method()
CS8604: Possible null reference argument
warning CS8604.*Possible null reference argument for parameter
- •Add a null check before passing the argument
- •Use the ?? operator to provide a fallback: param ?? defaultValue
NETSDK1045: SDK does not support target framework
NETSDK1045.*The current \.NET SDK does not support targeting
- •Install the required .NET SDK version from https://dotnet.microsoft.com/download
- •Update global.json to use an installed SDK version
NETSDK1005: Target framework version mismatch
NETSDK1005.*Project .+ targets '(.+)'.*current SDK
- •Install the matching .NET SDK for the target framework
- •Change TargetFramework in .csproj to match installed SDK
EF Core: Migration already applied or database up to date
No migrations were applied.*database is already up to date|The migration '(.+)' has already been applied
- •Run 'dotnet ef migrations list' to check applied migrations
- •Create a new migration: dotnet ef migrations add <Name>
EF Core / SQL: Connection string or database access error
Cannot open database|A network-related or instance-specific error|Login failed for user
- •Verify ConnectionStrings section in appsettings.json
- •Ensure the database server is running and accessible
ASP.NET Core DI: Service not registered
InvalidOperationException.*No service for type '(.+)' has been registered|Unable to resolve service for type '(.+)'
- •Register the service in Program.cs: builder.Services.AddScoped<IService, Service>()
- •Check that the interface and implementation match the registered types
ASP.NET Core: CORS policy blocking requests
Access to fetch.*blocked by CORS|has been blocked by CORS policy|No 'Access-Control-Allow-Origin'
- •Add CORS in Program.cs: builder.Services.AddCors() with a policy allowing the origin
- •Call app.UseCors("policyName") BEFORE app.UseAuthorization()
ASP.NET Core: 404 Not Found / Route not matched
StatusCode.*404|NotFound|No route matches|endpoint routing.*did not match
- •Verify the [Route] and [Http*] attributes on the controller/action
- •Ensure app.MapControllers() is called in Program.cs
HttpClient: SSL/TLS certificate error
The SSL connection could not be established|AuthenticationException.*remote certificate
- •For development, bypass with HttpClientHandler.ServerCertificateCustomValidationCallback
- •Install/trust the development certificate: dotnet dev-certs https --trust
HttpClient: Request timeout
TaskCanceledException.*A task was canceled|HttpRequestException.*request timed out|The request was canceled due to.*timeout
- •Increase HttpClient.Timeout: client.Timeout = TimeSpan.FromSeconds(120)
- •Use CancellationTokenSource with a longer timeout
HttpClient: Connection refused
HttpRequestException.*Connection refused|No connection could be made|actively refused
- •Verify the target service is running on the expected host:port
- •Check the base URL in configuration (appsettings/environment variable)
JSON Serialization: Object cycle detected
JsonException.*cycle.*detected|A possible object cycle was detected
- •Add ReferenceHandler.IgnoreCycles: options.ReferenceHandler = ReferenceHandler.IgnoreCycles
- •Use [JsonIgnore] on navigation properties that cause circular references
JSON Deserialization: Type conversion error
JsonException.*could not be converted|Cannot deserialize|The JSON value could not be converted to
- •Check that JSON property types match C# model types (e.g., string vs int)
- •Add JsonNumberHandling.AllowReadingFromString for numeric strings
MSB4019: Imported project not found
error MSB4019.*The imported project.*was not found
- •Restore NuGet packages: dotnet restore
- •Install the required workload: dotnet workload install <workload>
NU1101/NU1102: NuGet package not found
error NU1101.*Unable to find package|NU1102.*Unable to find package.*in any source
- •Check the package name for typos
- •Add the correct NuGet source in nuget.config
EF Core: DbContext already disposed
InvalidOperationException.*DbContext.*disposed|Cannot access a disposed context|disposed object.*DbContext
- •Don't capture DbContext in a background task — inject IDbContextFactory<T> instead
- •Register DbContext as Scoped (default), not Transient or Singleton
ASP.NET Core: Middleware order incorrect
InvalidOperationException.*Middleware.*must be added before|UseRouting.*must be added before UseEndpoints|UseAuthentication.*must be called before UseAuthorization
- •Follow the correct middleware order: UseRouting → UseAuthentication → UseAuthorization → MapControllers
- •Place UseCors() before UseAuthorization()
MSB3027: File locked by another process during build
error MSB3027.*Could not copy.*being used by another process|IOException.*used by another process
- •Stop the running application (dotnet run / IIS Express / kestrel)
- •Close any file handles — check with Process Explorer or 'handle.exe'