Closed popcatalin81 closed 5 months ago
Sometimes I get even more nonsensical errors:
System.InvalidCastException
HResult=0x80004002
Message=Unable to cast object of type '[redacted].Tenant.Models.EntityPropertyMilestone' to type 'System.Int32'.
Source=Microsoft.EntityFrameworkCore
StackTrace:
at Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer`1.Equals(Object left, Object right)
at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.ChangeDetector.DetectValueChange(InternalEntityEntry entry, IProperty property)
at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.ChangeDetector.LocalDetectChanges(InternalEntityEntry entry)
at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.ChangeDetector.DetectChanges(IStateManager stateManager)
at Microsoft.EntityFrameworkCore.ChangeTracking.ChangeTracker.DetectChanges()
at Chassi.Services.Batch.QueryProfiler.ProfileProcess(QueryProfilerContext context, Action processingTask, String step) in C:\Work\acsap-connect\Chassi\Chassi.Services\Event\Batch\Profiler\QueryProfiler.cs:line 54
This exception was originally thrown at this call stack:
Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer<T>.Equals(object, object)
Microsoft.EntityFrameworkCore.ChangeTracking.Internal.ChangeDetector.DetectValueChange(Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry, Microsoft.EntityFrameworkCore.Metadata.IProperty)
Microsoft.EntityFrameworkCore.ChangeTracking.Internal.ChangeDetector.LocalDetectChanges(Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry)
Microsoft.EntityFrameworkCore.ChangeTracking.Internal.ChangeDetector.DetectChanges(Microsoft.EntityFrameworkCore.ChangeTracking.Internal.IStateManager)
Microsoft.EntityFrameworkCore.ChangeTracking.ChangeTracker.DetectChanges()
Chassi.Services.Batch.QueryProfiler.ProfileProcess(Chassi.Services.Batch.QueryProfilerContext, System.Action, string) in QueryProfiler.cs
This makes absolutely no sense to me.
Especially the ExecutionEngineException
or AccessViolationException
suggest problem somewhere deeper than just EF.
But otherwise this issue is lacking enough information for us to be able to fully understand what is happening. Please attach a small, runnable project or post a small, runnable code listing that reproduces what you are seeing so that we can investigate.
OK, this is was 2 weeks o ordeal just to find out all these was happening from a combination of not having the latest Bios fixes for i9-14900KS and some corrupted system files ... Luckily Intel stepped up with a bios fix.
Glad to hear that.
File a bug
I've getting very strange and completely random
System.ExecutionEngineException
orSystem.InvalidCastException
orSystem.NullReferenceException
The frequency of these exceptions is extremly high in debug mode and significanly lower in release mode.
Include stack traces
Use triple-tick fences for stack traces. For example:
Another trace from the logger:
Include verbose output
Using project directory 'C:\Work[redacted]\DA[redacted]Tenant.DataAccess\'. Remaining arguments: . Finding DbContext classes... Finding IDesignTimeDbContextFactory implementations... Finding application service provider in assembly [redacted].Tenant.DataAccess'... Finding Microsoft.Extensions.Hosting service provider... No static method 'CreateHostBuilder(string[])' was found on class 'Program'. No application service provider was found. Finding DbContext classes in the project... Found DbContext '[redacted]Context'. [redacted].Tenant.DataAccess.[redacted]Context
Include provider and version information
EF Core version: Database provider: Microsoft.EntityFrameworkCore.SqlServer 8.0.5 Target framework: .NET 8.0 Operating system: Windows 10 (Hyper-V VM, Host Windows 11 Pro) IDE: Visual Studio 2022 17.8.3