Remove extraneous eightbytes check for native structures and add tests. (#21590)
authorJeremy Koritzinsky <jkoritzinsky@gmail.com>
Wed, 9 Jan 2019 18:06:25 +0000 (10:06 -0800)
committerGitHub <noreply@github.com>
Wed, 9 Jan 2019 18:06:25 +0000 (10:06 -0800)
* Remove extraneous eightbytes check and add tests.

* Interger -> Integer

* Missed Helper.cs

* Handle field sizes larger than 8 bytes in AssignClassifiedEightByteTypes

* Move CoreFX test case into CoreCLR.  Fix the SystemV eightbyte classifier to correctly classify the second eightbyte when a single field crosses the eightbyte boundary (such as an in-place array of three 4-byte enums).

* Enable passing user defined structs in in-place arrays in a structure if SystemV ABI expects it.

* Correctly handle a field spanning two full eightbytes.

* Just directly assign 0 to accumulatedSizeForEightByte

* Change multi-eightbyte field handling to be a loop as per PR feedback.

* Remove extraneous whitespace.

src/vm/fieldmarshaler.h
src/vm/methodtable.cpp
tests/src/Interop/PInvoke/Array/MarshalArrayAsField/AsByValArray/AsByValArrayTest.cs
tests/src/Interop/PInvoke/Array/MarshalArrayAsField/LPArrayNative/MarshalArrayByValArrayNative.cpp
tests/src/Interop/StructMarshalling/PInvoke/Helper.cs
tests/src/Interop/StructMarshalling/PInvoke/MarshalStructAsLayoutSeq.cs
tests/src/Interop/StructMarshalling/PInvoke/MarshalStructAsParamDLL.cpp
tests/src/Interop/StructMarshalling/PInvoke/MarshalStructAsParamDLL.h
tests/src/Interop/StructMarshalling/PInvoke/Struct.cs

index 1f7ac88..24b1021 100644 (file)
@@ -1029,8 +1029,12 @@ public:
     {
         LIMITED_METHOD_CONTRACT;
 
-        MethodTable *pElementMT = m_arrayType.GetValue().AsArray()->GetArrayElementTypeHandle().GetMethodTable();
-        return OleVariant::GetElementSizeForVarType(m_vt, pElementMT) * m_numElems;
+        return OleVariant::GetElementSizeForVarType(m_vt, GetElementMethodTable()) * m_numElems;
+    }
+
+    MethodTable* GetElementMethodTable() const
+    {
+        return GetElementTypeHandle().GetMethodTable();
     }
 
     TypeHandle GetElementTypeHandle() const
index d7e98ff..e158436 100644 (file)
@@ -2649,11 +2649,6 @@ bool MethodTable::ClassifyEightBytesWithNativeLayout(SystemVStructRegisterPassin
         unsigned normalizedFieldOffset = fieldOffset + startOffsetOfStruct;
 
         unsigned int fieldNativeSize = pFieldMarshaler->NativeSize();
-        if (fieldNativeSize > SYSTEMV_EIGHT_BYTE_SIZE_IN_BYTES)
-        {
-            // Pass on stack in this case.
-            return false;
-        }
 
         _ASSERTE(fieldNativeSize != (unsigned int)-1);
 
@@ -2704,6 +2699,23 @@ bool MethodTable::ClassifyEightBytesWithNativeLayout(SystemVStructRegisterPassin
             case VT_R8:
                 fieldClassificationType = SystemVClassificationTypeSSE;
                 break;
+            case VT_RECORD:
+            {
+                MethodTable* pFieldMT = ((FieldMarshaler_FixedArray*)pFieldMarshaler)->GetElementMethodTable();
+
+                bool inEmbeddedStructPrev = helperPtr->inEmbeddedStruct;
+                helperPtr->inEmbeddedStruct = true;
+                bool structRet = pFieldMT->ClassifyEightBytesWithNativeLayout(helperPtr, nestingLevel + 1, normalizedFieldOffset, useNativeLayout);
+                helperPtr->inEmbeddedStruct = inEmbeddedStructPrev;
+
+                if (!structRet)
+                {
+                    // If the nested struct says not to enregister, there's no need to continue analyzing at this level. Just return do not enregister.
+                    return false;
+                }
+
+                continue;
+            }
             case VT_DECIMAL:
             case VT_DATE:
             case VT_BSTR:
@@ -2714,7 +2726,6 @@ bool MethodTable::ClassifyEightBytesWithNativeLayout(SystemVStructRegisterPassin
             case VT_HRESULT:
             case VT_CARRAY:
             case VT_USERDEFINED:
-            case VT_RECORD:
             case VT_FILETIME:
             case VT_BLOB:
             case VT_STREAM:
@@ -3044,7 +3055,7 @@ void  MethodTable::AssignClassifiedEightByteTypes(SystemVStructRegisterPassingHe
             else
             {
                 fieldSize = helperPtr->fieldSizes[ordinal];
-                _ASSERTE(fieldSize > 0 && fieldSize <= SYSTEMV_EIGHT_BYTE_SIZE_IN_BYTES);
+                _ASSERTE(fieldSize > 0);
 
                 fieldClassificationType = helperPtr->fieldClassifications[ordinal];
                 _ASSERTE(fieldClassificationType != SystemVClassificationTypeMemory && fieldClassificationType != SystemVClassificationTypeUnknown);
@@ -3082,7 +3093,7 @@ void  MethodTable::AssignClassifiedEightByteTypes(SystemVStructRegisterPassingHe
             }
 
             accumulatedSizeForEightByte += fieldSize;
-            if (accumulatedSizeForEightByte == SYSTEMV_EIGHT_BYTE_SIZE_IN_BYTES)
+            while (accumulatedSizeForEightByte >= SYSTEMV_EIGHT_BYTE_SIZE_IN_BYTES)
             {
                 // Save data for this eightbyte.
                 helperPtr->eightByteSizes[currentEightByte] = SYSTEMV_EIGHT_BYTE_SIZE_IN_BYTES;
@@ -3092,8 +3103,14 @@ void  MethodTable::AssignClassifiedEightByteTypes(SystemVStructRegisterPassingHe
                 currentEightByte++;
                 _ASSERTE(currentEightByte <= CLR_SYSTEMV_MAX_EIGHTBYTES_COUNT_TO_PASS_IN_REGISTERS);
 
-                currentEightByteOffset = offset + fieldSize;
-                accumulatedSizeForEightByte = 0;
+                currentEightByteOffset += SYSTEMV_EIGHT_BYTE_SIZE_IN_BYTES;
+                accumulatedSizeForEightByte -= SYSTEMV_EIGHT_BYTE_SIZE_IN_BYTES;
+
+                // If a field is large enough to span multiple eightbytes, then set the eightbyte classification to the field's classification.
+                if (accumulatedSizeForEightByte > 0)
+                {
+                    helperPtr->eightByteClassifications[currentEightByte] = fieldClassificationType;
+                }
             }
 
             _ASSERTE(accumulatedSizeForEightByte < SYSTEMV_EIGHT_BYTE_SIZE_IN_BYTES);
index a93e15c..a047c7d 100644 (file)
@@ -122,6 +122,32 @@ public struct S_BOOLArray_Seq
     [MarshalAs(UnmanagedType.ByValArray, SizeConst = Test.ARRAY_SIZE)]
     public bool[] arr;
 }
+
+public enum TestEnum
+{
+    Red = 1,
+    Green,
+    Blue
+}
+
+[StructLayout(LayoutKind.Sequential)]
+public struct EnregisterableNonBlittable_Seq
+{
+    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
+    public TestEnum[] arr;
+}
+
+public struct SimpleStruct
+{
+    public int fld;
+}
+
+[StructLayout(LayoutKind.Sequential)]
+public struct EnregisterableUserType
+{
+    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
+    public SimpleStruct[] arr;
+}
 #endregion
 
 #region sequential class definition
@@ -519,6 +545,12 @@ class Test
     [DllImport("MarshalArrayByValArrayNative", CallingConvention = CallingConvention.Cdecl)]
     static extern bool TakeStructArraySeqStructByVal([In]S_StructArray_Seq s, int size);
 
+    [DllImport("MarshalArrayByValArrayNative", CallingConvention = CallingConvention.Cdecl)]
+    static extern bool TakeEnregistrableNonBlittableSeqStructByVal(EnregisterableNonBlittable_Seq s, TestEnum[] values);
+
+    [DllImport("MarshalArrayByValArrayNative", CallingConvention = CallingConvention.Cdecl)]
+    static extern bool TakeEnregisterableUserTypeStructByVal(EnregisterableUserType s, SimpleStruct[] values);
+
     //for RunTest2
     [DllImport("MarshalArrayByValArrayNative", CallingConvention = CallingConvention.Cdecl)]
     static extern bool TakeIntArraySeqClassByVal([In]C_INTArray_Seq c, int size);
@@ -827,6 +859,30 @@ class Test
         S_StructArray_Seq s14 = new S_StructArray_Seq();
         s14.arr = InitStructArray(ARRAY_SIZE);
         Assert.IsTrue(TakeStructArraySeqStructByVal(s14, s14.arr.Length),"TakeStructArraySeqStructByVal");
+
+        EnregisterableNonBlittable_Seq s15 = new EnregisterableNonBlittable_Seq
+        {
+            arr = new TestEnum[3]
+            {
+                TestEnum.Red,
+                TestEnum.Green,
+                TestEnum.Blue
+            }
+        };
+
+        Assert.IsTrue(TakeEnregistrableNonBlittableSeqStructByVal(s15, s15.arr), "EnregisterableNonBlittableSeqStructByVal");
+
+        EnregisterableUserType s16 = new EnregisterableUserType
+        {
+            arr = new SimpleStruct[3]
+            {
+                new SimpleStruct { fld = 10 },
+                new SimpleStruct { fld = 25 },
+                new SimpleStruct { fld = 40 }
+            }
+        };
+
+        Assert.IsTrue(TakeEnregisterableUserTypeStructByVal(s16, s16.arr), "TakeEnregisterableUserTypeStructByVal");
     }
 
     static void RunTest2(string report)
index 410306c..edbdf6f 100644 (file)
@@ -52,6 +52,19 @@ typedef struct  { TestStruct  arr[ARRAY_SIZE];               }       S_StructArray;
 
 typedef struct  { BOOL          arr[ARRAY_SIZE];               }       S_BOOLArray;
 
+enum class TestEnum : int32_t
+{
+    Red = 1,
+    Green,
+    Blue
+};
+
+typedef struct { TestEnum arr[3]; } EnregisterableNonBlittable;
+
+typedef struct { int32_t i; } SimpleStruct;
+
+typedef struct { SimpleStruct arr[3]; } EnregisterableUserType;
+
 /*----------------------------------------------------------------------------
 helper function
 ----------------------------------------------------------------------------*/
@@ -242,6 +255,17 @@ extern "C" DLL_EXPORT BOOL __cdecl TakeStructArraySeqStructByVal( S_StructArray
     return TestStructEquals( s.arr,expected );
 }
 
+extern "C" DLL_EXPORT BOOL __cdecl TakeEnregistrableNonBlittableSeqStructByVal(EnregisterableNonBlittable s, TestEnum values[3])
+{
+    return s.arr[0] == values[0] && s.arr[1] == values[1] && s.arr[2] == values[2];
+}
+
+extern "C" DLL_EXPORT BOOL __cdecl TakeEnregisterableUserTypeStructByVal(EnregisterableUserType s, SimpleStruct values[3])
+{
+    return s.arr[0].i == values[0].i && s.arr[1].i == values[1].i && s.arr[2].i == values[2].i;
+}
+
+
 /*----------------------------------------------------------------------------
 marshal sequential class
 ----------------------------------------------------------------------------*/
index ff7eeb2..32c2106 100644 (file)
@@ -656,28 +656,28 @@ public class Helper
     }
     #endregion
     
-    #region methods for IncludeOuterIntergerStructSequential struct
-    public static IncludeOuterIntergerStructSequential NewIncludeOuterIntergerStructSequential(int i321, int i322)
+    #region methods for IncludeOuterIntegerStructSequential struct
+    public static IncludeOuterIntegerStructSequential NewIncludeOuterIntegerStructSequential(int i321, int i322)
     {
-        IncludeOuterIntergerStructSequential s10 = new IncludeOuterIntergerStructSequential();
+        IncludeOuterIntegerStructSequential s10 = new IncludeOuterIntegerStructSequential();
         s10.s.s_int.i = i321;
         s10.s.i = i322;
         return s10;
     }
-    public static void PrintIncludeOuterIntergerStructSequential(IncludeOuterIntergerStructSequential str1, string name)
+    public static void PrintIncludeOuterIntegerStructSequential(IncludeOuterIntegerStructSequential str1, string name)
     {
         Console.WriteLine("\t{0}.s.s_int.i = {1}", name, str1.s.s_int.i);
         Console.WriteLine("\t{0}.s.i = {1}", name, str1.s.i);
     }
-    public static bool ValidateIncludeOuterIntergerStructSequential(IncludeOuterIntergerStructSequential str1, IncludeOuterIntergerStructSequential str2, string methodName)
+    public static bool ValidateIncludeOuterIntegerStructSequential(IncludeOuterIntegerStructSequential str1, IncludeOuterIntegerStructSequential str2, string methodName)
     {
         if (str1.s.s_int.i != str2.s.s_int.i || str1.s.i != str2.s.i)
         {
             Console.WriteLine("\tFAILED! " + methodName + "did not receive result as expected.");
             Console.WriteLine("\tThe Actual is...");
-            PrintIncludeOuterIntergerStructSequential(str1, str1.ToString());
+            PrintIncludeOuterIntegerStructSequential(str1, str1.ToString());
             Console.WriteLine("\tThe Expected is...");
-            PrintIncludeOuterIntergerStructSequential(str2, str2.ToString());
+            PrintIncludeOuterIntegerStructSequential(str2, str2.ToString());
             return false;
         }
         else
index 7283d5f..736a72a 100644 (file)
@@ -21,8 +21,12 @@ public class Managed
         StringStructSequentialUnicodeId,
         S8Id,
         S9Id,
-        IncludeOuterIntergerStructSequentialId,
-        S11Id
+        IncludeOuterIntegerStructSequentialId,
+        S11Id,
+        IntWithInnerSequentialId,
+        SequentialWrapperId,
+        SequentialDoubleWrapperId,
+        AggregateSequentialWrapperId
     }
 
     private static void InitialArray(int[] iarr, int[] icarr)
@@ -268,21 +272,21 @@ public class Managed
     #endregion
     #region Struct with Layout Sequential scenario12
     [DllImport("MarshalStructAsParam")]
-    static extern bool MarshalStructAsParam_AsSeqByVal13(IncludeOuterIntergerStructSequential str1);
+    static extern bool MarshalStructAsParam_AsSeqByVal13(IncludeOuterIntegerStructSequential str1);
     [DllImport("MarshalStructAsParam")]
-    static extern bool MarshalStructAsParam_AsSeqByRef13(ref IncludeOuterIntergerStructSequential str1);
+    static extern bool MarshalStructAsParam_AsSeqByRef13(ref IncludeOuterIntegerStructSequential str1);
     [DllImport("MarshalStructAsParam", EntryPoint = "MarshalStructAsParam_AsSeqByVal13")]
-    static extern bool MarshalStructAsParam_AsSeqByValIn13([In] IncludeOuterIntergerStructSequential str1);
+    static extern bool MarshalStructAsParam_AsSeqByValIn13([In] IncludeOuterIntegerStructSequential str1);
     [DllImport("MarshalStructAsParam")]
-    static extern bool MarshalStructAsParam_AsSeqByRefIn13([In] ref IncludeOuterIntergerStructSequential str1);
+    static extern bool MarshalStructAsParam_AsSeqByRefIn13([In] ref IncludeOuterIntegerStructSequential str1);
     [DllImport("MarshalStructAsParam")]
-    static extern bool MarshalStructAsParam_AsSeqByValOut13([Out] IncludeOuterIntergerStructSequential str1);
+    static extern bool MarshalStructAsParam_AsSeqByValOut13([Out] IncludeOuterIntegerStructSequential str1);
     [DllImport("MarshalStructAsParam")]
-    static extern bool MarshalStructAsParam_AsSeqByRefOut13(out IncludeOuterIntergerStructSequential str1);
+    static extern bool MarshalStructAsParam_AsSeqByRefOut13(out IncludeOuterIntegerStructSequential str1);
     [DllImport("MarshalStructAsParam", EntryPoint = "MarshalStructAsParam_AsSeqByVal13")]
-    static extern bool MarshalStructAsParam_AsSeqByValInOut13([In, Out] IncludeOuterIntergerStructSequential str1);
+    static extern bool MarshalStructAsParam_AsSeqByValInOut13([In, Out] IncludeOuterIntegerStructSequential str1);
     [DllImport("MarshalStructAsParam", EntryPoint = "MarshalStructAsParam_AsSeqByRef13")]
-    static extern bool MarshalStructAsParam_AsSeqByRefInOut13([In, Out] ref IncludeOuterIntergerStructSequential str1);
+    static extern bool MarshalStructAsParam_AsSeqByRefInOut13([In, Out] ref IncludeOuterIntegerStructSequential str1);
     #endregion
     #region Struct with Layout Sequential scenario13
     [DllImport("MarshalStructAsParam")]
@@ -302,6 +306,14 @@ public class Managed
     [DllImport("MarshalStructAsParam", EntryPoint = "MarshalStructAsParam_AsSeqByRef14")]
     static extern bool MarshalStructAsParam_AsSeqByRefInOut14([In, Out] ref S11 str1);
     #endregion
+    [DllImport("MarshalStructAsParam")]
+    static extern bool MarshalStructAsParam_AsSeqByValIntWithInnerSequential(IntWithInnerSequential str, int i);
+    [DllImport("MarshalStructAsParam")]
+    static extern bool MarshalStructAsParam_AsSeqByValSequentialWrapper(SequentialWrapper wrapper);
+    [DllImport("MarshalStructAsParam")]
+    static extern bool MarshalStructAsParam_AsSeqByValSequentialDoubleWrapper(SequentialDoubleWrapper wrapper);
+    [DllImport("MarshalStructAsParam")]
+    static extern bool MarshalStructAsParam_AsSeqByValSequentialAggregateSequentialWrapper(AggregateSequentialWrapper wrapper);
 
     #region Marshal struct method in PInvoke
     [SecuritySafeCritical]
@@ -487,17 +499,17 @@ public class Managed
                         failures++;
                     }
                     break;    
-                case StructID.IncludeOuterIntergerStructSequentialId:
-                    IncludeOuterIntergerStructSequential sourceIncludeOuterIntergerStructSequential = Helper.NewIncludeOuterIntergerStructSequential(32, 32);
-                    IncludeOuterIntergerStructSequential cloneIncludeOuterIntergerStructSequential = Helper.NewIncludeOuterIntergerStructSequential(32, 32);
+                case StructID.IncludeOuterIntegerStructSequentialId:
+                    IncludeOuterIntegerStructSequential sourceIncludeOuterIntegerStructSequential = Helper.NewIncludeOuterIntegerStructSequential(32, 32);
+                    IncludeOuterIntegerStructSequential cloneIncludeOuterIntegerStructSequential = Helper.NewIncludeOuterIntegerStructSequential(32, 32);
 
                     Console.WriteLine("\tCalling MarshalStructAsParam_AsSeqByVal13...");
-                    if (!MarshalStructAsParam_AsSeqByVal13(sourceIncludeOuterIntergerStructSequential))
+                    if (!MarshalStructAsParam_AsSeqByVal13(sourceIncludeOuterIntegerStructSequential))
                     {
                         Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsSeqByVal13.Expected:True;Actual:False");
                         failures++;
                     }
-                    if (!Helper.ValidateIncludeOuterIntergerStructSequential(sourceIncludeOuterIntergerStructSequential, cloneIncludeOuterIntergerStructSequential, "MarshalStructAsParam_AsSeqByVal13"))
+                    if (!Helper.ValidateIncludeOuterIntegerStructSequential(sourceIncludeOuterIntegerStructSequential, cloneIncludeOuterIntegerStructSequential, "MarshalStructAsParam_AsSeqByVal13"))
                     {
                         failures++;
                     }
@@ -518,6 +530,66 @@ public class Managed
                     }
                     break;
 
+                case StructID.IntWithInnerSequentialId:
+                    IntWithInnerSequential intWithInnerSeq = new IntWithInnerSequential
+                    {
+                        i1 = 42,
+                        sequential = Helper.NewInnerSequential(1, 1.0F, "")
+                    };
+                    Console.WriteLine("\tCalling MarshalStructAsParam_AsSeqByValIntWithInnerSequential...");
+                    if (!MarshalStructAsParam_AsSeqByValIntWithInnerSequential(intWithInnerSeq, 42))
+                    {
+                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsSeqByValIntWithInnerSequential.Expected:True;Actual:False");
+                        failures++;
+                    }
+                    break; 
+                case StructID.SequentialWrapperId:
+                    SequentialWrapper sequentialWrapper = new SequentialWrapper
+                    {
+                        sequential = Helper.NewInnerSequential(1, 1.0F, "")
+                    };
+                    Console.WriteLine("\tCalling MarshalStructAsParam_AsSeqByValSequentialWrapper...");
+                    if (!MarshalStructAsParam_AsSeqByValSequentialWrapper(sequentialWrapper))
+                    {
+                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsSeqByValSequentialWrapper.Expected:True;Actual:False");
+                        failures++;
+                    }
+                    break; 
+                case StructID.SequentialDoubleWrapperId:
+                    SequentialDoubleWrapper doubleWrapper = new SequentialDoubleWrapper
+                    {
+                        wrapper = new SequentialWrapper
+                        {
+                            sequential = Helper.NewInnerSequential(1, 1.0F, "")
+                        }
+                    };
+                    Console.WriteLine("\tCalling MarshalStructAsParam_AsSeqByValSequentialDoubleWrapper...");
+                    if (!MarshalStructAsParam_AsSeqByValSequentialDoubleWrapper(doubleWrapper))
+                    {
+                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsSeqByValSequentialDoubleWrapper.Expected:True;Actual:False");
+                        failures++;
+                    }
+                    break; 
+                case StructID.AggregateSequentialWrapperId:
+                    AggregateSequentialWrapper aggregateWrapper = new AggregateSequentialWrapper
+                    {
+                        wrapper1 = new SequentialWrapper
+                        {
+                            sequential = Helper.NewInnerSequential(1, 1.0F, "")
+                        },
+                        sequential = Helper.NewInnerSequential(1, 1.0F, ""),
+                        wrapper2 = new SequentialWrapper
+                        {
+                            sequential = Helper.NewInnerSequential(1, 1.0F, "")
+                        },
+                    };
+                    Console.WriteLine("\tCalling MarshalStructAsParam_AsSeqByValSequentialAggregateSequentialWrapper...");
+                    if (!MarshalStructAsParam_AsSeqByValSequentialAggregateSequentialWrapper(aggregateWrapper))
+                    {
+                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsSeqByValSequentialAggregateSequentialWrapper.Expected:True;Actual:False");
+                        failures++;
+                    }
+                    break; 
                 default:
                     Console.WriteLine("\tThere is not the struct id");
                     failures++;
@@ -713,17 +785,17 @@ public class Managed
                         failures++;
                     }
                     break;    
-                case StructID.IncludeOuterIntergerStructSequentialId:
-                    IncludeOuterIntergerStructSequential sourceIncludeOuterIntergerStructSequential = Helper.NewIncludeOuterIntergerStructSequential(32, 32);
-                    IncludeOuterIntergerStructSequential changeIncludeOuterIntergerStructSequential = Helper.NewIncludeOuterIntergerStructSequential(64, 64);
+                case StructID.IncludeOuterIntegerStructSequentialId:
+                    IncludeOuterIntegerStructSequential sourceIncludeOuterIntegerStructSequential = Helper.NewIncludeOuterIntegerStructSequential(32, 32);
+                    IncludeOuterIntegerStructSequential changeIncludeOuterIntegerStructSequential = Helper.NewIncludeOuterIntegerStructSequential(64, 64);
 
                     Console.WriteLine("\tCalling MarshalStructAsParam_AsSeqByRef13...");
-                    if (!MarshalStructAsParam_AsSeqByRef13(ref sourceIncludeOuterIntergerStructSequential))
+                    if (!MarshalStructAsParam_AsSeqByRef13(ref sourceIncludeOuterIntegerStructSequential))
                     {
                         Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsSeqByRef13.Expected:True;Actual:False");
                         failures++;
                     }
-                    if (!Helper.ValidateIncludeOuterIntergerStructSequential(sourceIncludeOuterIntergerStructSequential, changeIncludeOuterIntergerStructSequential, "MarshalStructAsParam_AsSeqByRef13"))
+                    if (!Helper.ValidateIncludeOuterIntegerStructSequential(sourceIncludeOuterIntegerStructSequential, changeIncludeOuterIntegerStructSequential, "MarshalStructAsParam_AsSeqByRef13"))
                     {
                         failures++;
                     }
@@ -938,17 +1010,17 @@ public class Managed
                         failures++;
                     }
                     break;    
-                case StructID.IncludeOuterIntergerStructSequentialId:
-                    IncludeOuterIntergerStructSequential sourceIncludeOuterIntergerStructSequential = Helper.NewIncludeOuterIntergerStructSequential(32, 32);
-                    IncludeOuterIntergerStructSequential cloneIncludeOuterIntergerStructSequential = Helper.NewIncludeOuterIntergerStructSequential(32, 32);
+                case StructID.IncludeOuterIntegerStructSequentialId:
+                    IncludeOuterIntegerStructSequential sourceIncludeOuterIntegerStructSequential = Helper.NewIncludeOuterIntegerStructSequential(32, 32);
+                    IncludeOuterIntegerStructSequential cloneIncludeOuterIntegerStructSequential = Helper.NewIncludeOuterIntegerStructSequential(32, 32);
 
                     Console.WriteLine("\tCalling MarshalStructAsParam_AsSeqByValIn13...");
-                    if (!MarshalStructAsParam_AsSeqByValIn13(sourceIncludeOuterIntergerStructSequential))
+                    if (!MarshalStructAsParam_AsSeqByValIn13(sourceIncludeOuterIntegerStructSequential))
                     {
                         Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsSeqByValIn13.Expected:True;Actual:False");
                         failures++;
                     }
-                    if (!Helper.ValidateIncludeOuterIntergerStructSequential(sourceIncludeOuterIntergerStructSequential, cloneIncludeOuterIntergerStructSequential, "MarshalStructAsParam_AsSeqByValIn13"))
+                    if (!Helper.ValidateIncludeOuterIntegerStructSequential(sourceIncludeOuterIntegerStructSequential, cloneIncludeOuterIntegerStructSequential, "MarshalStructAsParam_AsSeqByValIn13"))
                     {
                         failures++;
                     }
@@ -1164,17 +1236,17 @@ public class Managed
                         failures++;
                     }
                     break;    
-                case StructID.IncludeOuterIntergerStructSequentialId:
-                    IncludeOuterIntergerStructSequential sourceIncludeOuterIntergerStructSequential = Helper.NewIncludeOuterIntergerStructSequential(32, 32);
-                    IncludeOuterIntergerStructSequential changeIncludeOuterIntergerStructSequential = Helper.NewIncludeOuterIntergerStructSequential(64, 64);
+                case StructID.IncludeOuterIntegerStructSequentialId:
+                    IncludeOuterIntegerStructSequential sourceIncludeOuterIntegerStructSequential = Helper.NewIncludeOuterIntegerStructSequential(32, 32);
+                    IncludeOuterIntegerStructSequential changeIncludeOuterIntegerStructSequential = Helper.NewIncludeOuterIntegerStructSequential(64, 64);
 
                     Console.WriteLine("\tCalling MarshalStructAsParam_AsSeqByRefIn13...");
-                    if (!MarshalStructAsParam_AsSeqByRefIn13(ref sourceIncludeOuterIntergerStructSequential))
+                    if (!MarshalStructAsParam_AsSeqByRefIn13(ref sourceIncludeOuterIntegerStructSequential))
                     {
                         Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsSeqByRefIn13.Expected:True;Actual:False");
                         failures++;
                     }
-                    if (!Helper.ValidateIncludeOuterIntergerStructSequential(sourceIncludeOuterIntergerStructSequential, changeIncludeOuterIntergerStructSequential, "MarshalStructAsParam_AsSeqByRefIn13"))
+                    if (!Helper.ValidateIncludeOuterIntegerStructSequential(sourceIncludeOuterIntegerStructSequential, changeIncludeOuterIntegerStructSequential, "MarshalStructAsParam_AsSeqByRefIn13"))
                     {
                         failures++;
                     }
@@ -1389,17 +1461,17 @@ public class Managed
                         failures++;
                     }
                     break;    
-                case StructID.IncludeOuterIntergerStructSequentialId:
-                    IncludeOuterIntergerStructSequential sourceIncludeOuterIntergerStructSequential = Helper.NewIncludeOuterIntergerStructSequential(32, 32);
-                    IncludeOuterIntergerStructSequential cloneIncludeOuterIntergerStructSequential = Helper.NewIncludeOuterIntergerStructSequential(32, 32);
+                case StructID.IncludeOuterIntegerStructSequentialId:
+                    IncludeOuterIntegerStructSequential sourceIncludeOuterIntegerStructSequential = Helper.NewIncludeOuterIntegerStructSequential(32, 32);
+                    IncludeOuterIntegerStructSequential cloneIncludeOuterIntegerStructSequential = Helper.NewIncludeOuterIntegerStructSequential(32, 32);
 
                     Console.WriteLine("\tCalling MarshalStructAsParam_AsSeqByValOut13...");
-                    if (!MarshalStructAsParam_AsSeqByValOut13(sourceIncludeOuterIntergerStructSequential))
+                    if (!MarshalStructAsParam_AsSeqByValOut13(sourceIncludeOuterIntegerStructSequential))
                     {
                         Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsSeqByValOut13.Expected:True;Actual:False");
                         failures++;
                     }
-                    if (!Helper.ValidateIncludeOuterIntergerStructSequential(sourceIncludeOuterIntergerStructSequential, cloneIncludeOuterIntergerStructSequential, "MarshalStructAsParam_AsSeqByValOut13"))
+                    if (!Helper.ValidateIncludeOuterIntegerStructSequential(sourceIncludeOuterIntegerStructSequential, cloneIncludeOuterIntegerStructSequential, "MarshalStructAsParam_AsSeqByValOut13"))
                     {
                         failures++;
                     }
@@ -1619,17 +1691,17 @@ public class Managed
                         Console.WriteLine("\tPASSED!");
                     }
                     break;    
-                case StructID.IncludeOuterIntergerStructSequentialId:
-                    IncludeOuterIntergerStructSequential sourceIncludeOuterIntergerStructSequential = Helper.NewIncludeOuterIntergerStructSequential(32, 32);
-                    IncludeOuterIntergerStructSequential changeIncludeOuterIntergerStructSequential = Helper.NewIncludeOuterIntergerStructSequential(64, 64);
+                case StructID.IncludeOuterIntegerStructSequentialId:
+                    IncludeOuterIntegerStructSequential sourceIncludeOuterIntegerStructSequential = Helper.NewIncludeOuterIntegerStructSequential(32, 32);
+                    IncludeOuterIntegerStructSequential changeIncludeOuterIntegerStructSequential = Helper.NewIncludeOuterIntegerStructSequential(64, 64);
 
                     Console.WriteLine("\tCalling MarshalStructAsParam_AsSeqByRefOut13...");
-                    if (!MarshalStructAsParam_AsSeqByRefOut13(out sourceIncludeOuterIntergerStructSequential))
+                    if (!MarshalStructAsParam_AsSeqByRefOut13(out sourceIncludeOuterIntegerStructSequential))
                     {
                         Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsSeqByRefOut13.Expected:True;Actual:False");
                         failures++;
                     }
-                    if (!Helper.ValidateIncludeOuterIntergerStructSequential(sourceIncludeOuterIntergerStructSequential, changeIncludeOuterIntergerStructSequential, "MarshalStructAsParam_AsSeqByRefOut13"))
+                    if (!Helper.ValidateIncludeOuterIntegerStructSequential(sourceIncludeOuterIntegerStructSequential, changeIncludeOuterIntegerStructSequential, "MarshalStructAsParam_AsSeqByRefOut13"))
                     {
                         failures++;
                     }
@@ -1844,17 +1916,17 @@ public class Managed
                         failures++;
                     }
                     break;    
-                case StructID.IncludeOuterIntergerStructSequentialId:
-                    IncludeOuterIntergerStructSequential sourceIncludeOuterIntergerStructSequential = Helper.NewIncludeOuterIntergerStructSequential(32, 32);
-                    IncludeOuterIntergerStructSequential cloneIncludeOuterIntergerStructSequential = Helper.NewIncludeOuterIntergerStructSequential(32, 32);
+                case StructID.IncludeOuterIntegerStructSequentialId:
+                    IncludeOuterIntegerStructSequential sourceIncludeOuterIntegerStructSequential = Helper.NewIncludeOuterIntegerStructSequential(32, 32);
+                    IncludeOuterIntegerStructSequential cloneIncludeOuterIntegerStructSequential = Helper.NewIncludeOuterIntegerStructSequential(32, 32);
 
                     Console.WriteLine("\tCalling MarshalStructAsParam_AsSeqByValInOut13...");
-                    if (!MarshalStructAsParam_AsSeqByValInOut13(sourceIncludeOuterIntergerStructSequential))
+                    if (!MarshalStructAsParam_AsSeqByValInOut13(sourceIncludeOuterIntegerStructSequential))
                     {
                         Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsSeqByValInOut13.Expected:True;Actual:False");
                         failures++;
                     }
-                    if (!Helper.ValidateIncludeOuterIntergerStructSequential(sourceIncludeOuterIntergerStructSequential, cloneIncludeOuterIntergerStructSequential, "MarshalStructAsParam_AsSeqByValInOut13"))
+                    if (!Helper.ValidateIncludeOuterIntegerStructSequential(sourceIncludeOuterIntegerStructSequential, cloneIncludeOuterIntegerStructSequential, "MarshalStructAsParam_AsSeqByValInOut13"))
                     {
                         failures++;
                     }
@@ -2070,17 +2142,17 @@ public class Managed
                         failures++;
                     }
                     break;    
-                case StructID.IncludeOuterIntergerStructSequentialId:
-                    IncludeOuterIntergerStructSequential sourceIncludeOuterIntergerStructSequential = Helper.NewIncludeOuterIntergerStructSequential(32, 32);
-                    IncludeOuterIntergerStructSequential changeIncludeOuterIntergerStructSequential = Helper.NewIncludeOuterIntergerStructSequential(64, 64);
+                case StructID.IncludeOuterIntegerStructSequentialId:
+                    IncludeOuterIntegerStructSequential sourceIncludeOuterIntegerStructSequential = Helper.NewIncludeOuterIntegerStructSequential(32, 32);
+                    IncludeOuterIntegerStructSequential changeIncludeOuterIntegerStructSequential = Helper.NewIncludeOuterIntegerStructSequential(64, 64);
 
                     Console.WriteLine("\tCalling MarshalStructAsParam_AsSeqByRefInOut13...");
-                    if (!MarshalStructAsParam_AsSeqByRefInOut13(ref sourceIncludeOuterIntergerStructSequential))
+                    if (!MarshalStructAsParam_AsSeqByRefInOut13(ref sourceIncludeOuterIntegerStructSequential))
                     {
                         Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsSeqByRefInOut13.Expected:True;Actual:False");
                         failures++;
                     }
-                    if (!Helper.ValidateIncludeOuterIntergerStructSequential(sourceIncludeOuterIntergerStructSequential, changeIncludeOuterIntergerStructSequential, "MarshalStructAsParam_AsSeqByRefInOut13"))
+                    if (!Helper.ValidateIncludeOuterIntegerStructSequential(sourceIncludeOuterIntegerStructSequential, changeIncludeOuterIntegerStructSequential, "MarshalStructAsParam_AsSeqByRefInOut13"))
                     {
                         failures++;
                     }
@@ -2133,8 +2205,12 @@ public class Managed
         MarshalStructAsParam_AsSeqByVal(StructID.StringStructSequentialUnicodeId);
         MarshalStructAsParam_AsSeqByVal(StructID.S8Id);
         MarshalStructAsParam_AsSeqByVal(StructID.S9Id);
-        MarshalStructAsParam_AsSeqByVal(StructID.IncludeOuterIntergerStructSequentialId);
+        MarshalStructAsParam_AsSeqByVal(StructID.IncludeOuterIntegerStructSequentialId);
         MarshalStructAsParam_AsSeqByVal(StructID.S11Id);
+        MarshalStructAsParam_AsSeqByVal(StructID.IntWithInnerSequentialId);
+        MarshalStructAsParam_AsSeqByVal(StructID.SequentialWrapperId);
+        MarshalStructAsParam_AsSeqByVal(StructID.SequentialDoubleWrapperId);
+        MarshalStructAsParam_AsSeqByVal(StructID.AggregateSequentialWrapperId);
     }
 
     [SecuritySafeCritical]
@@ -2156,7 +2232,7 @@ public class Managed
         MarshalStructAsParam_AsSeqByRef(StructID.StringStructSequentialUnicodeId);
         MarshalStructAsParam_AsSeqByRef(StructID.S8Id);
         MarshalStructAsParam_AsSeqByRef(StructID.S9Id);
-        MarshalStructAsParam_AsSeqByRef(StructID.IncludeOuterIntergerStructSequentialId);
+        MarshalStructAsParam_AsSeqByRef(StructID.IncludeOuterIntegerStructSequentialId);
         MarshalStructAsParam_AsSeqByRef(StructID.S11Id);
     }
 
@@ -2179,7 +2255,7 @@ public class Managed
         MarshalStructAsParam_AsSeqByValIn(StructID.StringStructSequentialUnicodeId);
         MarshalStructAsParam_AsSeqByValIn(StructID.S8Id);
         MarshalStructAsParam_AsSeqByValIn(StructID.S9Id);
-        MarshalStructAsParam_AsSeqByValIn(StructID.IncludeOuterIntergerStructSequentialId);
+        MarshalStructAsParam_AsSeqByValIn(StructID.IncludeOuterIntegerStructSequentialId);
         MarshalStructAsParam_AsSeqByValIn(StructID.S11Id);
     }
 
@@ -2202,7 +2278,7 @@ public class Managed
         MarshalStructAsParam_AsSeqByRefIn(StructID.StringStructSequentialUnicodeId);
         MarshalStructAsParam_AsSeqByRefIn(StructID.S8Id);
         MarshalStructAsParam_AsSeqByRefIn(StructID.S9Id);
-        MarshalStructAsParam_AsSeqByRefIn(StructID.IncludeOuterIntergerStructSequentialId);
+        MarshalStructAsParam_AsSeqByRefIn(StructID.IncludeOuterIntegerStructSequentialId);
         MarshalStructAsParam_AsSeqByRefIn(StructID.S11Id);
     }
 
@@ -2225,7 +2301,7 @@ public class Managed
         MarshalStructAsParam_AsSeqByValOut(StructID.StringStructSequentialUnicodeId);
         MarshalStructAsParam_AsSeqByValOut(StructID.S8Id);
         MarshalStructAsParam_AsSeqByValOut(StructID.S9Id);
-        MarshalStructAsParam_AsSeqByValOut(StructID.IncludeOuterIntergerStructSequentialId);
+        MarshalStructAsParam_AsSeqByValOut(StructID.IncludeOuterIntegerStructSequentialId);
         MarshalStructAsParam_AsSeqByValOut(StructID.S11Id);
     }
 
@@ -2248,7 +2324,7 @@ public class Managed
         MarshalStructAsParam_AsSeqByRefOut(StructID.StringStructSequentialUnicodeId);
         MarshalStructAsParam_AsSeqByRefOut(StructID.S8Id);
         MarshalStructAsParam_AsSeqByRefOut(StructID.S9Id);
-        MarshalStructAsParam_AsSeqByRefOut(StructID.IncludeOuterIntergerStructSequentialId);
+        MarshalStructAsParam_AsSeqByRefOut(StructID.IncludeOuterIntegerStructSequentialId);
         MarshalStructAsParam_AsSeqByRefOut(StructID.S11Id);
     }
 
@@ -2271,7 +2347,7 @@ public class Managed
         MarshalStructAsParam_AsSeqByValInOut(StructID.StringStructSequentialUnicodeId);
         MarshalStructAsParam_AsSeqByValInOut(StructID.S8Id);
         MarshalStructAsParam_AsSeqByValInOut(StructID.S9Id);
-        MarshalStructAsParam_AsSeqByValInOut(StructID.IncludeOuterIntergerStructSequentialId);
+        MarshalStructAsParam_AsSeqByValInOut(StructID.IncludeOuterIntegerStructSequentialId);
         MarshalStructAsParam_AsSeqByValInOut(StructID.S11Id);
     }
 
@@ -2294,7 +2370,7 @@ public class Managed
         MarshalStructAsParam_AsSeqByRefInOut(StructID.StringStructSequentialUnicodeId);
         MarshalStructAsParam_AsSeqByRefInOut(StructID.S8Id);
         MarshalStructAsParam_AsSeqByRefInOut(StructID.S9Id);
-        MarshalStructAsParam_AsSeqByRefInOut(StructID.IncludeOuterIntergerStructSequentialId);
+        MarshalStructAsParam_AsSeqByRefInOut(StructID.IncludeOuterIntegerStructSequentialId);
         MarshalStructAsParam_AsSeqByRefInOut(StructID.S11Id);
     }
 }
index 2cdc05e..ef4012f 100644 (file)
@@ -690,12 +690,70 @@ extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByRefOut1
        str1->i = 64;
        return TRUE;
 }
+///////////////////////////////////////////////////////////////////////////////////////
+extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByValIntWithInnerSequential(IntWithInnerSequential str, int i)
+{
+    if (str.i1 != i || !IsCorrectInnerSequential(&str.sequential))
+    {
+        printf("\tMarshalStructAsParam_AsSeqByValIntWithInnerSequential: IntWithInnerSequential param not as expected\n");
+        printf("Expected %d, Got %d for str.i\n", i, str.i1);
+        PrintInnerSequential(&str.sequential, "str.sequential");
+        return FALSE;
+    }
+    return TRUE;
+}
+
+extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByValSequentialWrapper(SequentialWrapper wrapper)
+{
+    if (!IsCorrectInnerSequential(&wrapper.sequential))
+    {
+        printf("\tMarshalStructAsParam_AsSeqByValSequentialWrapper: SequentialWrapper param not as expected\n");
+        PrintInnerSequential(&wrapper.sequential, "wrapper.sequential");
+        return FALSE;
+    }
+    return TRUE;
+}
+
+extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByValSequentialDoubleWrapper(SequentialDoubleWrapper wrapper)
+{
+    if (!IsCorrectInnerSequential(&wrapper.wrapper.sequential))
+    {
+        printf("\tMarshalStructAsParam_AsSeqByValSequentialWrapper: SequentialWrapper param not as expected\n");
+        PrintInnerSequential(&wrapper.wrapper.sequential, "wrapper.sequential");
+        return FALSE;
+    }
+    return TRUE;
+}
+
+extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByValSequentialAggregateSequentialWrapper(AggregateSequentialWrapper wrapper)
+{
+    if (!IsCorrectInnerSequential(&wrapper.wrapper1.sequential))
+    {
+        printf("\tMarshalStructAsParam_AsSeqByValSequentialWrapper: SequentialWrapper param not as expected\n");
+        PrintInnerSequential(&wrapper.wrapper1.sequential, "wrapper.sequential");
+        return FALSE;
+    }
+    if (!IsCorrectInnerSequential(&wrapper.sequential))
+    {
+        printf("\tMarshalStructAsParam_AsSeqByValSequentialWrapper: SequentialWrapper param not as expected\n");
+        PrintInnerSequential(&wrapper.sequential, "wrapper.sequential");
+        return FALSE;
+    }
+    if (!IsCorrectInnerSequential(&wrapper.wrapper2.sequential))
+    {
+        printf("\tMarshalStructAsParam_AsSeqByValSequentialWrapper: SequentialWrapper param not as expected\n");
+        PrintInnerSequential(&wrapper.wrapper2.sequential, "wrapper.sequential");
+        return FALSE;
+    }
+    return TRUE;
+}
+
 //////////////////////////////////////////////////////////////////////////////////////
 extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsExpByValINNER2(INNER2 inner)
 {
        if(!IsCorrectINNER2(&inner))
        {
-               printf("\tMarshalStructAsParam_AsSeqByVal: INNER param not as expected\n");
+               printf("\tMarshalStructAsParam_AsExpByVal: INNER param not as expected\n");
                PrintINNER2(&inner,"inner");
                return FALSE;
        }
@@ -707,7 +765,7 @@ extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsExpByRefINNE
 {
        if(!IsCorrectINNER2(inner))
        {
-               printf("\tMarshalStructAsParam_AsSeqByRef: INNER param not as expected\n");
+               printf("\tMarshalStructAsParam_AsExpByRef: INNER param not as expected\n");
                PrintINNER2(inner,"inner");
                return FALSE;
        }
@@ -718,7 +776,7 @@ extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsExpByRefInIN
 {
        if(!IsCorrectINNER2(inner))
        {
-               printf("\tMarshalStructAsParam_AsSeqByRefIn: INNER param not as expected\n");
+               printf("\tMarshalStructAsParam_AsExpByRefIn: INNER param not as expected\n");
                PrintINNER2(inner,"inner");
                return FALSE;
        }
@@ -730,7 +788,7 @@ extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsExpByValOutI
 {
        if(!IsCorrectINNER2(&inner))
        {
-               printf("\tMarshalStructAsParam_AsSeqByValOut:NNER param not as expected\n");
+               printf("\tMarshalStructAsParam_AsExpByValOut:NNER param not as expected\n");
                PrintINNER2(&inner,"inner");
                return FALSE;
        }
index 6cb379f..0383af4 100644 (file)
@@ -818,3 +818,26 @@ bool IsCorrectLongStructPack16Explicit(LongStructPack16Explicit* p)
                return false;
        return true;
 }
+
+struct IntWithInnerSequential
+{
+    int i1;
+    InnerSequential sequential;
+};
+
+struct SequentialWrapper
+{
+    InnerSequential sequential;
+};
+
+struct SequentialDoubleWrapper
+{
+    SequentialWrapper wrapper;
+};
+
+struct AggregateSequentialWrapper
+{
+    SequentialWrapper wrapper1;
+    InnerSequential sequential;
+    SequentialWrapper wrapper2;
+};
index 282699b..38a466d 100644 (file)
@@ -15,6 +15,33 @@ public struct InnerSequential
 }
 
 [StructLayout(LayoutKind.Sequential)]
+struct IntWithInnerSequential
+{
+    public int i1;
+    public InnerSequential sequential;
+}
+
+[StructLayout(LayoutKind.Sequential)]
+struct SequentialWrapper
+{
+    public InnerSequential sequential;
+}
+
+[StructLayout(LayoutKind.Sequential)]
+struct SequentialDoubleWrapper
+{
+    public SequentialWrapper wrapper;
+}
+
+[StructLayout(LayoutKind.Sequential)]
+struct AggregateSequentialWrapper
+{
+    public SequentialWrapper wrapper1;
+    public InnerSequential sequential;
+    public SequentialWrapper wrapper2;
+}
+
+[StructLayout(LayoutKind.Sequential)]
 public struct ComplexStruct
 {
     public int i;
@@ -184,20 +211,20 @@ public struct S9
 public delegate void TestDelegate1(S9 myStruct);
 
 [StructLayout(LayoutKind.Sequential)]
-public struct IntergerStructSequential
+public struct IntegerStructSequential
 {
     public int i;
 }
 [StructLayout(LayoutKind.Sequential)]
-public struct OuterIntergerStructSequential
+public struct OuterIntegerStructSequential
 {
     public int i;
-    public IntergerStructSequential s_int;
+    public IntegerStructSequential s_int;
 }
 [StructLayout(LayoutKind.Sequential)]
-public struct IncludeOuterIntergerStructSequential
+public struct IncludeOuterIntegerStructSequential
 {
-    public OuterIntergerStructSequential s;
+    public OuterIntegerStructSequential s;
 }
 [StructLayout(LayoutKind.Sequential)]
 public unsafe struct S11