Skip to content

I get a System.ExecutionEngineException when cloning object with internal array of objects #24

@ilyadan

Description

@ilyadan

I have an object

    [Serializable]
    [StructLayout(LayoutKind.Sequential, Pack = 0)]

    public class MyClass
    {
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
        public short[] shortsArray= new short[4];
        [MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.Struct, SizeConst = 4)]
        public InternalClass[] internals = new InternalClass[4];
    }

That has an array of the following objects:

    [Serializable]
    [StructLayout(LayoutKind.Sequential, Pack = 0)]
    public class InternalClass
    {
        public byte myByte;// = 0;
        public uint myUint1;// = 0;
        public uint myUint2;// = 0;
        public uint myUint3;// = 0;
    }

Using both Clone and CloneDynamic on this class throws System.ExecutionEngineException.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions