I'm using EF 6.1.3 with Code-First.
In some rare circumstances, context.SaveChanges() throws either a "Null Reference" or an "Index Out Of Range" exception. The exceptions are thrown inside EF code.
Is this a bug in EF? If something was wrong with my data, then shouldn't EF offer an error message instead of crashing like that?
IndexOutOfRangeException, Index was outside the bounds of the array.
at System.Collections.Generic.Dictionary`2.ValueCollection.Enumerator.MoveNext() at System.Data.Entity.Core.Objects.ObjectStateManager.GetEntityEntriesForDetectChanges(Dictionary`2 entityStore, List`1& entries) at System.Data.Entity.Core.Objects.ObjectStateManager.GetEntityEntriesForDetectChanges() at System.Data.Entity.Core.Objects.ObjectStateManager.DetectChanges() at System.Data.Entity.Core.Objects.ObjectContext.DetectChanges() at System.Data.Entity.Internal.InternalContext.DetectChanges(Boolean force) at System.Data.Entity.Internal.InternalContext.GetStateEntries(Func`2 predicate) at System.Data.Entity.Internal.InternalContext.GetStateEntries() at System.Data.Entity.Infrastructure.DbChangeTracker.Entries() at System.Data.Entity.DbContext.GetValidationErrors() at System.Data.Entity.Internal.InternalContext.SaveChanges() at System.Data.Entity.Internal.LazyInternalContext.SaveChanges() at System.Data.Entity.DbContext.SaveChanges()
and
NullReferenceException, Object reference not set to an instance of an object. at System.Data.Entity.Core.Objects.ObjectStateManager.GetEntityEntriesForDetectChanges(Dictionary`2 entityStore, List`1& entries) at System.Data.Entity.Core.Objects.ObjectStateManager.GetEntityEntriesForDetectChanges() at System.Data.Entity.Core.Objects.ObjectStateManager.DetectChanges() at System.Data.Entity.Core.Objects.ObjectContext.DetectChanges() at System.Data.Entity.Internal.InternalContext.DetectChanges(Boolean force) at System.Data.Entity.Internal.InternalContext.GetStateEntries(Func`2 predicate) at System.Data.Entity.Internal.InternalContext.GetStateEntries() at System.Data.Entity.Infrastructure.DbChangeTracker.Entries() at System.Data.Entity.DbContext.GetValidationErrors() at System.Data.Entity.Internal.InternalContext.SaveChanges() at System.Data.Entity.Internal.LazyInternalContext.SaveChanges() at System.Data.Entity.DbContext.SaveChanges()
0 comments:
Post a Comment