I call SaveChanges with a large number (tens of thousands) of changed entities. I get a stack overflow exception as shown in call stack below. In the past, other developers have worked around this problem by "chunking" the save but I was having problems when adding the entities to the manager with exceptions when adding entities with foreign keys to an entity saved several chunks previous. Thoughts anyone? Is there a documented limit on the number of entities that can be saved at one time?
[Managed to Native Transition] > mscorlib.dll!System.RuntimeType.GetGenericTypeDefinition() + 0x8f bytes System.Runtime.Serialization.dll!System.Runtime.Serialization.CollectionDataContract.IsCollectionInterface(System.Type type) + 0x69 bytes System.Runtime.Serialization.dll!System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithXsiType(System.Runtime.Serialization.XmlWriterDelegator xmlWriter, object obj, System.RuntimeTypeHandle objectTypeHandle, System.Type objectType, int declaredTypeID, System.RuntimeTypeHandle declaredTypeHandle, System.Type declaredType) + 0x62 bytes System.Runtime.Serialization.dll!System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerialize(System.Runtime.Serialization.XmlWriterDelegator xmlWriter, object obj, bool isDeclaredType, bool writeXsiType, int declaredTypeID, System.RuntimeTypeHandle declaredTypeHandle) + 0x1a7 bytes System.Runtime.Serialization.dll!System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerializeReference(System.Runtime.Serialization.XmlWriterDelegator xmlWriter, object obj, bool isDeclaredType, bool writeXsiType, int declaredTypeID, System.RuntimeTypeHandle declaredTypeHandle) + 0x6f bytes [Lightweight Function] System.Runtime.Serialization.dll!System.Runtime.Serialization.ClassDataContract.WriteXmlValue(System.Runtime.Serialization.XmlWriterDelegator xmlWriter, object obj, System.Runtime.Serialization.XmlObjectSerializerWriteContext context) + 0x31 bytes System.Runtime.Serialization.dll!System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerialize(System.Runtime.Serialization.XmlWriterDelegator xmlWriter, object obj, bool isDeclaredType, bool writeXsiType, int declaredTypeID, System.RuntimeTypeHandle declaredTypeHandle) + 0x6d bytes System.Runtime.Serialization.dll!System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerializeReference(System.Runtime.Serialization.XmlWriterDelegator xmlWriter, object obj, bool isDeclaredType, bool writeXsiType, int declaredTypeID, System.RuntimeTypeHandle declaredTypeHandle) + 0x6f bytes
... ... continues the same until:
[Lightweight Function] System.Runtime.Serialization.dll!System.Runtime.Serialization.ClassDataContract.WriteXmlValue(System.Runtime.Serialization.XmlWriterDelegator xmlWriter, object obj, System.Runtime.Serialization.XmlObjectSerializerWriteContext context) + 0x31 bytes System.Runtime.Serialization.dll!System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeAndVerifyType(System.Runtime.Serialization.DataContract dataContract, System.Runtime.Serialization.XmlWriterDelegator xmlWriter, object obj, bool verifyKnownType, System.RuntimeTypeHandle declaredTypeHandle, System.Type declaredType) + 0xeb bytes System.Runtime.Serialization.dll!System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithXsiType(System.Runtime.Serialization.XmlWriterDelegator xmlWriter, object obj, System.RuntimeTypeHandle objectTypeHandle, System.Type objectType, int declaredTypeID, System.RuntimeTypeHandle declaredTypeHandle, System.Type declaredType) + 0x2c6 bytes System.Runtime.Serialization.dll!System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerialize(System.Runtime.Serialization.XmlWriterDelegator xmlWriter, object obj, bool isDeclaredType, bool writeXsiType, int declaredTypeID, System.RuntimeTypeHandle declaredTypeHandle) + 0x1a7 bytes System.Runtime.Serialization.dll!System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerializeReference(System.Runtime.Serialization.XmlWriterDelegator xmlWriter, object obj, bool isDeclaredType, bool writeXsiType, int declaredTypeID, System.RuntimeTypeHandle declaredTypeHandle) + 0x6f bytes [Lightweight Function] System.Runtime.Serialization.dll!System.Runtime.Serialization.CollectionDataContract.WriteXmlValue(System.Runtime.Serialization.XmlWriterDelegator xmlWriter, object obj, System.Runtime.Serialization.XmlObjectSerializerWriteContext context) + 0x41 bytes System.Runtime.Serialization.dll!System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerialize(System.Runtime.Serialization.XmlWriterDelegator xmlWriter, object obj, bool isDeclaredType, bool writeXsiType, int declaredTypeID, System.RuntimeTypeHandle declaredTypeHandle) + 0x6d bytes System.Runtime.Serialization.dll!System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerializeReference(System.Runtime.Serialization.XmlWriterDelegator xmlWriter, object obj, bool isDeclaredType, bool writeXsiType, int declaredTypeID, System.RuntimeTypeHandle declaredTypeHandle) + 0x6f bytes [Lightweight Function] System.Runtime.Serialization.dll!System.Runtime.Serialization.ClassDataContract.WriteXmlValue(System.Runtime.Serialization.XmlWriterDelegator xmlWriter, object obj, System.Runtime.Serialization.XmlObjectSerializerWriteContext context) + 0x31 bytes System.Runtime.Serialization.dll!System.Runtime.Serialization.DataContractSerializer.InternalWriteObjectContent(System.Runtime.Serialization.XmlWriterDelegator writer, object graph, System.Runtime.Serialization.DataContractResolver dataContractResolver) + 0x11c bytes System.Runtime.Serialization.dll!System.Runtime.Serialization.XmlObjectSerializer.WriteObjectContentHandleExceptions(System.Runtime.Serialization.XmlWriterDelegator writer, object graph) + 0x3e2 bytes IdeaBlade.EntityModel.dll!IdeaBlade.EntityModel.SerializationFns.SaveDCS(object instance, System.IO.Stream stream, bool closeOnExit, System.Collections.Generic.IEnumerable<System.Type> knownTypes, bool useBinaryFormat) + 0x1c7 bytes IdeaBlade.EntityModel.dll!IdeaBlade.EntityModel.SerializationFns.Save(object instance, System.IO.Stream stream, bool closeOnExit, System.Collections.Generic.IEnumerable<System.Type> knownTypes, bool useBinary) + 0x62 bytes IdeaBlade.EntityModel.dll!IdeaBlade.EntityModel.SaveWorkState.DeepClone() + 0x86 bytes IdeaBlade.EntityModel.Server.dll!IdeaBlade.EntityModel.Server.EntityServer.SaveChanges(IdeaBlade.EntityModel.SaveWorkState workState) + 0x78 bytes IdeaBlade.EntityModel.dll!IdeaBlade.EntityModel.EntityServerProxy.SaveChanges.AnonymousMethod__10() + 0x95 bytes IdeaBlade.EntityModel.dll!IdeaBlade.EntityModel.EntityServerProxy.ExecFunc<IdeaBlade.EntityModel.SaveWorkState>(System.Func<IdeaBlade.EntityModel.SaveWorkState> func, bool funcWillHandleException) + 0x6c bytes IdeaBlade.EntityModel.dll!IdeaBlade.EntityModel.EntityServerProxy.ExecuteOnServer<IdeaBlade.EntityModel.SaveWorkState>(System.Func<IdeaBlade.EntityModel.SaveWorkState> func, bool funcWillHandleException) + 0x1f4 bytes IdeaBlade.EntityModel.dll!IdeaBlade.EntityModel.EntityServerProxy.SaveChanges(IdeaBlade.EntityModel.SaveWorkState workState) + 0xe2 bytes IdeaBlade.EntityModel.dll!IdeaBlade.EntityModel.EntityManager.SaveEntitiesCore(IdeaBlade.EntityModel.SaveWorkState workState) + 0xe6 bytes IdeaBlade.EntityModel.dll!IdeaBlade.EntityModel.EntityManager.SaveChangesAsyncCore.AnonymousMethod__aa(IdeaBlade.EntityModel.EntitySaveOperation op) + 0x111 bytes IdeaBlade.EntityModel.dll!IdeaBlade.EntityModel.AsyncProcessor<IdeaBlade.EntityModel.EntitySaveOperation>.Execute.AnonymousMethod__4(object o) + 0xee bytes mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0x285 bytes mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0x9 bytes mscorlib.dll!System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem() + 0x6f bytes mscorlib.dll!System.Threading.ThreadPoolWorkQueue.Dispatch() + 0x1ea bytes [Native to Managed Transition]
|