DeepCloner icon indicating copy to clipboard operation
DeepCloner copied to clipboard

When Object have navigation property, DeepClone throw exception.

Open jiehanlin opened this issue 3 years ago • 5 comments

System.StackOverflowException:“Exception_WasThrown” on internal static Func<T, DeepCloneState, T> GetClonerForValueType<T>().

jiehanlin avatar Feb 24 '22 00:02 jiehanlin

Can you provide short example of code, which causes this error? Also, if it required, write dependent packages with version.

force-net avatar Feb 24 '22 06:02 force-net

When dbcontext proxycreationenabled set to true,The result is System.Data.Entity.DynamicProxies objects,so Exception_WasThrown.

jiehanlin avatar Feb 24 '22 13:02 jiehanlin

Interesting situation. I'll try to reproduce. Cloning generated objects can be tricky.

force-net avatar Feb 24 '22 14:02 force-net

https://stackoverflow.com/questions/40509906/a-circular-reference-was-detected-while-serializing-an-object-of-type-system-da

It should be the same for DeepClone.

jiehanlin avatar Feb 24 '22 14:02 jiehanlin

https://github.com/jiehanlin/deepclonerdemo

the demo,console no exception,but webproject have exception.

jiehanlin avatar Feb 25 '22 07:02 jiehanlin