summaryrefslogtreecommitdiff
path: root/tests/src/Loader/classloader/generics/Layout
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src/Loader/classloader/generics/Layout')
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/Base01a_auto.cs232
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/Base01a_auto.csproj39
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/Base01a_auto_ser.cs232
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/Base01a_auto_ser.csproj39
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/Base01a_seq.cs232
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/Base01a_seq.csproj39
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/Base01a_seq_ser.cs232
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/Base01a_seq_ser.csproj39
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/Base01b_auto_ser.cs241
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/Base01b_auto_ser.csproj39
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/Base01b_seq.cs241
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/Base01b_seq.csproj39
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/Base01b_seq_ser.cs242
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/Base01b_seq_ser.csproj39
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/Base01c_seq_ser.cs251
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/Base01c_seq_ser.csproj39
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/Base01d_seq_ser.cs251
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/Base01d_seq_ser.csproj39
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/Base02a_auto.cs138
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/Base02a_auto.csproj39
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/Base02a_auto_ser.cs138
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/Base02a_auto_ser.csproj39
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/Base02a_seq.cs137
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/Base02a_seq.csproj39
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/Base02a_seq_ser.cs138
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/Base02a_seq_ser.csproj39
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/Base02b_auto_ser.cs138
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/Base02b_auto_ser.csproj39
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/Base02b_seq.cs137
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/Base02b_seq.csproj39
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/Base02b_seq_ser.cs138
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/Base02b_seq_ser.csproj39
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/Base02c_seq_ser.cs139
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/Base02c_seq_ser.csproj39
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/Base02d_seq_ser.cs121
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/Base02d_seq_ser.csproj39
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/app.config27
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/class01_auto.cs104
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/class01_auto.csproj39
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/class01_auto_ser.cs104
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/class01_auto_ser.csproj39
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/class01_seq.cs103
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/class01_seq.csproj39
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/class01_seq_ser.cs104
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/class01_seq_ser.csproj39
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/class02_auto.cs159
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/class02_auto.csproj39
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/class02_auto_ser.cs160
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/class02_auto_ser.csproj39
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/class02_seq_ser.cs160
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/class02_seq_ser.csproj39
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/project.json35
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/struct01_auto.cs114
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/struct01_auto.csproj39
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/struct01_auto_ser.cs114
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/struct01_auto_ser.csproj39
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/struct01_seq.cs114
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/struct01_seq.csproj39
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/struct01_seq_ser.cs180
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/struct01_seq_ser.csproj39
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/struct02_auto.cs179
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/struct02_auto.csproj39
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/struct02_auto_ser.cs180
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/struct02_auto_ser.csproj39
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/struct02_seq.cs179
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/struct02_seq.csproj39
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/struct02_seq_ser.cs178
-rw-r--r--tests/src/Loader/classloader/generics/Layout/General/struct02_seq_ser.csproj39
-rw-r--r--tests/src/Loader/classloader/generics/Layout/Specific/Negative002.cs99
-rw-r--r--tests/src/Loader/classloader/generics/Layout/Specific/Negative002.csproj39
-rw-r--r--tests/src/Loader/classloader/generics/Layout/Specific/Negative004.cs95
-rw-r--r--tests/src/Loader/classloader/generics/Layout/Specific/Negative004.csproj39
-rw-r--r--tests/src/Loader/classloader/generics/Layout/Specific/Negative_ExplicitGen.cs214
-rw-r--r--tests/src/Loader/classloader/generics/Layout/Specific/Negative_ExplicitGen.csproj39
-rw-r--r--tests/src/Loader/classloader/generics/Layout/Specific/Positive007.cs99
-rw-r--r--tests/src/Loader/classloader/generics/Layout/Specific/Positive007.csproj39
-rw-r--r--tests/src/Loader/classloader/generics/Layout/Specific/Positive008.cs99
-rw-r--r--tests/src/Loader/classloader/generics/Layout/Specific/Positive008.csproj39
-rw-r--r--tests/src/Loader/classloader/generics/Layout/Specific/Positive009.cs99
-rw-r--r--tests/src/Loader/classloader/generics/Layout/Specific/Positive009.csproj39
-rw-r--r--tests/src/Loader/classloader/generics/Layout/Specific/Positive010.cs99
-rw-r--r--tests/src/Loader/classloader/generics/Layout/Specific/Positive010.csproj39
-rw-r--r--tests/src/Loader/classloader/generics/Layout/Specific/app.config27
-rw-r--r--tests/src/Loader/classloader/generics/Layout/Specific/project.json35
84 files changed, 7998 insertions, 0 deletions
diff --git a/tests/src/Loader/classloader/generics/Layout/General/Base01a_auto.cs b/tests/src/Loader/classloader/generics/Layout/General/Base01a_auto.cs
new file mode 100644
index 0000000000..5a64b9c6d9
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/Base01a_auto.cs
@@ -0,0 +1,232 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+
+
+
+public struct ValX1<T> {}
+public struct ValX2<T,U> {}
+public struct ValX3<T,U,V>{}
+public class RefX1<T> {}
+public class RefX2<T,U> {}
+public class RefX3<T,U,V>{}
+
+
+[StructLayout(LayoutKind.Auto)]
+public class GenBase<T>
+{
+ public T Fld10;
+
+ public int _int0 = 0;
+ public double _double0 = 0;
+ public string _string0 = "string0";
+ public Guid _Guid0 = new Guid();
+
+ public T Fld11;
+
+ public int _int1 = int.MaxValue;
+ public double _double1 = double.MaxValue;
+ public string _string1 = "string1";
+ public Guid _Guid1 = new Guid(1,2,3,4,5,6,7,8,9,10,11);
+
+ public T Fld12;
+
+
+}
+
+public class GenInt : GenBase<int>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+public class GenDouble: GenBase<double>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+public class GenString : GenBase<String>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+public class GenObject : GenBase<object>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+public class GenGuid : GenBase<Guid>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+public class GenConstructedReference : GenBase<RefX1<int>>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+public class GenConstructedValue: GenBase<ValX1<string>>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+public class GenInt1DArray : GenBase<int[]>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+public class GenString2DArray : GenBase<string[,]>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+public class GenIntJaggedArray : GenBase<int[][]>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new GenInt().VerifyLayout();
+ new GenDouble().VerifyLayout();
+ new GenString().VerifyLayout();
+ new GenObject().VerifyLayout();
+ new GenGuid().VerifyLayout();
+ new GenConstructedReference().VerifyLayout();
+ new GenConstructedValue().VerifyLayout();
+ new GenInt1DArray().VerifyLayout();
+ new GenString2DArray().VerifyLayout();
+ new GenIntJaggedArray().VerifyLayout();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/Loader/classloader/generics/Layout/General/Base01a_auto.csproj b/tests/src/Loader/classloader/generics/Layout/General/Base01a_auto.csproj
new file mode 100644
index 0000000000..6c248cd904
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/Base01a_auto.csproj
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <AssemblyName>Base01a_auto</AssemblyName>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <OutputType>Exe</OutputType>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Include="Base01a_auto.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="project.json" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Loader/classloader/generics/Layout/General/Base01a_auto_ser.cs b/tests/src/Loader/classloader/generics/Layout/General/Base01a_auto_ser.cs
new file mode 100644
index 0000000000..5a64b9c6d9
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/Base01a_auto_ser.cs
@@ -0,0 +1,232 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+
+
+
+public struct ValX1<T> {}
+public struct ValX2<T,U> {}
+public struct ValX3<T,U,V>{}
+public class RefX1<T> {}
+public class RefX2<T,U> {}
+public class RefX3<T,U,V>{}
+
+
+[StructLayout(LayoutKind.Auto)]
+public class GenBase<T>
+{
+ public T Fld10;
+
+ public int _int0 = 0;
+ public double _double0 = 0;
+ public string _string0 = "string0";
+ public Guid _Guid0 = new Guid();
+
+ public T Fld11;
+
+ public int _int1 = int.MaxValue;
+ public double _double1 = double.MaxValue;
+ public string _string1 = "string1";
+ public Guid _Guid1 = new Guid(1,2,3,4,5,6,7,8,9,10,11);
+
+ public T Fld12;
+
+
+}
+
+public class GenInt : GenBase<int>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+public class GenDouble: GenBase<double>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+public class GenString : GenBase<String>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+public class GenObject : GenBase<object>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+public class GenGuid : GenBase<Guid>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+public class GenConstructedReference : GenBase<RefX1<int>>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+public class GenConstructedValue: GenBase<ValX1<string>>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+public class GenInt1DArray : GenBase<int[]>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+public class GenString2DArray : GenBase<string[,]>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+public class GenIntJaggedArray : GenBase<int[][]>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new GenInt().VerifyLayout();
+ new GenDouble().VerifyLayout();
+ new GenString().VerifyLayout();
+ new GenObject().VerifyLayout();
+ new GenGuid().VerifyLayout();
+ new GenConstructedReference().VerifyLayout();
+ new GenConstructedValue().VerifyLayout();
+ new GenInt1DArray().VerifyLayout();
+ new GenString2DArray().VerifyLayout();
+ new GenIntJaggedArray().VerifyLayout();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/Loader/classloader/generics/Layout/General/Base01a_auto_ser.csproj b/tests/src/Loader/classloader/generics/Layout/General/Base01a_auto_ser.csproj
new file mode 100644
index 0000000000..46df91d85f
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/Base01a_auto_ser.csproj
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <AssemblyName>Base01a_auto_ser</AssemblyName>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <OutputType>Exe</OutputType>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Include="Base01a_auto_ser.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="project.json" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Loader/classloader/generics/Layout/General/Base01a_seq.cs b/tests/src/Loader/classloader/generics/Layout/General/Base01a_seq.cs
new file mode 100644
index 0000000000..fedc682b08
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/Base01a_seq.cs
@@ -0,0 +1,232 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+
+
+
+public struct ValX1<T> {}
+public struct ValX2<T,U> {}
+public struct ValX3<T,U,V>{}
+public class RefX1<T> {}
+public class RefX2<T,U> {}
+public class RefX3<T,U,V>{}
+
+
+[StructLayout(LayoutKind.Sequential)]
+public class GenBase<T>
+{
+ public T Fld10;
+
+ public int _int0 = 0;
+ public double _double0 = 0;
+ public string _string0 = "string0";
+ public Guid _Guid0 = new Guid();
+
+ public T Fld11;
+
+ public int _int1 = int.MaxValue;
+ public double _double1 = double.MaxValue;
+ public string _string1 = "string1";
+ public Guid _Guid1 = new Guid(1,2,3,4,5,6,7,8,9,10,11);
+
+ public T Fld12;
+
+
+}
+
+public class GenInt : GenBase<int>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+public class GenDouble: GenBase<double>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+public class GenString : GenBase<String>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+public class GenObject : GenBase<object>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+public class GenGuid : GenBase<Guid>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+public class GenConstructedReference : GenBase<RefX1<int>>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+public class GenConstructedValue: GenBase<ValX1<string>>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+public class GenInt1DArray : GenBase<int[]>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+public class GenString2DArray : GenBase<string[,]>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+public class GenIntJaggedArray : GenBase<int[][]>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new GenInt().VerifyLayout();
+ new GenDouble().VerifyLayout();
+ new GenString().VerifyLayout();
+ new GenObject().VerifyLayout();
+ new GenGuid().VerifyLayout();
+ new GenConstructedReference().VerifyLayout();
+ new GenConstructedValue().VerifyLayout();
+ new GenInt1DArray().VerifyLayout();
+ new GenString2DArray().VerifyLayout();
+ new GenIntJaggedArray().VerifyLayout();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/Loader/classloader/generics/Layout/General/Base01a_seq.csproj b/tests/src/Loader/classloader/generics/Layout/General/Base01a_seq.csproj
new file mode 100644
index 0000000000..dc12d9cd48
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/Base01a_seq.csproj
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <AssemblyName>Base01a_seq</AssemblyName>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <OutputType>Exe</OutputType>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Include="Base01a_seq.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="project.json" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Loader/classloader/generics/Layout/General/Base01a_seq_ser.cs b/tests/src/Loader/classloader/generics/Layout/General/Base01a_seq_ser.cs
new file mode 100644
index 0000000000..fedc682b08
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/Base01a_seq_ser.cs
@@ -0,0 +1,232 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+
+
+
+public struct ValX1<T> {}
+public struct ValX2<T,U> {}
+public struct ValX3<T,U,V>{}
+public class RefX1<T> {}
+public class RefX2<T,U> {}
+public class RefX3<T,U,V>{}
+
+
+[StructLayout(LayoutKind.Sequential)]
+public class GenBase<T>
+{
+ public T Fld10;
+
+ public int _int0 = 0;
+ public double _double0 = 0;
+ public string _string0 = "string0";
+ public Guid _Guid0 = new Guid();
+
+ public T Fld11;
+
+ public int _int1 = int.MaxValue;
+ public double _double1 = double.MaxValue;
+ public string _string1 = "string1";
+ public Guid _Guid1 = new Guid(1,2,3,4,5,6,7,8,9,10,11);
+
+ public T Fld12;
+
+
+}
+
+public class GenInt : GenBase<int>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+public class GenDouble: GenBase<double>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+public class GenString : GenBase<String>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+public class GenObject : GenBase<object>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+public class GenGuid : GenBase<Guid>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+public class GenConstructedReference : GenBase<RefX1<int>>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+public class GenConstructedValue: GenBase<ValX1<string>>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+public class GenInt1DArray : GenBase<int[]>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+public class GenString2DArray : GenBase<string[,]>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+public class GenIntJaggedArray : GenBase<int[][]>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new GenInt().VerifyLayout();
+ new GenDouble().VerifyLayout();
+ new GenString().VerifyLayout();
+ new GenObject().VerifyLayout();
+ new GenGuid().VerifyLayout();
+ new GenConstructedReference().VerifyLayout();
+ new GenConstructedValue().VerifyLayout();
+ new GenInt1DArray().VerifyLayout();
+ new GenString2DArray().VerifyLayout();
+ new GenIntJaggedArray().VerifyLayout();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/Loader/classloader/generics/Layout/General/Base01a_seq_ser.csproj b/tests/src/Loader/classloader/generics/Layout/General/Base01a_seq_ser.csproj
new file mode 100644
index 0000000000..7382a93218
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/Base01a_seq_ser.csproj
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <AssemblyName>Base01a_seq_ser</AssemblyName>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <OutputType>Exe</OutputType>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Include="Base01a_seq_ser.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="project.json" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Loader/classloader/generics/Layout/General/Base01b_auto_ser.cs b/tests/src/Loader/classloader/generics/Layout/General/Base01b_auto_ser.cs
new file mode 100644
index 0000000000..9011ac1a16
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/Base01b_auto_ser.cs
@@ -0,0 +1,241 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+
+
+
+public struct ValX1<T> {}
+public struct ValX2<T,U> {}
+public struct ValX3<T,U,V>{}
+public class RefX1<T> {}
+public class RefX2<T,U> {}
+public class RefX3<T,U,V>{}
+
+
+[StructLayout(LayoutKind.Auto)]
+public class GenBase<T>
+{
+ public T Fld10;
+
+ public int _int0 = 0;
+ public double _double0 = 0;
+ public string _string0 = "string0";
+ public Guid _Guid0 = new Guid();
+
+ public T Fld11;
+
+ public int _int1 = int.MaxValue;
+ public double _double1 = double.MaxValue;
+ public string _string1 = "string1";
+ public Guid _Guid1 = new Guid(1,2,3,4,5,6,7,8,9,10,11);
+
+ public T Fld12;
+
+
+}
+
+
+public class GenInt : GenBase<int>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+public class GenDouble: GenBase<double>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+public class GenString : GenBase<String>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+public class GenObject : GenBase<object>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+public class GenGuid : GenBase<Guid>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+public class GenConstructedReference : GenBase<RefX1<int>>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+public class GenConstructedValue: GenBase<ValX1<string>>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+public class GenInt1DArray : GenBase<int[]>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+public class GenString2DArray : GenBase<string[,]>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+public class GenIntJaggedArray : GenBase<int[][]>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new GenInt().VerifyLayout();
+ new GenDouble().VerifyLayout();
+ new GenString().VerifyLayout();
+ new GenObject().VerifyLayout();
+ new GenGuid().VerifyLayout();
+ new GenConstructedReference().VerifyLayout();
+ new GenConstructedValue().VerifyLayout();
+ new GenInt1DArray().VerifyLayout();
+ new GenString2DArray().VerifyLayout();
+ new GenIntJaggedArray().VerifyLayout();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/Loader/classloader/generics/Layout/General/Base01b_auto_ser.csproj b/tests/src/Loader/classloader/generics/Layout/General/Base01b_auto_ser.csproj
new file mode 100644
index 0000000000..e5a72965f5
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/Base01b_auto_ser.csproj
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <AssemblyName>Base01b_auto_ser</AssemblyName>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <OutputType>Exe</OutputType>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Include="Base01b_auto_ser.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="project.json" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Loader/classloader/generics/Layout/General/Base01b_seq.cs b/tests/src/Loader/classloader/generics/Layout/General/Base01b_seq.cs
new file mode 100644
index 0000000000..fbf274b9d1
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/Base01b_seq.cs
@@ -0,0 +1,241 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+
+
+
+public struct ValX1<T> {}
+public struct ValX2<T,U> {}
+public struct ValX3<T,U,V>{}
+public class RefX1<T> {}
+public class RefX2<T,U> {}
+public class RefX3<T,U,V>{}
+
+
+[StructLayout(LayoutKind.Sequential)]
+public class GenBase<T>
+{
+ public T Fld10;
+
+ public int _int0 = 0;
+ public double _double0 = 0;
+ public string _string0 = "string0";
+ public Guid _Guid0 = new Guid();
+
+ public T Fld11;
+
+ public int _int1 = int.MaxValue;
+ public double _double1 = double.MaxValue;
+ public string _string1 = "string1";
+ public Guid _Guid1 = new Guid(1,2,3,4,5,6,7,8,9,10,11);
+
+ public T Fld12;
+
+
+}
+
+[StructLayout(LayoutKind.Sequential)]
+public class GenInt : GenBase<int>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+[StructLayout(LayoutKind.Sequential)]
+public class GenDouble: GenBase<double>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+[StructLayout(LayoutKind.Sequential)]
+public class GenString : GenBase<String>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+[StructLayout(LayoutKind.Sequential)]
+public class GenObject : GenBase<object>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+[StructLayout(LayoutKind.Sequential)]
+public class GenGuid : GenBase<Guid>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+[StructLayout(LayoutKind.Sequential)]
+public class GenConstructedReference : GenBase<RefX1<int>>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+[StructLayout(LayoutKind.Sequential)]
+public class GenConstructedValue: GenBase<ValX1<string>>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+[StructLayout(LayoutKind.Sequential)]
+public class GenInt1DArray : GenBase<int[]>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+[StructLayout(LayoutKind.Sequential)]
+public class GenString2DArray : GenBase<string[,]>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+[StructLayout(LayoutKind.Sequential)]
+public class GenIntJaggedArray : GenBase<int[][]>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new GenInt().VerifyLayout();
+ new GenDouble().VerifyLayout();
+ new GenString().VerifyLayout();
+ new GenObject().VerifyLayout();
+ new GenGuid().VerifyLayout();
+ new GenConstructedReference().VerifyLayout();
+ new GenConstructedValue().VerifyLayout();
+ new GenInt1DArray().VerifyLayout();
+ new GenString2DArray().VerifyLayout();
+ new GenIntJaggedArray().VerifyLayout();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/Loader/classloader/generics/Layout/General/Base01b_seq.csproj b/tests/src/Loader/classloader/generics/Layout/General/Base01b_seq.csproj
new file mode 100644
index 0000000000..85171c1810
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/Base01b_seq.csproj
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <AssemblyName>Base01b_seq</AssemblyName>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <OutputType>Exe</OutputType>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Include="Base01b_seq.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="project.json" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Loader/classloader/generics/Layout/General/Base01b_seq_ser.cs b/tests/src/Loader/classloader/generics/Layout/General/Base01b_seq_ser.cs
new file mode 100644
index 0000000000..f7ffd00170
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/Base01b_seq_ser.cs
@@ -0,0 +1,242 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+
+
+
+public struct ValX1<T> {}
+public struct ValX2<T,U> {}
+public struct ValX3<T,U,V>{}
+public class RefX1<T> {}
+public class RefX2<T,U> {}
+public class RefX3<T,U,V>{}
+
+
+[StructLayout(LayoutKind.Sequential)]
+public class GenBase<T>
+{
+ public T Fld10;
+
+ public int _int0 = 0;
+ public double _double0 = 0;
+ public string _string0 = "string0";
+ public Guid _Guid0 = new Guid();
+
+ public T Fld11;
+
+ public int _int1 = int.MaxValue;
+ public double _double1 = double.MaxValue;
+ public string _string1 = "string1";
+ public Guid _Guid1 = new Guid(1,2,3,4,5,6,7,8,9,10,11);
+
+ public T Fld12;
+
+
+}
+
+[StructLayout(LayoutKind.Sequential)]
+public class GenInt : GenBase<int>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+[StructLayout(LayoutKind.Sequential)]
+public class GenDouble: GenBase<double>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+[StructLayout(LayoutKind.Sequential)]
+public class GenString : GenBase<String>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+[StructLayout(LayoutKind.Sequential)]
+public class GenObject : GenBase<object>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+[StructLayout(LayoutKind.Sequential)]
+public class GenGuid : GenBase<Guid>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+[StructLayout(LayoutKind.Sequential)]
+public class GenConstructedReference : GenBase<RefX1<int>>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+[StructLayout(LayoutKind.Sequential)]
+public class GenConstructedValue: GenBase<ValX1<string>>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+[StructLayout(LayoutKind.Sequential)]
+public class GenInt1DArray : GenBase<int[]>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+[StructLayout(LayoutKind.Sequential)]
+public class GenString2DArray : GenBase<string[,]>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+[StructLayout(LayoutKind.Sequential)]
+public class GenIntJaggedArray : GenBase<int[][]>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new GenInt().VerifyLayout();
+ new GenDouble().VerifyLayout();
+ new GenString().VerifyLayout();
+ new GenObject().VerifyLayout();
+ new GenGuid().VerifyLayout();
+ new GenConstructedReference().VerifyLayout();
+ new GenConstructedValue().VerifyLayout();
+ new GenInt1DArray().VerifyLayout();
+ new GenString2DArray().VerifyLayout();
+ new GenIntJaggedArray().VerifyLayout();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/Loader/classloader/generics/Layout/General/Base01b_seq_ser.csproj b/tests/src/Loader/classloader/generics/Layout/General/Base01b_seq_ser.csproj
new file mode 100644
index 0000000000..29c8073eed
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/Base01b_seq_ser.csproj
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <AssemblyName>Base01b_seq_ser</AssemblyName>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <OutputType>Exe</OutputType>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Include="Base01b_seq_ser.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="project.json" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Loader/classloader/generics/Layout/General/Base01c_seq_ser.cs b/tests/src/Loader/classloader/generics/Layout/General/Base01c_seq_ser.cs
new file mode 100644
index 0000000000..4a5cd36d8f
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/Base01c_seq_ser.cs
@@ -0,0 +1,251 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+
+
+
+public struct ValX1<T> {}
+public struct ValX2<T,U> {}
+public struct ValX3<T,U,V>{}
+public class RefX1<T> {}
+public class RefX2<T,U> {}
+public class RefX3<T,U,V>{}
+
+
+[StructLayout(LayoutKind.Sequential)]
+public class GenBase<T>
+{
+ public T Fld10;
+
+ public int _int0 = 0;
+ public double _double0 = 0;
+ public string _string0 = "string0";
+ public Guid _Guid0 = new Guid();
+
+ public T Fld11;
+
+ public int _int1 = int.MaxValue;
+ public double _double1 = double.MaxValue;
+ public string _string1 = "string1";
+ public Guid _Guid1 = new Guid(1,2,3,4,5,6,7,8,9,10,11);
+
+ public T Fld12;
+
+
+}
+
+
+[StructLayout(LayoutKind.Sequential)]
+public class GenInt : GenBase<int>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+[StructLayout(LayoutKind.Sequential)]
+public class GenDouble: GenBase<double>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+[StructLayout(LayoutKind.Sequential)]
+public class GenString : GenBase<String>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+[StructLayout(LayoutKind.Sequential)]
+public class GenObject : GenBase<object>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+[StructLayout(LayoutKind.Sequential)]
+public class GenGuid : GenBase<Guid>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+[StructLayout(LayoutKind.Sequential)]
+public class GenConstructedReference : GenBase<RefX1<int>>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+[StructLayout(LayoutKind.Sequential)]
+public class GenConstructedValue: GenBase<ValX1<string>>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+[StructLayout(LayoutKind.Sequential)]
+public class GenInt1DArray : GenBase<int[]>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+[StructLayout(LayoutKind.Sequential)]
+public class GenString2DArray : GenBase<string[,]>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+[StructLayout(LayoutKind.Sequential)]
+public class GenIntJaggedArray : GenBase<int[][]>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new GenInt().VerifyLayout();
+ new GenDouble().VerifyLayout();
+ new GenString().VerifyLayout();
+ new GenObject().VerifyLayout();
+ new GenGuid().VerifyLayout();
+ new GenConstructedReference().VerifyLayout();
+ new GenConstructedValue().VerifyLayout();
+ new GenInt1DArray().VerifyLayout();
+ new GenString2DArray().VerifyLayout();
+ new GenIntJaggedArray().VerifyLayout();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/Loader/classloader/generics/Layout/General/Base01c_seq_ser.csproj b/tests/src/Loader/classloader/generics/Layout/General/Base01c_seq_ser.csproj
new file mode 100644
index 0000000000..ad448301cb
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/Base01c_seq_ser.csproj
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <AssemblyName>Base01c_seq_ser</AssemblyName>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <OutputType>Exe</OutputType>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Include="Base01c_seq_ser.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="project.json" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Loader/classloader/generics/Layout/General/Base01d_seq_ser.cs b/tests/src/Loader/classloader/generics/Layout/General/Base01d_seq_ser.cs
new file mode 100644
index 0000000000..9407aff9a7
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/Base01d_seq_ser.cs
@@ -0,0 +1,251 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+
+
+
+public struct ValX1<T> {}
+public struct ValX2<T,U> {}
+public struct ValX3<T,U,V>{}
+public class RefX1<T> {}
+public class RefX2<T,U> {}
+public class RefX3<T,U,V>{}
+
+
+[StructLayout(LayoutKind.Sequential)]
+public class GenBase<T>
+{
+ public T Fld10;
+
+ public int _int0 = 0;
+ public double _double0 = 0;
+ public string _string0 = "string0";
+ public Guid _Guid0 = new Guid();
+
+ public T Fld11;
+
+ public int _int1 = int.MaxValue;
+ public double _double1 = double.MaxValue;
+ public string _string1 = "string1";
+ public Guid _Guid1 = new Guid(1,2,3,4,5,6,7,8,9,10,11);
+
+ public T Fld12;
+
+
+}
+
+
+[StructLayout(LayoutKind.Explicit)]
+public class GenInt : GenBase<int>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+[StructLayout(LayoutKind.Explicit)]
+public class GenDouble: GenBase<double>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+[StructLayout(LayoutKind.Explicit)]
+public class GenString : GenBase<String>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+[StructLayout(LayoutKind.Explicit)]
+public class GenObject : GenBase<object>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+[StructLayout(LayoutKind.Explicit)]
+public class GenGuid : GenBase<Guid>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+[StructLayout(LayoutKind.Explicit)]
+public class GenConstructedReference : GenBase<RefX1<int>>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+[StructLayout(LayoutKind.Explicit)]
+public class GenConstructedValue: GenBase<ValX1<string>>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+[StructLayout(LayoutKind.Explicit)]
+public class GenInt1DArray : GenBase<int[]>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+[StructLayout(LayoutKind.Explicit)]
+public class GenString2DArray : GenBase<string[,]>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+[StructLayout(LayoutKind.Explicit)]
+public class GenIntJaggedArray : GenBase<int[][]>
+{
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(base._string0.Equals("string0"));
+ Test.Eval(base._string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new GenInt().VerifyLayout();
+ new GenDouble().VerifyLayout();
+ new GenString().VerifyLayout();
+ new GenObject().VerifyLayout();
+ new GenGuid().VerifyLayout();
+ new GenConstructedReference().VerifyLayout();
+ new GenConstructedValue().VerifyLayout();
+ new GenInt1DArray().VerifyLayout();
+ new GenString2DArray().VerifyLayout();
+ new GenIntJaggedArray().VerifyLayout();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/Loader/classloader/generics/Layout/General/Base01d_seq_ser.csproj b/tests/src/Loader/classloader/generics/Layout/General/Base01d_seq_ser.csproj
new file mode 100644
index 0000000000..82200ebf45
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/Base01d_seq_ser.csproj
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <AssemblyName>Base01d_seq_ser</AssemblyName>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <OutputType>Exe</OutputType>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Include="Base01d_seq_ser.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="project.json" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Loader/classloader/generics/Layout/General/Base02a_auto.cs b/tests/src/Loader/classloader/generics/Layout/General/Base02a_auto.cs
new file mode 100644
index 0000000000..c9f4ca3aa4
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/Base02a_auto.cs
@@ -0,0 +1,138 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+
+
+
+public struct ValX1<T> {}
+public struct ValX2<T,U> {}
+public struct ValX3<T,U,V>{}
+public class RefX1<T> {}
+public class RefX2<T,U> {}
+public class RefX3<T,U,V>{}
+
+
+[StructLayout(LayoutKind.Auto)]
+public class GenBase<T>
+{
+ public T Fld10;
+
+ public int _int0 = 0;
+ public double _double0 = 0;
+ public string _string0 = "string0";
+ public Guid _Guid0 = new Guid();
+
+ public T Fld11;
+
+ public int _int1 = int.MaxValue;
+ public double _double1 = double.MaxValue;
+ public string _string1 = "string1";
+ public Guid _Guid1 = new Guid(1,2,3,4,5,6,7,8,9,10,11);
+
+ public T Fld12;
+
+ public virtual void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(_string0.Equals("string0"));
+ Test.Eval(_string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+public class Gen<T> : GenBase<T>
+{
+ public T sFld10;
+
+ public int _sint0 = 0;
+ public double _sdouble0 = 0;
+ public string _sstring0 = "string0";
+ public Guid _sGuid0 = new Guid();
+
+ public T sFld11;
+
+ public int _sint1 = int.MaxValue;
+ public double _sdouble1 = double.MaxValue;
+ public string _sstring1 = "string1";
+ public Guid _sGuid1 = new Guid(1,2,3,4,5,6,7,8,9,10,11);
+
+ public T sFld12;
+
+ public override void VerifyLayout()
+ {
+ base.VerifyLayout();
+ Test.Eval(_sint0 == 0);
+ Test.Eval(_sint1 == int.MaxValue) ;
+ Test.Eval(_sdouble0 == 0) ;
+ Test.Eval(_sdouble1 == double.MaxValue) ;
+ Test.Eval(_sstring0.Equals("string0"));
+ Test.Eval(_sstring1.Equals("string1"));
+ Test.Eval(_sGuid0 == new Guid());
+ Test.Eval(_sGuid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int>().VerifyLayout();
+ new Gen<double>().VerifyLayout();
+ new Gen<string>().VerifyLayout();
+ new Gen<object>().VerifyLayout();
+ new Gen<Guid>().VerifyLayout();
+
+ new Gen<int[]>().VerifyLayout();
+ new Gen<double[,]>().VerifyLayout();
+ new Gen<string[][][]>().VerifyLayout();
+ new Gen<object[,,,]>().VerifyLayout();
+ new Gen<Guid[][,,,][]>().VerifyLayout();
+
+ new Gen<RefX1<int>[]>().VerifyLayout();
+ new Gen<RefX1<double>[,]>().VerifyLayout();
+ new Gen<RefX1<string>[][][]>().VerifyLayout();
+ new Gen<RefX1<object>[,,,]>().VerifyLayout();
+ new Gen<RefX1<Guid>[][,,,][]>().VerifyLayout();
+
+ new Gen<ValX1<int>[]>().VerifyLayout();
+ new Gen<ValX1<double>[,]>().VerifyLayout();
+ new Gen<ValX1<string>[][][]>().VerifyLayout();
+ new Gen<ValX1<object>[,,,]>().VerifyLayout();
+ new Gen<ValX1<Guid>[][,,,][]>().VerifyLayout();
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/Loader/classloader/generics/Layout/General/Base02a_auto.csproj b/tests/src/Loader/classloader/generics/Layout/General/Base02a_auto.csproj
new file mode 100644
index 0000000000..d137ab7b65
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/Base02a_auto.csproj
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <AssemblyName>Base02a_auto</AssemblyName>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <OutputType>Exe</OutputType>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Include="Base02a_auto.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="project.json" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Loader/classloader/generics/Layout/General/Base02a_auto_ser.cs b/tests/src/Loader/classloader/generics/Layout/General/Base02a_auto_ser.cs
new file mode 100644
index 0000000000..c9f4ca3aa4
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/Base02a_auto_ser.cs
@@ -0,0 +1,138 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+
+
+
+public struct ValX1<T> {}
+public struct ValX2<T,U> {}
+public struct ValX3<T,U,V>{}
+public class RefX1<T> {}
+public class RefX2<T,U> {}
+public class RefX3<T,U,V>{}
+
+
+[StructLayout(LayoutKind.Auto)]
+public class GenBase<T>
+{
+ public T Fld10;
+
+ public int _int0 = 0;
+ public double _double0 = 0;
+ public string _string0 = "string0";
+ public Guid _Guid0 = new Guid();
+
+ public T Fld11;
+
+ public int _int1 = int.MaxValue;
+ public double _double1 = double.MaxValue;
+ public string _string1 = "string1";
+ public Guid _Guid1 = new Guid(1,2,3,4,5,6,7,8,9,10,11);
+
+ public T Fld12;
+
+ public virtual void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(_string0.Equals("string0"));
+ Test.Eval(_string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+public class Gen<T> : GenBase<T>
+{
+ public T sFld10;
+
+ public int _sint0 = 0;
+ public double _sdouble0 = 0;
+ public string _sstring0 = "string0";
+ public Guid _sGuid0 = new Guid();
+
+ public T sFld11;
+
+ public int _sint1 = int.MaxValue;
+ public double _sdouble1 = double.MaxValue;
+ public string _sstring1 = "string1";
+ public Guid _sGuid1 = new Guid(1,2,3,4,5,6,7,8,9,10,11);
+
+ public T sFld12;
+
+ public override void VerifyLayout()
+ {
+ base.VerifyLayout();
+ Test.Eval(_sint0 == 0);
+ Test.Eval(_sint1 == int.MaxValue) ;
+ Test.Eval(_sdouble0 == 0) ;
+ Test.Eval(_sdouble1 == double.MaxValue) ;
+ Test.Eval(_sstring0.Equals("string0"));
+ Test.Eval(_sstring1.Equals("string1"));
+ Test.Eval(_sGuid0 == new Guid());
+ Test.Eval(_sGuid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int>().VerifyLayout();
+ new Gen<double>().VerifyLayout();
+ new Gen<string>().VerifyLayout();
+ new Gen<object>().VerifyLayout();
+ new Gen<Guid>().VerifyLayout();
+
+ new Gen<int[]>().VerifyLayout();
+ new Gen<double[,]>().VerifyLayout();
+ new Gen<string[][][]>().VerifyLayout();
+ new Gen<object[,,,]>().VerifyLayout();
+ new Gen<Guid[][,,,][]>().VerifyLayout();
+
+ new Gen<RefX1<int>[]>().VerifyLayout();
+ new Gen<RefX1<double>[,]>().VerifyLayout();
+ new Gen<RefX1<string>[][][]>().VerifyLayout();
+ new Gen<RefX1<object>[,,,]>().VerifyLayout();
+ new Gen<RefX1<Guid>[][,,,][]>().VerifyLayout();
+
+ new Gen<ValX1<int>[]>().VerifyLayout();
+ new Gen<ValX1<double>[,]>().VerifyLayout();
+ new Gen<ValX1<string>[][][]>().VerifyLayout();
+ new Gen<ValX1<object>[,,,]>().VerifyLayout();
+ new Gen<ValX1<Guid>[][,,,][]>().VerifyLayout();
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/Loader/classloader/generics/Layout/General/Base02a_auto_ser.csproj b/tests/src/Loader/classloader/generics/Layout/General/Base02a_auto_ser.csproj
new file mode 100644
index 0000000000..6997ce8acf
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/Base02a_auto_ser.csproj
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <AssemblyName>Base02a_auto_ser</AssemblyName>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <OutputType>Exe</OutputType>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Include="Base02a_auto_ser.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="project.json" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Loader/classloader/generics/Layout/General/Base02a_seq.cs b/tests/src/Loader/classloader/generics/Layout/General/Base02a_seq.cs
new file mode 100644
index 0000000000..adb0de509a
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/Base02a_seq.cs
@@ -0,0 +1,137 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+
+
+
+public struct ValX1<T> {}
+public struct ValX2<T,U> {}
+public struct ValX3<T,U,V>{}
+public class RefX1<T> {}
+public class RefX2<T,U> {}
+public class RefX3<T,U,V>{}
+
+[StructLayout(LayoutKind.Sequential)]
+public class GenBase<T>
+{
+ public T Fld10;
+
+ public int _int0 = 0;
+ public double _double0 = 0;
+ public string _string0 = "string0";
+ public Guid _Guid0 = new Guid();
+
+ public T Fld11;
+
+ public int _int1 = int.MaxValue;
+ public double _double1 = double.MaxValue;
+ public string _string1 = "string1";
+ public Guid _Guid1 = new Guid(1,2,3,4,5,6,7,8,9,10,11);
+
+ public T Fld12;
+
+ public virtual void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(_string0.Equals("string0"));
+ Test.Eval(_string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+public class Gen<T> : GenBase<T>
+{
+ public T sFld10;
+
+ public int _sint0 = 0;
+ public double _sdouble0 = 0;
+ public string _sstring0 = "string0";
+ public Guid _sGuid0 = new Guid();
+
+ public T sFld11;
+
+ public int _sint1 = int.MaxValue;
+ public double _sdouble1 = double.MaxValue;
+ public string _sstring1 = "string1";
+ public Guid _sGuid1 = new Guid(1,2,3,4,5,6,7,8,9,10,11);
+
+ public T sFld12;
+
+ public override void VerifyLayout()
+ {
+ base.VerifyLayout();
+ Test.Eval(_sint0 == 0);
+ Test.Eval(_sint1 == int.MaxValue) ;
+ Test.Eval(_sdouble0 == 0) ;
+ Test.Eval(_sdouble1 == double.MaxValue) ;
+ Test.Eval(_sstring0.Equals("string0"));
+ Test.Eval(_sstring1.Equals("string1"));
+ Test.Eval(_sGuid0 == new Guid());
+ Test.Eval(_sGuid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int>().VerifyLayout();
+ new Gen<double>().VerifyLayout();
+ new Gen<string>().VerifyLayout();
+ new Gen<object>().VerifyLayout();
+ new Gen<Guid>().VerifyLayout();
+
+ new Gen<int[]>().VerifyLayout();
+ new Gen<double[,]>().VerifyLayout();
+ new Gen<string[][][]>().VerifyLayout();
+ new Gen<object[,,,]>().VerifyLayout();
+ new Gen<Guid[][,,,][]>().VerifyLayout();
+
+ new Gen<RefX1<int>[]>().VerifyLayout();
+ new Gen<RefX1<double>[,]>().VerifyLayout();
+ new Gen<RefX1<string>[][][]>().VerifyLayout();
+ new Gen<RefX1<object>[,,,]>().VerifyLayout();
+ new Gen<RefX1<Guid>[][,,,][]>().VerifyLayout();
+
+ new Gen<ValX1<int>[]>().VerifyLayout();
+ new Gen<ValX1<double>[,]>().VerifyLayout();
+ new Gen<ValX1<string>[][][]>().VerifyLayout();
+ new Gen<ValX1<object>[,,,]>().VerifyLayout();
+ new Gen<ValX1<Guid>[][,,,][]>().VerifyLayout();
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/Loader/classloader/generics/Layout/General/Base02a_seq.csproj b/tests/src/Loader/classloader/generics/Layout/General/Base02a_seq.csproj
new file mode 100644
index 0000000000..89546af6b3
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/Base02a_seq.csproj
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <AssemblyName>Base02a_seq</AssemblyName>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <OutputType>Exe</OutputType>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Include="Base02a_seq.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="project.json" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Loader/classloader/generics/Layout/General/Base02a_seq_ser.cs b/tests/src/Loader/classloader/generics/Layout/General/Base02a_seq_ser.cs
new file mode 100644
index 0000000000..71c69bdb59
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/Base02a_seq_ser.cs
@@ -0,0 +1,138 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+
+
+
+public struct ValX1<T> {}
+public struct ValX2<T,U> {}
+public struct ValX3<T,U,V>{}
+public class RefX1<T> {}
+public class RefX2<T,U> {}
+public class RefX3<T,U,V>{}
+
+
+[StructLayout(LayoutKind.Sequential)]
+public class GenBase<T>
+{
+ public T Fld10;
+
+ public int _int0 = 0;
+ public double _double0 = 0;
+ public string _string0 = "string0";
+ public Guid _Guid0 = new Guid();
+
+ public T Fld11;
+
+ public int _int1 = int.MaxValue;
+ public double _double1 = double.MaxValue;
+ public string _string1 = "string1";
+ public Guid _Guid1 = new Guid(1,2,3,4,5,6,7,8,9,10,11);
+
+ public T Fld12;
+
+ public virtual void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(_string0.Equals("string0"));
+ Test.Eval(_string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+public class Gen<T> : GenBase<T>
+{
+ public T sFld10;
+
+ public int _sint0 = 0;
+ public double _sdouble0 = 0;
+ public string _sstring0 = "string0";
+ public Guid _sGuid0 = new Guid();
+
+ public T sFld11;
+
+ public int _sint1 = int.MaxValue;
+ public double _sdouble1 = double.MaxValue;
+ public string _sstring1 = "string1";
+ public Guid _sGuid1 = new Guid(1,2,3,4,5,6,7,8,9,10,11);
+
+ public T sFld12;
+
+ public override void VerifyLayout()
+ {
+ base.VerifyLayout();
+ Test.Eval(_sint0 == 0);
+ Test.Eval(_sint1 == int.MaxValue) ;
+ Test.Eval(_sdouble0 == 0) ;
+ Test.Eval(_sdouble1 == double.MaxValue) ;
+ Test.Eval(_sstring0.Equals("string0"));
+ Test.Eval(_sstring1.Equals("string1"));
+ Test.Eval(_sGuid0 == new Guid());
+ Test.Eval(_sGuid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int>().VerifyLayout();
+ new Gen<double>().VerifyLayout();
+ new Gen<string>().VerifyLayout();
+ new Gen<object>().VerifyLayout();
+ new Gen<Guid>().VerifyLayout();
+
+ new Gen<int[]>().VerifyLayout();
+ new Gen<double[,]>().VerifyLayout();
+ new Gen<string[][][]>().VerifyLayout();
+ new Gen<object[,,,]>().VerifyLayout();
+ new Gen<Guid[][,,,][]>().VerifyLayout();
+
+ new Gen<RefX1<int>[]>().VerifyLayout();
+ new Gen<RefX1<double>[,]>().VerifyLayout();
+ new Gen<RefX1<string>[][][]>().VerifyLayout();
+ new Gen<RefX1<object>[,,,]>().VerifyLayout();
+ new Gen<RefX1<Guid>[][,,,][]>().VerifyLayout();
+
+ new Gen<ValX1<int>[]>().VerifyLayout();
+ new Gen<ValX1<double>[,]>().VerifyLayout();
+ new Gen<ValX1<string>[][][]>().VerifyLayout();
+ new Gen<ValX1<object>[,,,]>().VerifyLayout();
+ new Gen<ValX1<Guid>[][,,,][]>().VerifyLayout();
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/Loader/classloader/generics/Layout/General/Base02a_seq_ser.csproj b/tests/src/Loader/classloader/generics/Layout/General/Base02a_seq_ser.csproj
new file mode 100644
index 0000000000..ad0f68551e
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/Base02a_seq_ser.csproj
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <AssemblyName>Base02a_seq_ser</AssemblyName>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <OutputType>Exe</OutputType>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Include="Base02a_seq_ser.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="project.json" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Loader/classloader/generics/Layout/General/Base02b_auto_ser.cs b/tests/src/Loader/classloader/generics/Layout/General/Base02b_auto_ser.cs
new file mode 100644
index 0000000000..c139919aaa
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/Base02b_auto_ser.cs
@@ -0,0 +1,138 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+
+
+
+public struct ValX1<T> {}
+public struct ValX2<T,U> {}
+public struct ValX3<T,U,V>{}
+public class RefX1<T> {}
+public class RefX2<T,U> {}
+public class RefX3<T,U,V>{}
+
+
+[StructLayout(LayoutKind.Auto)]
+public class GenBase<T>
+{
+ public T Fld10;
+
+ public int _int0 = 0;
+ public double _double0 = 0;
+ public string _string0 = "string0";
+ public Guid _Guid0 = new Guid();
+
+ public T Fld11;
+
+ public int _int1 = int.MaxValue;
+ public double _double1 = double.MaxValue;
+ public string _string1 = "string1";
+ public Guid _Guid1 = new Guid(1,2,3,4,5,6,7,8,9,10,11);
+
+ public T Fld12;
+
+ public virtual void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(_string0.Equals("string0"));
+ Test.Eval(_string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+public class Gen<T> : GenBase<T>
+{
+ public T sFld10;
+
+ public int _sint0 = 0;
+ public double _sdouble0 = 0;
+ public string _sstring0 = "string0";
+ public Guid _sGuid0 = new Guid();
+
+ public T sFld11;
+
+ public int _sint1 = int.MaxValue;
+ public double _sdouble1 = double.MaxValue;
+ public string _sstring1 = "string1";
+ public Guid _sGuid1 = new Guid(1,2,3,4,5,6,7,8,9,10,11);
+
+ public T sFld12;
+
+ public override void VerifyLayout()
+ {
+ base.VerifyLayout();
+ Test.Eval(_sint0 == 0);
+ Test.Eval(_sint1 == int.MaxValue) ;
+ Test.Eval(_sdouble0 == 0) ;
+ Test.Eval(_sdouble1 == double.MaxValue) ;
+ Test.Eval(_sstring0.Equals("string0"));
+ Test.Eval(_sstring1.Equals("string1"));
+ Test.Eval(_sGuid0 == new Guid());
+ Test.Eval(_sGuid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int>().VerifyLayout();
+ new Gen<double>().VerifyLayout();
+ new Gen<string>().VerifyLayout();
+ new Gen<object>().VerifyLayout();
+ new Gen<Guid>().VerifyLayout();
+
+ new Gen<int[]>().VerifyLayout();
+ new Gen<double[,]>().VerifyLayout();
+ new Gen<string[][][]>().VerifyLayout();
+ new Gen<object[,,,]>().VerifyLayout();
+ new Gen<Guid[][,,,][]>().VerifyLayout();
+
+ new Gen<RefX1<int>[]>().VerifyLayout();
+ new Gen<RefX1<double>[,]>().VerifyLayout();
+ new Gen<RefX1<string>[][][]>().VerifyLayout();
+ new Gen<RefX1<object>[,,,]>().VerifyLayout();
+ new Gen<RefX1<Guid>[][,,,][]>().VerifyLayout();
+
+ new Gen<ValX1<int>[]>().VerifyLayout();
+ new Gen<ValX1<double>[,]>().VerifyLayout();
+ new Gen<ValX1<string>[][][]>().VerifyLayout();
+ new Gen<ValX1<object>[,,,]>().VerifyLayout();
+ new Gen<ValX1<Guid>[][,,,][]>().VerifyLayout();
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/Loader/classloader/generics/Layout/General/Base02b_auto_ser.csproj b/tests/src/Loader/classloader/generics/Layout/General/Base02b_auto_ser.csproj
new file mode 100644
index 0000000000..a82a658cc7
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/Base02b_auto_ser.csproj
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <AssemblyName>Base02b_auto_ser</AssemblyName>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <OutputType>Exe</OutputType>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Include="Base02b_auto_ser.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="project.json" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Loader/classloader/generics/Layout/General/Base02b_seq.cs b/tests/src/Loader/classloader/generics/Layout/General/Base02b_seq.cs
new file mode 100644
index 0000000000..dee469b996
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/Base02b_seq.cs
@@ -0,0 +1,137 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+
+
+
+public struct ValX1<T> {}
+public struct ValX2<T,U> {}
+public struct ValX3<T,U,V>{}
+public class RefX1<T> {}
+public class RefX2<T,U> {}
+public class RefX3<T,U,V>{}
+
+[StructLayout(LayoutKind.Sequential)]
+public class GenBase<T>
+{
+ public T Fld10;
+
+ public int _int0 = 0;
+ public double _double0 = 0;
+ public string _string0 = "string0";
+ public Guid _Guid0 = new Guid();
+
+ public T Fld11;
+
+ public int _int1 = int.MaxValue;
+ public double _double1 = double.MaxValue;
+ public string _string1 = "string1";
+ public Guid _Guid1 = new Guid(1,2,3,4,5,6,7,8,9,10,11);
+
+ public T Fld12;
+
+ public virtual void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(_string0.Equals("string0"));
+ Test.Eval(_string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+[StructLayout(LayoutKind.Sequential)]
+public class Gen<T> : GenBase<T>
+{
+ public T sFld10;
+
+ public int _sint0 = 0;
+ public double _sdouble0 = 0;
+ public string _sstring0 = "string0";
+ public Guid _sGuid0 = new Guid();
+
+ public T sFld11;
+
+ public int _sint1 = int.MaxValue;
+ public double _sdouble1 = double.MaxValue;
+ public string _sstring1 = "string1";
+ public Guid _sGuid1 = new Guid(1,2,3,4,5,6,7,8,9,10,11);
+
+ public T sFld12;
+
+ public override void VerifyLayout()
+ {
+ base.VerifyLayout();
+ Test.Eval(_sint0 == 0);
+ Test.Eval(_sint1 == int.MaxValue) ;
+ Test.Eval(_sdouble0 == 0) ;
+ Test.Eval(_sdouble1 == double.MaxValue) ;
+ Test.Eval(_sstring0.Equals("string0"));
+ Test.Eval(_sstring1.Equals("string1"));
+ Test.Eval(_sGuid0 == new Guid());
+ Test.Eval(_sGuid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int>().VerifyLayout();
+ new Gen<double>().VerifyLayout();
+ new Gen<string>().VerifyLayout();
+ new Gen<object>().VerifyLayout();
+ new Gen<Guid>().VerifyLayout();
+
+ new Gen<int[]>().VerifyLayout();
+ new Gen<double[,]>().VerifyLayout();
+ new Gen<string[][][]>().VerifyLayout();
+ new Gen<object[,,,]>().VerifyLayout();
+ new Gen<Guid[][,,,][]>().VerifyLayout();
+
+ new Gen<RefX1<int>[]>().VerifyLayout();
+ new Gen<RefX1<double>[,]>().VerifyLayout();
+ new Gen<RefX1<string>[][][]>().VerifyLayout();
+ new Gen<RefX1<object>[,,,]>().VerifyLayout();
+ new Gen<RefX1<Guid>[][,,,][]>().VerifyLayout();
+
+ new Gen<ValX1<int>[]>().VerifyLayout();
+ new Gen<ValX1<double>[,]>().VerifyLayout();
+ new Gen<ValX1<string>[][][]>().VerifyLayout();
+ new Gen<ValX1<object>[,,,]>().VerifyLayout();
+ new Gen<ValX1<Guid>[][,,,][]>().VerifyLayout();
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/Loader/classloader/generics/Layout/General/Base02b_seq.csproj b/tests/src/Loader/classloader/generics/Layout/General/Base02b_seq.csproj
new file mode 100644
index 0000000000..1ffbe80e1a
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/Base02b_seq.csproj
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <AssemblyName>Base02b_seq</AssemblyName>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <OutputType>Exe</OutputType>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Include="Base02b_seq.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="project.json" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Loader/classloader/generics/Layout/General/Base02b_seq_ser.cs b/tests/src/Loader/classloader/generics/Layout/General/Base02b_seq_ser.cs
new file mode 100644
index 0000000000..aa23dba8a8
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/Base02b_seq_ser.cs
@@ -0,0 +1,138 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+
+
+
+public struct ValX1<T> {}
+public struct ValX2<T,U> {}
+public struct ValX3<T,U,V>{}
+public class RefX1<T> {}
+public class RefX2<T,U> {}
+public class RefX3<T,U,V>{}
+
+
+[StructLayout(LayoutKind.Sequential)]
+public class GenBase<T>
+{
+ public T Fld10;
+
+ public int _int0 = 0;
+ public double _double0 = 0;
+ public string _string0 = "string0";
+ public Guid _Guid0 = new Guid();
+
+ public T Fld11;
+
+ public int _int1 = int.MaxValue;
+ public double _double1 = double.MaxValue;
+ public string _string1 = "string1";
+ public Guid _Guid1 = new Guid(1,2,3,4,5,6,7,8,9,10,11);
+
+ public T Fld12;
+
+ public virtual void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(_string0.Equals("string0"));
+ Test.Eval(_string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+public class Gen<T> : GenBase<T>
+{
+ public T sFld10;
+
+ public int _sint0 = 0;
+ public double _sdouble0 = 0;
+ public string _sstring0 = "string0";
+ public Guid _sGuid0 = new Guid();
+
+ public T sFld11;
+
+ public int _sint1 = int.MaxValue;
+ public double _sdouble1 = double.MaxValue;
+ public string _sstring1 = "string1";
+ public Guid _sGuid1 = new Guid(1,2,3,4,5,6,7,8,9,10,11);
+
+ public T sFld12;
+
+ public override void VerifyLayout()
+ {
+ base.VerifyLayout();
+ Test.Eval(_sint0 == 0);
+ Test.Eval(_sint1 == int.MaxValue) ;
+ Test.Eval(_sdouble0 == 0) ;
+ Test.Eval(_sdouble1 == double.MaxValue) ;
+ Test.Eval(_sstring0.Equals("string0"));
+ Test.Eval(_sstring1.Equals("string1"));
+ Test.Eval(_sGuid0 == new Guid());
+ Test.Eval(_sGuid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int>().VerifyLayout();
+ new Gen<double>().VerifyLayout();
+ new Gen<string>().VerifyLayout();
+ new Gen<object>().VerifyLayout();
+ new Gen<Guid>().VerifyLayout();
+
+ new Gen<int[]>().VerifyLayout();
+ new Gen<double[,]>().VerifyLayout();
+ new Gen<string[][][]>().VerifyLayout();
+ new Gen<object[,,,]>().VerifyLayout();
+ new Gen<Guid[][,,,][]>().VerifyLayout();
+
+ new Gen<RefX1<int>[]>().VerifyLayout();
+ new Gen<RefX1<double>[,]>().VerifyLayout();
+ new Gen<RefX1<string>[][][]>().VerifyLayout();
+ new Gen<RefX1<object>[,,,]>().VerifyLayout();
+ new Gen<RefX1<Guid>[][,,,][]>().VerifyLayout();
+
+ new Gen<ValX1<int>[]>().VerifyLayout();
+ new Gen<ValX1<double>[,]>().VerifyLayout();
+ new Gen<ValX1<string>[][][]>().VerifyLayout();
+ new Gen<ValX1<object>[,,,]>().VerifyLayout();
+ new Gen<ValX1<Guid>[][,,,][]>().VerifyLayout();
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/Loader/classloader/generics/Layout/General/Base02b_seq_ser.csproj b/tests/src/Loader/classloader/generics/Layout/General/Base02b_seq_ser.csproj
new file mode 100644
index 0000000000..15282a3176
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/Base02b_seq_ser.csproj
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <AssemblyName>Base02b_seq_ser</AssemblyName>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <OutputType>Exe</OutputType>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Include="Base02b_seq_ser.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="project.json" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Loader/classloader/generics/Layout/General/Base02c_seq_ser.cs b/tests/src/Loader/classloader/generics/Layout/General/Base02c_seq_ser.cs
new file mode 100644
index 0000000000..c8515f2c40
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/Base02c_seq_ser.cs
@@ -0,0 +1,139 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+
+
+
+public struct ValX1<T> {}
+public struct ValX2<T,U> {}
+public struct ValX3<T,U,V>{}
+public class RefX1<T> {}
+public class RefX2<T,U> {}
+public class RefX3<T,U,V>{}
+
+
+[StructLayout(LayoutKind.Sequential)]
+public class GenBase<T>
+{
+ public T Fld10;
+
+ public int _int0 = 0;
+ public double _double0 = 0;
+ public string _string0 = "string0";
+ public Guid _Guid0 = new Guid();
+
+ public T Fld11;
+
+ public int _int1 = int.MaxValue;
+ public double _double1 = double.MaxValue;
+ public string _string1 = "string1";
+ public Guid _Guid1 = new Guid(1,2,3,4,5,6,7,8,9,10,11);
+
+ public T Fld12;
+
+ public virtual void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(_string0.Equals("string0"));
+ Test.Eval(_string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+
+[StructLayout(LayoutKind.Sequential)]
+public class Gen<T> : GenBase<T>
+{
+ public T sFld10;
+
+ public int _sint0 = 0;
+ public double _sdouble0 = 0;
+ public string _sstring0 = "string0";
+ public Guid _sGuid0 = new Guid();
+
+ public T sFld11;
+
+ public int _sint1 = int.MaxValue;
+ public double _sdouble1 = double.MaxValue;
+ public string _sstring1 = "string1";
+ public Guid _sGuid1 = new Guid(1,2,3,4,5,6,7,8,9,10,11);
+
+ public T sFld12;
+
+ public override void VerifyLayout()
+ {
+ base.VerifyLayout();
+ Test.Eval(_sint0 == 0);
+ Test.Eval(_sint1 == int.MaxValue) ;
+ Test.Eval(_sdouble0 == 0) ;
+ Test.Eval(_sdouble1 == double.MaxValue) ;
+ Test.Eval(_sstring0.Equals("string0"));
+ Test.Eval(_sstring1.Equals("string1"));
+ Test.Eval(_sGuid0 == new Guid());
+ Test.Eval(_sGuid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int>().VerifyLayout();
+ new Gen<double>().VerifyLayout();
+ new Gen<string>().VerifyLayout();
+ new Gen<object>().VerifyLayout();
+ new Gen<Guid>().VerifyLayout();
+
+ new Gen<int[]>().VerifyLayout();
+ new Gen<double[,]>().VerifyLayout();
+ new Gen<string[][][]>().VerifyLayout();
+ new Gen<object[,,,]>().VerifyLayout();
+ new Gen<Guid[][,,,][]>().VerifyLayout();
+
+ new Gen<RefX1<int>[]>().VerifyLayout();
+ new Gen<RefX1<double>[,]>().VerifyLayout();
+ new Gen<RefX1<string>[][][]>().VerifyLayout();
+ new Gen<RefX1<object>[,,,]>().VerifyLayout();
+ new Gen<RefX1<Guid>[][,,,][]>().VerifyLayout();
+
+ new Gen<ValX1<int>[]>().VerifyLayout();
+ new Gen<ValX1<double>[,]>().VerifyLayout();
+ new Gen<ValX1<string>[][][]>().VerifyLayout();
+ new Gen<ValX1<object>[,,,]>().VerifyLayout();
+ new Gen<ValX1<Guid>[][,,,][]>().VerifyLayout();
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/Loader/classloader/generics/Layout/General/Base02c_seq_ser.csproj b/tests/src/Loader/classloader/generics/Layout/General/Base02c_seq_ser.csproj
new file mode 100644
index 0000000000..7a8cccec35
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/Base02c_seq_ser.csproj
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <AssemblyName>Base02c_seq_ser</AssemblyName>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <OutputType>Exe</OutputType>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Include="Base02c_seq_ser.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="project.json" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Loader/classloader/generics/Layout/General/Base02d_seq_ser.cs b/tests/src/Loader/classloader/generics/Layout/General/Base02d_seq_ser.cs
new file mode 100644
index 0000000000..18fac5559b
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/Base02d_seq_ser.cs
@@ -0,0 +1,121 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+// regression test for 245437
+
+using System;
+using System.Runtime.InteropServices;
+
+
+
+
+[StructLayout(LayoutKind.Sequential)]
+public class GenBase<T>
+{
+ public T Fld10;
+
+ public int _int0 = 0;
+ public double _double0 = 0;
+ public string _string0 = "string0";
+ public Guid _Guid0 = new Guid();
+
+ public T Fld11;
+
+ public int _int1 = int.MaxValue;
+ public double _double1 = double.MaxValue;
+ public string _string1 = "string1";
+ public Guid _Guid1 = new Guid(1,2,3,4,5,6,7,8,9,10,11);
+
+ public T Fld12;
+
+}
+
+
+[StructLayout(LayoutKind.Explicit)]
+public class Gen<T> : GenBase<T>
+{
+ [FieldOffset(0)]public T sFld10;
+
+ [FieldOffset(16)]public int _sint0 = 0;
+ [FieldOffset(24)]public double _sdouble0 = 0;
+ [FieldOffset(32)]public string _sstring0 = "string0";
+ [FieldOffset(40)]public Guid _sGuid0 = new Guid();
+
+ [FieldOffset(56)]public T sFld11;
+
+ [FieldOffset(72)]public int _sint1 = int.MaxValue;
+ [FieldOffset(80)]public double _sdouble1 = double.MaxValue;
+ [FieldOffset(88)]public string _sstring1 = "string1";
+ [FieldOffset(96)]public Guid _sGuid1 = new Guid(1,2,3,4,5,6,7,8,9,10,11);
+
+ [FieldOffset(112)]public T sFld12;
+
+}
+
+public class Test
+{
+ public static void RunTest1()
+ {
+ new Gen<int>();
+ }
+
+ public static void RunTest2()
+ {
+ new Gen<double>();
+ }
+
+ public static void RunTest3()
+ {
+ new Gen<string>();
+ }
+
+ public static int Main()
+ {
+ bool result = true;
+ try
+ {
+ RunTest1();
+ result = false;
+ }
+ catch (TypeLoadException)
+ {
+ // expected
+ }
+
+ try
+ {
+ RunTest2();
+ result = false;
+ }
+ catch (TypeLoadException)
+ {
+ // expected
+ }
+
+
+ try
+ {
+ RunTest3();
+ result = false;
+ }
+ catch (TypeLoadException)
+ {
+ // expected
+ }
+
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/Loader/classloader/generics/Layout/General/Base02d_seq_ser.csproj b/tests/src/Loader/classloader/generics/Layout/General/Base02d_seq_ser.csproj
new file mode 100644
index 0000000000..64129e3394
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/Base02d_seq_ser.csproj
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <AssemblyName>Base02d_seq_ser</AssemblyName>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <OutputType>Exe</OutputType>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Include="Base02d_seq_ser.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="project.json" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Loader/classloader/generics/Layout/General/app.config b/tests/src/Loader/classloader/generics/Layout/General/app.config
new file mode 100644
index 0000000000..e5622f77ad
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/app.config
@@ -0,0 +1,27 @@
+<?xml version = "1.0" encoding="utf-8"?>
+<configuration>
+ <runtime>
+ <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+ <dependentAssembly>
+ <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.20.0" newVersion="4.0.20.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Text.Encoding" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.IO" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Reflection" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+ </dependentAssembly>
+ </assemblyBinding>
+ </runtime>
+</configuration>
diff --git a/tests/src/Loader/classloader/generics/Layout/General/class01_auto.cs b/tests/src/Loader/classloader/generics/Layout/General/class01_auto.cs
new file mode 100644
index 0000000000..53ecb4aa9b
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/class01_auto.cs
@@ -0,0 +1,104 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+
+
+
+public struct ValX1<T> {}
+public struct ValX2<T,U> {}
+public struct ValX3<T,U,V>{}
+public class RefX1<T> {}
+public class RefX2<T,U> {}
+public class RefX3<T,U,V>{}
+
+
+[StructLayout(LayoutKind.Auto)]
+public class Gen<T>
+{
+ public T Fld10;
+
+ public int _int0 = 0;
+ public double _double0 = 0;
+ public string _string0 = "string0";
+ public Guid _Guid0 = new Guid();
+
+ public T Fld11;
+
+ public int _int1 = int.MaxValue;
+ public double _double1 = double.MaxValue;
+ public string _string1 = "string1";
+ public Guid _Guid1 = new Guid(1,2,3,4,5,6,7,8,9,10,11);
+
+ public T Fld12;
+
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(_string0.Equals("string0"));
+ Test.Eval(_string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int>().VerifyLayout();
+ new Gen<double>().VerifyLayout();
+ new Gen<string>().VerifyLayout();
+ new Gen<object>().VerifyLayout();
+ new Gen<Guid>().VerifyLayout();
+
+ new Gen<int[]>().VerifyLayout();
+ new Gen<double[,]>().VerifyLayout();
+ new Gen<string[][][]>().VerifyLayout();
+ new Gen<object[,,,]>().VerifyLayout();
+ new Gen<Guid[][,,,][]>().VerifyLayout();
+
+ new Gen<RefX1<int>[]>().VerifyLayout();
+ new Gen<RefX1<double>[,]>().VerifyLayout();
+ new Gen<RefX1<string>[][][]>().VerifyLayout();
+ new Gen<RefX1<object>[,,,]>().VerifyLayout();
+ new Gen<RefX1<Guid>[][,,,][]>().VerifyLayout();
+
+ new Gen<ValX1<int>[]>().VerifyLayout();
+ new Gen<ValX1<double>[,]>().VerifyLayout();
+ new Gen<ValX1<string>[][][]>().VerifyLayout();
+ new Gen<ValX1<object>[,,,]>().VerifyLayout();
+ new Gen<ValX1<Guid>[][,,,][]>().VerifyLayout();
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/Loader/classloader/generics/Layout/General/class01_auto.csproj b/tests/src/Loader/classloader/generics/Layout/General/class01_auto.csproj
new file mode 100644
index 0000000000..eb53fdfe8d
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/class01_auto.csproj
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <AssemblyName>class01_auto</AssemblyName>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <OutputType>Exe</OutputType>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Include="class01_auto.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="project.json" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Loader/classloader/generics/Layout/General/class01_auto_ser.cs b/tests/src/Loader/classloader/generics/Layout/General/class01_auto_ser.cs
new file mode 100644
index 0000000000..53ecb4aa9b
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/class01_auto_ser.cs
@@ -0,0 +1,104 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+
+
+
+public struct ValX1<T> {}
+public struct ValX2<T,U> {}
+public struct ValX3<T,U,V>{}
+public class RefX1<T> {}
+public class RefX2<T,U> {}
+public class RefX3<T,U,V>{}
+
+
+[StructLayout(LayoutKind.Auto)]
+public class Gen<T>
+{
+ public T Fld10;
+
+ public int _int0 = 0;
+ public double _double0 = 0;
+ public string _string0 = "string0";
+ public Guid _Guid0 = new Guid();
+
+ public T Fld11;
+
+ public int _int1 = int.MaxValue;
+ public double _double1 = double.MaxValue;
+ public string _string1 = "string1";
+ public Guid _Guid1 = new Guid(1,2,3,4,5,6,7,8,9,10,11);
+
+ public T Fld12;
+
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(_string0.Equals("string0"));
+ Test.Eval(_string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int>().VerifyLayout();
+ new Gen<double>().VerifyLayout();
+ new Gen<string>().VerifyLayout();
+ new Gen<object>().VerifyLayout();
+ new Gen<Guid>().VerifyLayout();
+
+ new Gen<int[]>().VerifyLayout();
+ new Gen<double[,]>().VerifyLayout();
+ new Gen<string[][][]>().VerifyLayout();
+ new Gen<object[,,,]>().VerifyLayout();
+ new Gen<Guid[][,,,][]>().VerifyLayout();
+
+ new Gen<RefX1<int>[]>().VerifyLayout();
+ new Gen<RefX1<double>[,]>().VerifyLayout();
+ new Gen<RefX1<string>[][][]>().VerifyLayout();
+ new Gen<RefX1<object>[,,,]>().VerifyLayout();
+ new Gen<RefX1<Guid>[][,,,][]>().VerifyLayout();
+
+ new Gen<ValX1<int>[]>().VerifyLayout();
+ new Gen<ValX1<double>[,]>().VerifyLayout();
+ new Gen<ValX1<string>[][][]>().VerifyLayout();
+ new Gen<ValX1<object>[,,,]>().VerifyLayout();
+ new Gen<ValX1<Guid>[][,,,][]>().VerifyLayout();
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/Loader/classloader/generics/Layout/General/class01_auto_ser.csproj b/tests/src/Loader/classloader/generics/Layout/General/class01_auto_ser.csproj
new file mode 100644
index 0000000000..178ec2b825
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/class01_auto_ser.csproj
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <AssemblyName>class01_auto_ser</AssemblyName>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <OutputType>Exe</OutputType>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Include="class01_auto_ser.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="project.json" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Loader/classloader/generics/Layout/General/class01_seq.cs b/tests/src/Loader/classloader/generics/Layout/General/class01_seq.cs
new file mode 100644
index 0000000000..b90bc23cbe
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/class01_seq.cs
@@ -0,0 +1,103 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+
+
+
+public struct ValX1<T> {}
+public struct ValX2<T,U> {}
+public struct ValX3<T,U,V>{}
+public class RefX1<T> {}
+public class RefX2<T,U> {}
+public class RefX3<T,U,V>{}
+
+[StructLayout(LayoutKind.Sequential)]
+public class Gen<T>
+{
+ public T Fld10;
+
+ public int _int0 = 0;
+ public double _double0 = 0;
+ public string _string0 = "string0";
+ public Guid _Guid0 = new Guid();
+
+ public T Fld11;
+
+ public int _int1 = int.MaxValue;
+ public double _double1 = double.MaxValue;
+ public string _string1 = "string1";
+ public Guid _Guid1 = new Guid(1,2,3,4,5,6,7,8,9,10,11);
+
+ public T Fld12;
+
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(_string0.Equals("string0"));
+ Test.Eval(_string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int>().VerifyLayout();
+ new Gen<double>().VerifyLayout();
+ new Gen<string>().VerifyLayout();
+ new Gen<object>().VerifyLayout();
+ new Gen<Guid>().VerifyLayout();
+
+ new Gen<int[]>().VerifyLayout();
+ new Gen<double[,]>().VerifyLayout();
+ new Gen<string[][][]>().VerifyLayout();
+ new Gen<object[,,,]>().VerifyLayout();
+ new Gen<Guid[][,,,][]>().VerifyLayout();
+
+ new Gen<RefX1<int>[]>().VerifyLayout();
+ new Gen<RefX1<double>[,]>().VerifyLayout();
+ new Gen<RefX1<string>[][][]>().VerifyLayout();
+ new Gen<RefX1<object>[,,,]>().VerifyLayout();
+ new Gen<RefX1<Guid>[][,,,][]>().VerifyLayout();
+
+ new Gen<ValX1<int>[]>().VerifyLayout();
+ new Gen<ValX1<double>[,]>().VerifyLayout();
+ new Gen<ValX1<string>[][][]>().VerifyLayout();
+ new Gen<ValX1<object>[,,,]>().VerifyLayout();
+ new Gen<ValX1<Guid>[][,,,][]>().VerifyLayout();
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/Loader/classloader/generics/Layout/General/class01_seq.csproj b/tests/src/Loader/classloader/generics/Layout/General/class01_seq.csproj
new file mode 100644
index 0000000000..abe5f8e635
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/class01_seq.csproj
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <AssemblyName>class01_seq</AssemblyName>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <OutputType>Exe</OutputType>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Include="class01_seq.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="project.json" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Loader/classloader/generics/Layout/General/class01_seq_ser.cs b/tests/src/Loader/classloader/generics/Layout/General/class01_seq_ser.cs
new file mode 100644
index 0000000000..c5697d38b2
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/class01_seq_ser.cs
@@ -0,0 +1,104 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+
+
+
+public struct ValX1<T> {}
+public struct ValX2<T,U> {}
+public struct ValX3<T,U,V>{}
+public class RefX1<T> {}
+public class RefX2<T,U> {}
+public class RefX3<T,U,V>{}
+
+
+[StructLayout(LayoutKind.Sequential)]
+public class Gen<T>
+{
+ public T Fld10;
+
+ public int _int0 = 0;
+ public double _double0 = 0;
+ public string _string0 = "string0";
+ public Guid _Guid0 = new Guid();
+
+ public T Fld11;
+
+ public int _int1 = int.MaxValue;
+ public double _double1 = double.MaxValue;
+ public string _string1 = "string1";
+ public Guid _Guid1 = new Guid(1,2,3,4,5,6,7,8,9,10,11);
+
+ public T Fld12;
+
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(_string0.Equals("string0"));
+ Test.Eval(_string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int>().VerifyLayout();
+ new Gen<double>().VerifyLayout();
+ new Gen<string>().VerifyLayout();
+ new Gen<object>().VerifyLayout();
+ new Gen<Guid>().VerifyLayout();
+
+ new Gen<int[]>().VerifyLayout();
+ new Gen<double[,]>().VerifyLayout();
+ new Gen<string[][][]>().VerifyLayout();
+ new Gen<object[,,,]>().VerifyLayout();
+ new Gen<Guid[][,,,][]>().VerifyLayout();
+
+ new Gen<RefX1<int>[]>().VerifyLayout();
+ new Gen<RefX1<double>[,]>().VerifyLayout();
+ new Gen<RefX1<string>[][][]>().VerifyLayout();
+ new Gen<RefX1<object>[,,,]>().VerifyLayout();
+ new Gen<RefX1<Guid>[][,,,][]>().VerifyLayout();
+
+ new Gen<ValX1<int>[]>().VerifyLayout();
+ new Gen<ValX1<double>[,]>().VerifyLayout();
+ new Gen<ValX1<string>[][][]>().VerifyLayout();
+ new Gen<ValX1<object>[,,,]>().VerifyLayout();
+ new Gen<ValX1<Guid>[][,,,][]>().VerifyLayout();
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/Loader/classloader/generics/Layout/General/class01_seq_ser.csproj b/tests/src/Loader/classloader/generics/Layout/General/class01_seq_ser.csproj
new file mode 100644
index 0000000000..d43ad8ef28
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/class01_seq_ser.csproj
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <AssemblyName>class01_seq_ser</AssemblyName>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <OutputType>Exe</OutputType>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Include="class01_seq_ser.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="project.json" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Loader/classloader/generics/Layout/General/class02_auto.cs b/tests/src/Loader/classloader/generics/Layout/General/class02_auto.cs
new file mode 100644
index 0000000000..5b909f0854
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/class02_auto.cs
@@ -0,0 +1,159 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+
+public struct ValX1<T> {}
+public struct ValX2<T,U> {}
+public struct ValX3<T,U,V>{}
+public class RefX1<T> {}
+public class RefX2<T,U> {}
+public class RefX3<T,U,V>{}
+
+[StructLayout(LayoutKind.Auto)]
+public class Gen<T,U>
+{
+ public T Fld10;
+
+ public int _int0 = 0;
+ public double _double0 = 0;
+ public string _string0 = "string0";
+ public Guid _Guid0 = new Guid();
+
+ public U Fld20;
+
+ public int _int1 = 1;
+ public double _double1 = 1;
+ public string _string1 = "string1";
+ public Guid _Guid1 = new Guid(1,2,3,4,5,6,7,8,9,10,11);
+
+ public T Fld11;
+ public U Fld21;
+
+ public int _int2 = int.MaxValue;
+ public double _double2 = double.MaxValue;
+ public string _string2 = "string2";
+ public Guid _Guid2 = new Guid(11,21,31,41,51,61,71,81,91,101,111);
+
+ public T Fld12;
+
+ public int _int3 = int.MinValue;
+ public double _double3 = double.MinValue;
+ public string _string3 = "string3";
+ public Guid _Guid3 = new Guid(12,22,32,42,52,62,72,82,92,102,112);
+
+ public U Fld22;
+
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == 1);
+ Test.Eval(_int2 == int.MaxValue) ;
+ Test.Eval(_int3 == int.MinValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1== 1) ;
+ Test.Eval(_double2 == double.MaxValue) ;
+ Test.Eval(_double3 == double.MinValue) ;
+ Test.Eval(_string0.Equals("string0"));
+ Test.Eval(_string1.Equals("string1"));
+ Test.Eval(_string2.Equals("string2"));
+ Test.Eval(_string3.Equals("string3"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ Test.Eval(_Guid2 == new Guid(11,21,31,41,51,61,71,81,91,101,111));
+ Test.Eval(_Guid3 == new Guid(12,22,32,42,52,62,72,82,92,102,112));
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int,int>().VerifyLayout();
+ new Gen<int,double>().VerifyLayout();
+ new Gen<int,string>().VerifyLayout();
+ new Gen<int,object>().VerifyLayout();
+ new Gen<int,Guid>().VerifyLayout();
+ new Gen<int,RefX1<int>>().VerifyLayout();
+ new Gen<int,RefX1<string>>().VerifyLayout();
+ new Gen<int,RefX1<int[][,,,][]>>().VerifyLayout();
+ new Gen<int,ValX1<int>>().VerifyLayout();
+ new Gen<int,ValX1<string>>().VerifyLayout();
+ new Gen<int,ValX1<int[][,,,][]>>().VerifyLayout();
+
+ new Gen<double,int>().VerifyLayout();
+ new Gen<double,double>().VerifyLayout();
+ new Gen<double,string>().VerifyLayout();
+ new Gen<double,object>().VerifyLayout();
+ new Gen<double,Guid>().VerifyLayout();
+ new Gen<double,RefX1<double>>().VerifyLayout();
+ new Gen<double,RefX1<string>>().VerifyLayout();
+ new Gen<double,RefX1<double[][,,,][]>>().VerifyLayout();
+ new Gen<double,ValX1<double>>().VerifyLayout();
+ new Gen<double,ValX1<string>>().VerifyLayout();
+ new Gen<double,ValX1<double[][,,,][]>>().VerifyLayout();
+
+ new Gen<string,int>().VerifyLayout();
+ new Gen<string,double>().VerifyLayout();
+ new Gen<string,string>().VerifyLayout();
+ new Gen<string,object>().VerifyLayout();
+ new Gen<string,Guid>().VerifyLayout();
+ new Gen<string,RefX1<string>>().VerifyLayout();
+ new Gen<string,RefX1<string>>().VerifyLayout();
+ new Gen<string,RefX1<string[][,,,][]>>().VerifyLayout();
+ new Gen<string,ValX1<string>>().VerifyLayout();
+ new Gen<string,ValX1<string>>().VerifyLayout();
+ new Gen<string,ValX1<string[][,,,][]>>().VerifyLayout();
+
+ new Gen<object,int>().VerifyLayout();
+ new Gen<object,double>().VerifyLayout();
+ new Gen<object,string>().VerifyLayout();
+ new Gen<object,object>().VerifyLayout();
+ new Gen<object,Guid>().VerifyLayout();
+ new Gen<object,RefX1<object>>().VerifyLayout();
+ new Gen<object,RefX1<string>>().VerifyLayout();
+ new Gen<object,RefX1<object[][,,,][]>>().VerifyLayout();
+ new Gen<object,ValX1<object>>().VerifyLayout();
+ new Gen<object,ValX1<string>>().VerifyLayout();
+ new Gen<object,ValX1<object[][,,,][]>>().VerifyLayout();
+
+ new Gen<Guid,int>().VerifyLayout();
+ new Gen<Guid,double>().VerifyLayout();
+ new Gen<Guid,string>().VerifyLayout();
+ new Gen<Guid,object>().VerifyLayout();
+ new Gen<Guid,Guid>().VerifyLayout();
+ new Gen<Guid,RefX1<Guid>>().VerifyLayout();
+ new Gen<Guid,RefX1<string>>().VerifyLayout();
+ new Gen<Guid,RefX1<Guid[][,,,][]>>().VerifyLayout();
+ new Gen<Guid,ValX1<Guid>>().VerifyLayout();
+ new Gen<Guid,ValX1<string>>().VerifyLayout();
+ new Gen<Guid,ValX1<Guid[][,,,][]>>().VerifyLayout();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/Loader/classloader/generics/Layout/General/class02_auto.csproj b/tests/src/Loader/classloader/generics/Layout/General/class02_auto.csproj
new file mode 100644
index 0000000000..bb5014b76a
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/class02_auto.csproj
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <AssemblyName>class02_auto</AssemblyName>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <OutputType>Exe</OutputType>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Include="class02_auto.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="project.json" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Loader/classloader/generics/Layout/General/class02_auto_ser.cs b/tests/src/Loader/classloader/generics/Layout/General/class02_auto_ser.cs
new file mode 100644
index 0000000000..a0d27a5bc2
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/class02_auto_ser.cs
@@ -0,0 +1,160 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+
+public struct ValX1<T> {}
+public struct ValX2<T,U> {}
+public struct ValX3<T,U,V>{}
+public class RefX1<T> {}
+public class RefX2<T,U> {}
+public class RefX3<T,U,V>{}
+
+
+[StructLayout(LayoutKind.Auto)]
+public class Gen<T,U>
+{
+ public T Fld10;
+
+ public int _int0 = 0;
+ public double _double0 = 0;
+ public string _string0 = "string0";
+ public Guid _Guid0 = new Guid();
+
+ public U Fld20;
+
+ public int _int1 = 1;
+ public double _double1 = 1;
+ public string _string1 = "string1";
+ public Guid _Guid1 = new Guid(1,2,3,4,5,6,7,8,9,10,11);
+
+ public T Fld11;
+ public U Fld21;
+
+ public int _int2 = int.MaxValue;
+ public double _double2 = double.MaxValue;
+ public string _string2 = "string2";
+ public Guid _Guid2 = new Guid(11,21,31,41,51,61,71,81,91,101,111);
+
+ public T Fld12;
+
+ public int _int3 = int.MinValue;
+ public double _double3 = double.MinValue;
+ public string _string3 = "string3";
+ public Guid _Guid3 = new Guid(12,22,32,42,52,62,72,82,92,102,112);
+
+ public U Fld22;
+
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == 1);
+ Test.Eval(_int2 == int.MaxValue) ;
+ Test.Eval(_int3 == int.MinValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1== 1) ;
+ Test.Eval(_double2 == double.MaxValue) ;
+ Test.Eval(_double3 == double.MinValue) ;
+ Test.Eval(_string0.Equals("string0"));
+ Test.Eval(_string1.Equals("string1"));
+ Test.Eval(_string2.Equals("string2"));
+ Test.Eval(_string3.Equals("string3"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ Test.Eval(_Guid2 == new Guid(11,21,31,41,51,61,71,81,91,101,111));
+ Test.Eval(_Guid3 == new Guid(12,22,32,42,52,62,72,82,92,102,112));
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int,int>().VerifyLayout();
+ new Gen<int,double>().VerifyLayout();
+ new Gen<int,string>().VerifyLayout();
+ new Gen<int,object>().VerifyLayout();
+ new Gen<int,Guid>().VerifyLayout();
+ new Gen<int,RefX1<int>>().VerifyLayout();
+ new Gen<int,RefX1<string>>().VerifyLayout();
+ new Gen<int,RefX1<int[][,,,][]>>().VerifyLayout();
+ new Gen<int,ValX1<int>>().VerifyLayout();
+ new Gen<int,ValX1<string>>().VerifyLayout();
+ new Gen<int,ValX1<int[][,,,][]>>().VerifyLayout();
+
+ new Gen<double,int>().VerifyLayout();
+ new Gen<double,double>().VerifyLayout();
+ new Gen<double,string>().VerifyLayout();
+ new Gen<double,object>().VerifyLayout();
+ new Gen<double,Guid>().VerifyLayout();
+ new Gen<double,RefX1<double>>().VerifyLayout();
+ new Gen<double,RefX1<string>>().VerifyLayout();
+ new Gen<double,RefX1<double[][,,,][]>>().VerifyLayout();
+ new Gen<double,ValX1<double>>().VerifyLayout();
+ new Gen<double,ValX1<string>>().VerifyLayout();
+ new Gen<double,ValX1<double[][,,,][]>>().VerifyLayout();
+
+ new Gen<string,int>().VerifyLayout();
+ new Gen<string,double>().VerifyLayout();
+ new Gen<string,string>().VerifyLayout();
+ new Gen<string,object>().VerifyLayout();
+ new Gen<string,Guid>().VerifyLayout();
+ new Gen<string,RefX1<string>>().VerifyLayout();
+ new Gen<string,RefX1<string>>().VerifyLayout();
+ new Gen<string,RefX1<string[][,,,][]>>().VerifyLayout();
+ new Gen<string,ValX1<string>>().VerifyLayout();
+ new Gen<string,ValX1<string>>().VerifyLayout();
+ new Gen<string,ValX1<string[][,,,][]>>().VerifyLayout();
+
+ new Gen<object,int>().VerifyLayout();
+ new Gen<object,double>().VerifyLayout();
+ new Gen<object,string>().VerifyLayout();
+ new Gen<object,object>().VerifyLayout();
+ new Gen<object,Guid>().VerifyLayout();
+ new Gen<object,RefX1<object>>().VerifyLayout();
+ new Gen<object,RefX1<string>>().VerifyLayout();
+ new Gen<object,RefX1<object[][,,,][]>>().VerifyLayout();
+ new Gen<object,ValX1<object>>().VerifyLayout();
+ new Gen<object,ValX1<string>>().VerifyLayout();
+ new Gen<object,ValX1<object[][,,,][]>>().VerifyLayout();
+
+ new Gen<Guid,int>().VerifyLayout();
+ new Gen<Guid,double>().VerifyLayout();
+ new Gen<Guid,string>().VerifyLayout();
+ new Gen<Guid,object>().VerifyLayout();
+ new Gen<Guid,Guid>().VerifyLayout();
+ new Gen<Guid,RefX1<Guid>>().VerifyLayout();
+ new Gen<Guid,RefX1<string>>().VerifyLayout();
+ new Gen<Guid,RefX1<Guid[][,,,][]>>().VerifyLayout();
+ new Gen<Guid,ValX1<Guid>>().VerifyLayout();
+ new Gen<Guid,ValX1<string>>().VerifyLayout();
+ new Gen<Guid,ValX1<Guid[][,,,][]>>().VerifyLayout();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/Loader/classloader/generics/Layout/General/class02_auto_ser.csproj b/tests/src/Loader/classloader/generics/Layout/General/class02_auto_ser.csproj
new file mode 100644
index 0000000000..d3cf3bb28e
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/class02_auto_ser.csproj
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <AssemblyName>class02_auto_ser</AssemblyName>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <OutputType>Exe</OutputType>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Include="class02_auto_ser.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="project.json" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Loader/classloader/generics/Layout/General/class02_seq_ser.cs b/tests/src/Loader/classloader/generics/Layout/General/class02_seq_ser.cs
new file mode 100644
index 0000000000..0ab5ee3d0a
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/class02_seq_ser.cs
@@ -0,0 +1,160 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+
+public struct ValX1<T> {}
+public struct ValX2<T,U> {}
+public struct ValX3<T,U,V>{}
+public class RefX1<T> {}
+public class RefX2<T,U> {}
+public class RefX3<T,U,V>{}
+
+
+[StructLayout(LayoutKind.Sequential)]
+public class Gen<T,U>
+{
+ public T Fld10;
+
+ public int _int0 = 0;
+ public double _double0 = 0;
+ public string _string0 = "string0";
+ public Guid _Guid0 = new Guid();
+
+ public U Fld20;
+
+ public int _int1 = 1;
+ public double _double1 = 1;
+ public string _string1 = "string1";
+ public Guid _Guid1 = new Guid(1,2,3,4,5,6,7,8,9,10,11);
+
+ public T Fld11;
+ public U Fld21;
+
+ public int _int2 = int.MaxValue;
+ public double _double2 = double.MaxValue;
+ public string _string2 = "string2";
+ public Guid _Guid2 = new Guid(11,21,31,41,51,61,71,81,91,101,111);
+
+ public T Fld12;
+
+ public int _int3 = int.MinValue;
+ public double _double3 = double.MinValue;
+ public string _string3 = "string3";
+ public Guid _Guid3 = new Guid(12,22,32,42,52,62,72,82,92,102,112);
+
+ public U Fld22;
+
+ public void VerifyLayout()
+ {
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == 1);
+ Test.Eval(_int2 == int.MaxValue) ;
+ Test.Eval(_int3 == int.MinValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1== 1) ;
+ Test.Eval(_double2 == double.MaxValue) ;
+ Test.Eval(_double3 == double.MinValue) ;
+ Test.Eval(_string0.Equals("string0"));
+ Test.Eval(_string1.Equals("string1"));
+ Test.Eval(_string2.Equals("string2"));
+ Test.Eval(_string3.Equals("string3"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ Test.Eval(_Guid2 == new Guid(11,21,31,41,51,61,71,81,91,101,111));
+ Test.Eval(_Guid3 == new Guid(12,22,32,42,52,62,72,82,92,102,112));
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int,int>().VerifyLayout();
+ new Gen<int,double>().VerifyLayout();
+ new Gen<int,string>().VerifyLayout();
+ new Gen<int,object>().VerifyLayout();
+ new Gen<int,Guid>().VerifyLayout();
+ new Gen<int,RefX1<int>>().VerifyLayout();
+ new Gen<int,RefX1<string>>().VerifyLayout();
+ new Gen<int,RefX1<int[][,,,][]>>().VerifyLayout();
+ new Gen<int,ValX1<int>>().VerifyLayout();
+ new Gen<int,ValX1<string>>().VerifyLayout();
+ new Gen<int,ValX1<int[][,,,][]>>().VerifyLayout();
+
+ new Gen<double,int>().VerifyLayout();
+ new Gen<double,double>().VerifyLayout();
+ new Gen<double,string>().VerifyLayout();
+ new Gen<double,object>().VerifyLayout();
+ new Gen<double,Guid>().VerifyLayout();
+ new Gen<double,RefX1<double>>().VerifyLayout();
+ new Gen<double,RefX1<string>>().VerifyLayout();
+ new Gen<double,RefX1<double[][,,,][]>>().VerifyLayout();
+ new Gen<double,ValX1<double>>().VerifyLayout();
+ new Gen<double,ValX1<string>>().VerifyLayout();
+ new Gen<double,ValX1<double[][,,,][]>>().VerifyLayout();
+
+ new Gen<string,int>().VerifyLayout();
+ new Gen<string,double>().VerifyLayout();
+ new Gen<string,string>().VerifyLayout();
+ new Gen<string,object>().VerifyLayout();
+ new Gen<string,Guid>().VerifyLayout();
+ new Gen<string,RefX1<string>>().VerifyLayout();
+ new Gen<string,RefX1<string>>().VerifyLayout();
+ new Gen<string,RefX1<string[][,,,][]>>().VerifyLayout();
+ new Gen<string,ValX1<string>>().VerifyLayout();
+ new Gen<string,ValX1<string>>().VerifyLayout();
+ new Gen<string,ValX1<string[][,,,][]>>().VerifyLayout();
+
+ new Gen<object,int>().VerifyLayout();
+ new Gen<object,double>().VerifyLayout();
+ new Gen<object,string>().VerifyLayout();
+ new Gen<object,object>().VerifyLayout();
+ new Gen<object,Guid>().VerifyLayout();
+ new Gen<object,RefX1<object>>().VerifyLayout();
+ new Gen<object,RefX1<string>>().VerifyLayout();
+ new Gen<object,RefX1<object[][,,,][]>>().VerifyLayout();
+ new Gen<object,ValX1<object>>().VerifyLayout();
+ new Gen<object,ValX1<string>>().VerifyLayout();
+ new Gen<object,ValX1<object[][,,,][]>>().VerifyLayout();
+
+ new Gen<Guid,int>().VerifyLayout();
+ new Gen<Guid,double>().VerifyLayout();
+ new Gen<Guid,string>().VerifyLayout();
+ new Gen<Guid,object>().VerifyLayout();
+ new Gen<Guid,Guid>().VerifyLayout();
+ new Gen<Guid,RefX1<Guid>>().VerifyLayout();
+ new Gen<Guid,RefX1<string>>().VerifyLayout();
+ new Gen<Guid,RefX1<Guid[][,,,][]>>().VerifyLayout();
+ new Gen<Guid,ValX1<Guid>>().VerifyLayout();
+ new Gen<Guid,ValX1<string>>().VerifyLayout();
+ new Gen<Guid,ValX1<Guid[][,,,][]>>().VerifyLayout();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/Loader/classloader/generics/Layout/General/class02_seq_ser.csproj b/tests/src/Loader/classloader/generics/Layout/General/class02_seq_ser.csproj
new file mode 100644
index 0000000000..e4118bd5be
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/class02_seq_ser.csproj
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <AssemblyName>class02_seq_ser</AssemblyName>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <OutputType>Exe</OutputType>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Include="class02_seq_ser.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="project.json" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Loader/classloader/generics/Layout/General/project.json b/tests/src/Loader/classloader/generics/Layout/General/project.json
new file mode 100644
index 0000000000..a2e84dc340
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/project.json
@@ -0,0 +1,35 @@
+{
+ "dependencies": {
+ "Microsoft.NETCore.Platforms": "1.0.1-rc2-23816",
+ "System.Collections": "4.0.10",
+ "System.Collections.NonGeneric": "4.0.1-rc2-23816",
+ "System.Collections.Specialized": "4.0.1-rc2-23816",
+ "System.ComponentModel": "4.0.1-rc2-23816",
+ "System.Console": "4.0.0-rc2-23816",
+ "System.Diagnostics.Process": "4.1.0-rc2-23816",
+ "System.Globalization": "4.0.10",
+ "System.Globalization.Calendars": "4.0.0",
+ "System.IO": "4.0.10",
+ "System.IO.FileSystem": "4.0.0",
+ "System.IO.FileSystem.Primitives": "4.0.0",
+ "System.Linq": "4.0.1-rc2-23816",
+ "System.Linq.Queryable": "4.0.1-rc2-23816",
+ "System.Reflection": "4.0.10",
+ "System.Reflection.Primitives": "4.0.0",
+ "System.Runtime": "4.1.0-rc2-23816",
+ "System.Runtime.Extensions": "4.0.10",
+ "System.Runtime.Handles": "4.0.0",
+ "System.Runtime.InteropServices": "4.1.0-rc2-23816",
+ "System.Runtime.Loader": "4.0.0-rc2-23816",
+ "System.Text.Encoding": "4.0.10",
+ "System.Threading": "4.0.10",
+ "System.Threading.Thread": "4.0.0-rc2-23816",
+ "System.Xml.ReaderWriter": "4.0.11-rc2-23816",
+ "System.Xml.XDocument": "4.0.11-rc2-23816",
+ "System.Xml.XmlDocument": "4.0.1-rc2-23816",
+ "System.Xml.XmlSerializer": "4.0.11-rc2-23816"
+ },
+ "frameworks": {
+ "dnxcore50": {}
+ }
+}
diff --git a/tests/src/Loader/classloader/generics/Layout/General/struct01_auto.cs b/tests/src/Loader/classloader/generics/Layout/General/struct01_auto.cs
new file mode 100644
index 0000000000..afcfe879f6
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/struct01_auto.cs
@@ -0,0 +1,114 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+
+
+
+public struct ValX1<T> {}
+public struct ValX2<T,U> {}
+public struct ValX3<T,U,V>{}
+public class RefX1<T> {}
+public class RefX2<T,U> {}
+public class RefX3<T,U,V>{}
+
+
+[StructLayout(LayoutKind.Auto)]
+public struct Gen<T>
+{
+ public T Fld10;
+
+ public int _int0;
+ public double _double0;
+ public string _string0;
+ public Guid _Guid0;
+
+ public T Fld11;
+
+ public int _int1;
+ public double _double1;
+ public string _string1;
+ public Guid _Guid1;
+
+ public T Fld12;
+
+ public void VerifyLayout()
+ {
+ _int0 = 0;
+ _double0 = 0;
+ _string0 = "string0";
+ _Guid0 = new Guid();
+
+ _int1 = int.MaxValue;
+ _double1 = double.MaxValue;
+ _string1 = "string1";
+ _Guid1 = new Guid(1,2,3,4,5,6,7,8,9,10,11);
+
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(_string0.Equals("string0"));
+ Test.Eval(_string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int>().VerifyLayout();
+ new Gen<double>().VerifyLayout();
+ new Gen<string>().VerifyLayout();
+ new Gen<object>().VerifyLayout();
+ new Gen<Guid>().VerifyLayout();
+
+ new Gen<int[]>().VerifyLayout();
+ new Gen<double[,]>().VerifyLayout();
+ new Gen<string[][][]>().VerifyLayout();
+ new Gen<object[,,,]>().VerifyLayout();
+ new Gen<Guid[][,,,][]>().VerifyLayout();
+
+ new Gen<RefX1<int>[]>().VerifyLayout();
+ new Gen<RefX1<double>[,]>().VerifyLayout();
+ new Gen<RefX1<string>[][][]>().VerifyLayout();
+ new Gen<RefX1<object>[,,,]>().VerifyLayout();
+ new Gen<RefX1<Guid>[][,,,][]>().VerifyLayout();
+
+ new Gen<ValX1<int>[]>().VerifyLayout();
+ new Gen<ValX1<double>[,]>().VerifyLayout();
+ new Gen<ValX1<string>[][][]>().VerifyLayout();
+ new Gen<ValX1<object>[,,,]>().VerifyLayout();
+ new Gen<ValX1<Guid>[][,,,][]>().VerifyLayout();
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/Loader/classloader/generics/Layout/General/struct01_auto.csproj b/tests/src/Loader/classloader/generics/Layout/General/struct01_auto.csproj
new file mode 100644
index 0000000000..d12f20722b
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/struct01_auto.csproj
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <AssemblyName>struct01_auto</AssemblyName>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <OutputType>Exe</OutputType>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Include="struct01_auto.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="project.json" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Loader/classloader/generics/Layout/General/struct01_auto_ser.cs b/tests/src/Loader/classloader/generics/Layout/General/struct01_auto_ser.cs
new file mode 100644
index 0000000000..afcfe879f6
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/struct01_auto_ser.cs
@@ -0,0 +1,114 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+
+
+
+public struct ValX1<T> {}
+public struct ValX2<T,U> {}
+public struct ValX3<T,U,V>{}
+public class RefX1<T> {}
+public class RefX2<T,U> {}
+public class RefX3<T,U,V>{}
+
+
+[StructLayout(LayoutKind.Auto)]
+public struct Gen<T>
+{
+ public T Fld10;
+
+ public int _int0;
+ public double _double0;
+ public string _string0;
+ public Guid _Guid0;
+
+ public T Fld11;
+
+ public int _int1;
+ public double _double1;
+ public string _string1;
+ public Guid _Guid1;
+
+ public T Fld12;
+
+ public void VerifyLayout()
+ {
+ _int0 = 0;
+ _double0 = 0;
+ _string0 = "string0";
+ _Guid0 = new Guid();
+
+ _int1 = int.MaxValue;
+ _double1 = double.MaxValue;
+ _string1 = "string1";
+ _Guid1 = new Guid(1,2,3,4,5,6,7,8,9,10,11);
+
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(_string0.Equals("string0"));
+ Test.Eval(_string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int>().VerifyLayout();
+ new Gen<double>().VerifyLayout();
+ new Gen<string>().VerifyLayout();
+ new Gen<object>().VerifyLayout();
+ new Gen<Guid>().VerifyLayout();
+
+ new Gen<int[]>().VerifyLayout();
+ new Gen<double[,]>().VerifyLayout();
+ new Gen<string[][][]>().VerifyLayout();
+ new Gen<object[,,,]>().VerifyLayout();
+ new Gen<Guid[][,,,][]>().VerifyLayout();
+
+ new Gen<RefX1<int>[]>().VerifyLayout();
+ new Gen<RefX1<double>[,]>().VerifyLayout();
+ new Gen<RefX1<string>[][][]>().VerifyLayout();
+ new Gen<RefX1<object>[,,,]>().VerifyLayout();
+ new Gen<RefX1<Guid>[][,,,][]>().VerifyLayout();
+
+ new Gen<ValX1<int>[]>().VerifyLayout();
+ new Gen<ValX1<double>[,]>().VerifyLayout();
+ new Gen<ValX1<string>[][][]>().VerifyLayout();
+ new Gen<ValX1<object>[,,,]>().VerifyLayout();
+ new Gen<ValX1<Guid>[][,,,][]>().VerifyLayout();
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/Loader/classloader/generics/Layout/General/struct01_auto_ser.csproj b/tests/src/Loader/classloader/generics/Layout/General/struct01_auto_ser.csproj
new file mode 100644
index 0000000000..1c05dbe6f5
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/struct01_auto_ser.csproj
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <AssemblyName>struct01_auto_ser</AssemblyName>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <OutputType>Exe</OutputType>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Include="struct01_auto_ser.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="project.json" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Loader/classloader/generics/Layout/General/struct01_seq.cs b/tests/src/Loader/classloader/generics/Layout/General/struct01_seq.cs
new file mode 100644
index 0000000000..c3c9065542
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/struct01_seq.cs
@@ -0,0 +1,114 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+
+
+
+public struct ValX1<T> {}
+public struct ValX2<T,U> {}
+public struct ValX3<T,U,V>{}
+public class RefX1<T> {}
+public class RefX2<T,U> {}
+public class RefX3<T,U,V>{}
+
+
+[StructLayout(LayoutKind.Sequential)]
+public struct Gen<T>
+{
+ public T Fld10;
+
+ public int _int0;
+ public double _double0;
+ public string _string0;
+ public Guid _Guid0;
+
+ public T Fld11;
+
+ public int _int1;
+ public double _double1;
+ public string _string1;
+ public Guid _Guid1;
+
+ public T Fld12;
+
+ public void VerifyLayout()
+ {
+ _int0 = 0;
+ _double0 = 0;
+ _string0 = "string0";
+ _Guid0 = new Guid();
+
+ _int1 = int.MaxValue;
+ _double1 = double.MaxValue;
+ _string1 = "string1";
+ _Guid1 = new Guid(1,2,3,4,5,6,7,8,9,10,11);
+
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == int.MaxValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1 == double.MaxValue) ;
+ Test.Eval(_string0.Equals("string0"));
+ Test.Eval(_string1.Equals("string1"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int>().VerifyLayout();
+ new Gen<double>().VerifyLayout();
+ new Gen<string>().VerifyLayout();
+ new Gen<object>().VerifyLayout();
+ new Gen<Guid>().VerifyLayout();
+
+ new Gen<int[]>().VerifyLayout();
+ new Gen<double[,]>().VerifyLayout();
+ new Gen<string[][][]>().VerifyLayout();
+ new Gen<object[,,,]>().VerifyLayout();
+ new Gen<Guid[][,,,][]>().VerifyLayout();
+
+ new Gen<RefX1<int>[]>().VerifyLayout();
+ new Gen<RefX1<double>[,]>().VerifyLayout();
+ new Gen<RefX1<string>[][][]>().VerifyLayout();
+ new Gen<RefX1<object>[,,,]>().VerifyLayout();
+ new Gen<RefX1<Guid>[][,,,][]>().VerifyLayout();
+
+ new Gen<ValX1<int>[]>().VerifyLayout();
+ new Gen<ValX1<double>[,]>().VerifyLayout();
+ new Gen<ValX1<string>[][][]>().VerifyLayout();
+ new Gen<ValX1<object>[,,,]>().VerifyLayout();
+ new Gen<ValX1<Guid>[][,,,][]>().VerifyLayout();
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/Loader/classloader/generics/Layout/General/struct01_seq.csproj b/tests/src/Loader/classloader/generics/Layout/General/struct01_seq.csproj
new file mode 100644
index 0000000000..e3b7b8986e
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/struct01_seq.csproj
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <AssemblyName>struct01_seq</AssemblyName>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <OutputType>Exe</OutputType>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Include="struct01_seq.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="project.json" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Loader/classloader/generics/Layout/General/struct01_seq_ser.cs b/tests/src/Loader/classloader/generics/Layout/General/struct01_seq_ser.cs
new file mode 100644
index 0000000000..ba19050592
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/struct01_seq_ser.cs
@@ -0,0 +1,180 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+
+public struct ValX1<T> {}
+public struct ValX2<T,U> {}
+public struct ValX3<T,U,V>{}
+public class RefX1<T> {}
+public class RefX2<T,U> {}
+public class RefX3<T,U,V>{}
+
+
+[StructLayout(LayoutKind.Sequential)]
+public struct Gen<T,U>
+{
+ public T Fld10;
+
+ public int _int0;
+ public double _double0;
+ public string _string0;
+ public Guid _Guid0;
+
+ public U Fld20;
+
+ public int _int1;
+ public double _double1;
+ public string _string1;
+ public Guid _Guid1;
+
+ public T Fld11;
+ public U Fld21;
+
+ public int _int2;
+ public double _double2;
+ public string _string2;
+ public Guid _Guid2;
+
+ public T Fld12;
+
+ public int _int3;
+ public double _double3;
+ public string _string3;
+ public Guid _Guid3;
+
+ public U Fld22;
+
+ public void VerifyLayout()
+ {
+ _int0 = 0;
+ _double0 = 0;
+ _string0 = "string0";
+ _Guid0 = new Guid();
+
+ _int1 = 1;
+ _double1 = 1;
+ _string1 = "string1";
+ _Guid1 = new Guid(1,2,3,4,5,6,7,8,9,10,11);
+
+ _int2 = int.MaxValue;
+ _double2 = double.MaxValue;
+ _string2 = "string2";
+ _Guid2 = new Guid(11,21,31,41,51,61,71,81,91,101,111);
+
+ _int3 = int.MinValue;
+ _double3 = double.MinValue;
+ _string3 = "string3";
+ _Guid3 = new Guid(12,22,32,42,52,62,72,82,92,102,112);
+
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == 1);
+ Test.Eval(_int2 == int.MaxValue) ;
+ Test.Eval(_int3 == int.MinValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1== 1) ;
+ Test.Eval(_double2 == double.MaxValue) ;
+ Test.Eval(_double3 == double.MinValue) ;
+ Test.Eval(_string0.Equals("string0"));
+ Test.Eval(_string1.Equals("string1"));
+ Test.Eval(_string2.Equals("string2"));
+ Test.Eval(_string3.Equals("string3"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ Test.Eval(_Guid2 == new Guid(11,21,31,41,51,61,71,81,91,101,111));
+ Test.Eval(_Guid3 == new Guid(12,22,32,42,52,62,72,82,92,102,112));
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int,int>().VerifyLayout();
+ new Gen<int,double>().VerifyLayout();
+ new Gen<int,string>().VerifyLayout();
+ new Gen<int,object>().VerifyLayout();
+ new Gen<int,Guid>().VerifyLayout();
+ new Gen<int,RefX1<int>>().VerifyLayout();
+ new Gen<int,RefX1<string>>().VerifyLayout();
+ new Gen<int,RefX1<int[][,,,][]>>().VerifyLayout();
+ new Gen<int,ValX1<int>>().VerifyLayout();
+ new Gen<int,ValX1<string>>().VerifyLayout();
+ new Gen<int,ValX1<int[][,,,][]>>().VerifyLayout();
+
+ new Gen<double,int>().VerifyLayout();
+ new Gen<double,double>().VerifyLayout();
+ new Gen<double,string>().VerifyLayout();
+ new Gen<double,object>().VerifyLayout();
+ new Gen<double,Guid>().VerifyLayout();
+ new Gen<double,RefX1<double>>().VerifyLayout();
+ new Gen<double,RefX1<string>>().VerifyLayout();
+ new Gen<double,RefX1<double[][,,,][]>>().VerifyLayout();
+ new Gen<double,ValX1<double>>().VerifyLayout();
+ new Gen<double,ValX1<string>>().VerifyLayout();
+ new Gen<double,ValX1<double[][,,,][]>>().VerifyLayout();
+
+ new Gen<string,int>().VerifyLayout();
+ new Gen<string,double>().VerifyLayout();
+ new Gen<string,string>().VerifyLayout();
+ new Gen<string,object>().VerifyLayout();
+ new Gen<string,Guid>().VerifyLayout();
+ new Gen<string,RefX1<string>>().VerifyLayout();
+ new Gen<string,RefX1<string>>().VerifyLayout();
+ new Gen<string,RefX1<string[][,,,][]>>().VerifyLayout();
+ new Gen<string,ValX1<string>>().VerifyLayout();
+ new Gen<string,ValX1<string>>().VerifyLayout();
+ new Gen<string,ValX1<string[][,,,][]>>().VerifyLayout();
+
+ new Gen<object,int>().VerifyLayout();
+ new Gen<object,double>().VerifyLayout();
+ new Gen<object,string>().VerifyLayout();
+ new Gen<object,object>().VerifyLayout();
+ new Gen<object,Guid>().VerifyLayout();
+ new Gen<object,RefX1<object>>().VerifyLayout();
+ new Gen<object,RefX1<string>>().VerifyLayout();
+ new Gen<object,RefX1<object[][,,,][]>>().VerifyLayout();
+ new Gen<object,ValX1<object>>().VerifyLayout();
+ new Gen<object,ValX1<string>>().VerifyLayout();
+ new Gen<object,ValX1<object[][,,,][]>>().VerifyLayout();
+
+ new Gen<Guid,int>().VerifyLayout();
+ new Gen<Guid,double>().VerifyLayout();
+ new Gen<Guid,string>().VerifyLayout();
+ new Gen<Guid,object>().VerifyLayout();
+ new Gen<Guid,Guid>().VerifyLayout();
+ new Gen<Guid,RefX1<Guid>>().VerifyLayout();
+ new Gen<Guid,RefX1<string>>().VerifyLayout();
+ new Gen<Guid,RefX1<Guid[][,,,][]>>().VerifyLayout();
+ new Gen<Guid,ValX1<Guid>>().VerifyLayout();
+ new Gen<Guid,ValX1<string>>().VerifyLayout();
+ new Gen<Guid,ValX1<Guid[][,,,][]>>().VerifyLayout();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/Loader/classloader/generics/Layout/General/struct01_seq_ser.csproj b/tests/src/Loader/classloader/generics/Layout/General/struct01_seq_ser.csproj
new file mode 100644
index 0000000000..65eae4080f
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/struct01_seq_ser.csproj
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <AssemblyName>struct01_seq_ser</AssemblyName>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <OutputType>Exe</OutputType>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Include="struct01_seq_ser.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="project.json" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Loader/classloader/generics/Layout/General/struct02_auto.cs b/tests/src/Loader/classloader/generics/Layout/General/struct02_auto.cs
new file mode 100644
index 0000000000..1a5e02d1e7
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/struct02_auto.cs
@@ -0,0 +1,179 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+
+public struct ValX1<T> {}
+public struct ValX2<T,U> {}
+public struct ValX3<T,U,V>{}
+public class RefX1<T> {}
+public class RefX2<T,U> {}
+public class RefX3<T,U,V>{}
+
+[StructLayout(LayoutKind.Auto)]
+public struct Gen<T,U>
+{
+ public T Fld10;
+
+ public int _int0;
+ public double _double0;
+ public string _string0;
+ public Guid _Guid0;
+
+ public U Fld20;
+
+ public int _int1;
+ public double _double1;
+ public string _string1;
+ public Guid _Guid1;
+
+ public T Fld11;
+ public U Fld21;
+
+ public int _int2;
+ public double _double2;
+ public string _string2;
+ public Guid _Guid2;
+
+ public T Fld12;
+
+ public int _int3;
+ public double _double3;
+ public string _string3;
+ public Guid _Guid3;
+
+ public U Fld22;
+
+ public void VerifyLayout()
+ {
+ _int0 = 0;
+ _double0 = 0;
+ _string0 = "string0";
+ _Guid0 = new Guid();
+
+ _int1 = 1;
+ _double1 = 1;
+ _string1 = "string1";
+ _Guid1 = new Guid(1,2,3,4,5,6,7,8,9,10,11);
+
+ _int2 = int.MaxValue;
+ _double2 = double.MaxValue;
+ _string2 = "string2";
+ _Guid2 = new Guid(11,21,31,41,51,61,71,81,91,101,111);
+
+ _int3 = int.MinValue;
+ _double3 = double.MinValue;
+ _string3 = "string3";
+ _Guid3 = new Guid(12,22,32,42,52,62,72,82,92,102,112);
+
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == 1);
+ Test.Eval(_int2 == int.MaxValue) ;
+ Test.Eval(_int3 == int.MinValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1== 1) ;
+ Test.Eval(_double2 == double.MaxValue) ;
+ Test.Eval(_double3 == double.MinValue) ;
+ Test.Eval(_string0.Equals("string0"));
+ Test.Eval(_string1.Equals("string1"));
+ Test.Eval(_string2.Equals("string2"));
+ Test.Eval(_string3.Equals("string3"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ Test.Eval(_Guid2 == new Guid(11,21,31,41,51,61,71,81,91,101,111));
+ Test.Eval(_Guid3 == new Guid(12,22,32,42,52,62,72,82,92,102,112));
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int,int>().VerifyLayout();
+ new Gen<int,double>().VerifyLayout();
+ new Gen<int,string>().VerifyLayout();
+ new Gen<int,object>().VerifyLayout();
+ new Gen<int,Guid>().VerifyLayout();
+ new Gen<int,RefX1<int>>().VerifyLayout();
+ new Gen<int,RefX1<string>>().VerifyLayout();
+ new Gen<int,RefX1<int[][,,,][]>>().VerifyLayout();
+ new Gen<int,ValX1<int>>().VerifyLayout();
+ new Gen<int,ValX1<string>>().VerifyLayout();
+ new Gen<int,ValX1<int[][,,,][]>>().VerifyLayout();
+
+ new Gen<double,int>().VerifyLayout();
+ new Gen<double,double>().VerifyLayout();
+ new Gen<double,string>().VerifyLayout();
+ new Gen<double,object>().VerifyLayout();
+ new Gen<double,Guid>().VerifyLayout();
+ new Gen<double,RefX1<double>>().VerifyLayout();
+ new Gen<double,RefX1<string>>().VerifyLayout();
+ new Gen<double,RefX1<double[][,,,][]>>().VerifyLayout();
+ new Gen<double,ValX1<double>>().VerifyLayout();
+ new Gen<double,ValX1<string>>().VerifyLayout();
+ new Gen<double,ValX1<double[][,,,][]>>().VerifyLayout();
+
+ new Gen<string,int>().VerifyLayout();
+ new Gen<string,double>().VerifyLayout();
+ new Gen<string,string>().VerifyLayout();
+ new Gen<string,object>().VerifyLayout();
+ new Gen<string,Guid>().VerifyLayout();
+ new Gen<string,RefX1<string>>().VerifyLayout();
+ new Gen<string,RefX1<string>>().VerifyLayout();
+ new Gen<string,RefX1<string[][,,,][]>>().VerifyLayout();
+ new Gen<string,ValX1<string>>().VerifyLayout();
+ new Gen<string,ValX1<string>>().VerifyLayout();
+ new Gen<string,ValX1<string[][,,,][]>>().VerifyLayout();
+
+ new Gen<object,int>().VerifyLayout();
+ new Gen<object,double>().VerifyLayout();
+ new Gen<object,string>().VerifyLayout();
+ new Gen<object,object>().VerifyLayout();
+ new Gen<object,Guid>().VerifyLayout();
+ new Gen<object,RefX1<object>>().VerifyLayout();
+ new Gen<object,RefX1<string>>().VerifyLayout();
+ new Gen<object,RefX1<object[][,,,][]>>().VerifyLayout();
+ new Gen<object,ValX1<object>>().VerifyLayout();
+ new Gen<object,ValX1<string>>().VerifyLayout();
+ new Gen<object,ValX1<object[][,,,][]>>().VerifyLayout();
+
+ new Gen<Guid,int>().VerifyLayout();
+ new Gen<Guid,double>().VerifyLayout();
+ new Gen<Guid,string>().VerifyLayout();
+ new Gen<Guid,object>().VerifyLayout();
+ new Gen<Guid,Guid>().VerifyLayout();
+ new Gen<Guid,RefX1<Guid>>().VerifyLayout();
+ new Gen<Guid,RefX1<string>>().VerifyLayout();
+ new Gen<Guid,RefX1<Guid[][,,,][]>>().VerifyLayout();
+ new Gen<Guid,ValX1<Guid>>().VerifyLayout();
+ new Gen<Guid,ValX1<string>>().VerifyLayout();
+ new Gen<Guid,ValX1<Guid[][,,,][]>>().VerifyLayout();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/Loader/classloader/generics/Layout/General/struct02_auto.csproj b/tests/src/Loader/classloader/generics/Layout/General/struct02_auto.csproj
new file mode 100644
index 0000000000..abfb4bffcd
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/struct02_auto.csproj
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <AssemblyName>struct02_auto</AssemblyName>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <OutputType>Exe</OutputType>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Include="struct02_auto.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="project.json" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Loader/classloader/generics/Layout/General/struct02_auto_ser.cs b/tests/src/Loader/classloader/generics/Layout/General/struct02_auto_ser.cs
new file mode 100644
index 0000000000..37d26f3e30
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/struct02_auto_ser.cs
@@ -0,0 +1,180 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+
+public struct ValX1<T> {}
+public struct ValX2<T,U> {}
+public struct ValX3<T,U,V>{}
+public class RefX1<T> {}
+public class RefX2<T,U> {}
+public class RefX3<T,U,V>{}
+
+
+[StructLayout(LayoutKind.Auto)]
+public struct Gen<T,U>
+{
+ public T Fld10;
+
+ public int _int0;
+ public double _double0;
+ public string _string0;
+ public Guid _Guid0;
+
+ public U Fld20;
+
+ public int _int1;
+ public double _double1;
+ public string _string1;
+ public Guid _Guid1;
+
+ public T Fld11;
+ public U Fld21;
+
+ public int _int2;
+ public double _double2;
+ public string _string2;
+ public Guid _Guid2;
+
+ public T Fld12;
+
+ public int _int3;
+ public double _double3;
+ public string _string3;
+ public Guid _Guid3;
+
+ public U Fld22;
+
+ public void VerifyLayout()
+ {
+ _int0 = 0;
+ _double0 = 0;
+ _string0 = "string0";
+ _Guid0 = new Guid();
+
+ _int1 = 1;
+ _double1 = 1;
+ _string1 = "string1";
+ _Guid1 = new Guid(1,2,3,4,5,6,7,8,9,10,11);
+
+ _int2 = int.MaxValue;
+ _double2 = double.MaxValue;
+ _string2 = "string2";
+ _Guid2 = new Guid(11,21,31,41,51,61,71,81,91,101,111);
+
+ _int3 = int.MinValue;
+ _double3 = double.MinValue;
+ _string3 = "string3";
+ _Guid3 = new Guid(12,22,32,42,52,62,72,82,92,102,112);
+
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == 1);
+ Test.Eval(_int2 == int.MaxValue) ;
+ Test.Eval(_int3 == int.MinValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1== 1) ;
+ Test.Eval(_double2 == double.MaxValue) ;
+ Test.Eval(_double3 == double.MinValue) ;
+ Test.Eval(_string0.Equals("string0"));
+ Test.Eval(_string1.Equals("string1"));
+ Test.Eval(_string2.Equals("string2"));
+ Test.Eval(_string3.Equals("string3"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ Test.Eval(_Guid2 == new Guid(11,21,31,41,51,61,71,81,91,101,111));
+ Test.Eval(_Guid3 == new Guid(12,22,32,42,52,62,72,82,92,102,112));
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int,int>().VerifyLayout();
+ new Gen<int,double>().VerifyLayout();
+ new Gen<int,string>().VerifyLayout();
+ new Gen<int,object>().VerifyLayout();
+ new Gen<int,Guid>().VerifyLayout();
+ new Gen<int,RefX1<int>>().VerifyLayout();
+ new Gen<int,RefX1<string>>().VerifyLayout();
+ new Gen<int,RefX1<int[][,,,][]>>().VerifyLayout();
+ new Gen<int,ValX1<int>>().VerifyLayout();
+ new Gen<int,ValX1<string>>().VerifyLayout();
+ new Gen<int,ValX1<int[][,,,][]>>().VerifyLayout();
+
+ new Gen<double,int>().VerifyLayout();
+ new Gen<double,double>().VerifyLayout();
+ new Gen<double,string>().VerifyLayout();
+ new Gen<double,object>().VerifyLayout();
+ new Gen<double,Guid>().VerifyLayout();
+ new Gen<double,RefX1<double>>().VerifyLayout();
+ new Gen<double,RefX1<string>>().VerifyLayout();
+ new Gen<double,RefX1<double[][,,,][]>>().VerifyLayout();
+ new Gen<double,ValX1<double>>().VerifyLayout();
+ new Gen<double,ValX1<string>>().VerifyLayout();
+ new Gen<double,ValX1<double[][,,,][]>>().VerifyLayout();
+
+ new Gen<string,int>().VerifyLayout();
+ new Gen<string,double>().VerifyLayout();
+ new Gen<string,string>().VerifyLayout();
+ new Gen<string,object>().VerifyLayout();
+ new Gen<string,Guid>().VerifyLayout();
+ new Gen<string,RefX1<string>>().VerifyLayout();
+ new Gen<string,RefX1<string>>().VerifyLayout();
+ new Gen<string,RefX1<string[][,,,][]>>().VerifyLayout();
+ new Gen<string,ValX1<string>>().VerifyLayout();
+ new Gen<string,ValX1<string>>().VerifyLayout();
+ new Gen<string,ValX1<string[][,,,][]>>().VerifyLayout();
+
+ new Gen<object,int>().VerifyLayout();
+ new Gen<object,double>().VerifyLayout();
+ new Gen<object,string>().VerifyLayout();
+ new Gen<object,object>().VerifyLayout();
+ new Gen<object,Guid>().VerifyLayout();
+ new Gen<object,RefX1<object>>().VerifyLayout();
+ new Gen<object,RefX1<string>>().VerifyLayout();
+ new Gen<object,RefX1<object[][,,,][]>>().VerifyLayout();
+ new Gen<object,ValX1<object>>().VerifyLayout();
+ new Gen<object,ValX1<string>>().VerifyLayout();
+ new Gen<object,ValX1<object[][,,,][]>>().VerifyLayout();
+
+ new Gen<Guid,int>().VerifyLayout();
+ new Gen<Guid,double>().VerifyLayout();
+ new Gen<Guid,string>().VerifyLayout();
+ new Gen<Guid,object>().VerifyLayout();
+ new Gen<Guid,Guid>().VerifyLayout();
+ new Gen<Guid,RefX1<Guid>>().VerifyLayout();
+ new Gen<Guid,RefX1<string>>().VerifyLayout();
+ new Gen<Guid,RefX1<Guid[][,,,][]>>().VerifyLayout();
+ new Gen<Guid,ValX1<Guid>>().VerifyLayout();
+ new Gen<Guid,ValX1<string>>().VerifyLayout();
+ new Gen<Guid,ValX1<Guid[][,,,][]>>().VerifyLayout();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/Loader/classloader/generics/Layout/General/struct02_auto_ser.csproj b/tests/src/Loader/classloader/generics/Layout/General/struct02_auto_ser.csproj
new file mode 100644
index 0000000000..851a133a8b
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/struct02_auto_ser.csproj
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <AssemblyName>struct02_auto_ser</AssemblyName>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <OutputType>Exe</OutputType>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Include="struct02_auto_ser.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="project.json" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Loader/classloader/generics/Layout/General/struct02_seq.cs b/tests/src/Loader/classloader/generics/Layout/General/struct02_seq.cs
new file mode 100644
index 0000000000..d806a46fcf
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/struct02_seq.cs
@@ -0,0 +1,179 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+
+public struct ValX1<T> {}
+public struct ValX2<T,U> {}
+public struct ValX3<T,U,V>{}
+public class RefX1<T> {}
+public class RefX2<T,U> {}
+public class RefX3<T,U,V>{}
+
+[StructLayout(LayoutKind.Sequential)]
+public struct Gen<T,U>
+{
+ public T Fld10;
+
+ public int _int0;
+ public double _double0;
+ public string _string0;
+ public Guid _Guid0;
+
+ public U Fld20;
+
+ public int _int1;
+ public double _double1;
+ public string _string1;
+ public Guid _Guid1;
+
+ public T Fld11;
+ public U Fld21;
+
+ public int _int2;
+ public double _double2;
+ public string _string2;
+ public Guid _Guid2;
+
+ public T Fld12;
+
+ public int _int3;
+ public double _double3;
+ public string _string3;
+ public Guid _Guid3;
+
+ public U Fld22;
+
+ public void VerifyLayout()
+ {
+ _int0 = 0;
+ _double0 = 0;
+ _string0 = "string0";
+ _Guid0 = new Guid();
+
+ _int1 = 1;
+ _double1 = 1;
+ _string1 = "string1";
+ _Guid1 = new Guid(1,2,3,4,5,6,7,8,9,10,11);
+
+ _int2 = int.MaxValue;
+ _double2 = double.MaxValue;
+ _string2 = "string2";
+ _Guid2 = new Guid(11,21,31,41,51,61,71,81,91,101,111);
+
+ _int3 = int.MinValue;
+ _double3 = double.MinValue;
+ _string3 = "string3";
+ _Guid3 = new Guid(12,22,32,42,52,62,72,82,92,102,112);
+
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == 1);
+ Test.Eval(_int2 == int.MaxValue) ;
+ Test.Eval(_int3 == int.MinValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1== 1) ;
+ Test.Eval(_double2 == double.MaxValue) ;
+ Test.Eval(_double3 == double.MinValue) ;
+ Test.Eval(_string0.Equals("string0"));
+ Test.Eval(_string1.Equals("string1"));
+ Test.Eval(_string2.Equals("string2"));
+ Test.Eval(_string3.Equals("string3"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ Test.Eval(_Guid2 == new Guid(11,21,31,41,51,61,71,81,91,101,111));
+ Test.Eval(_Guid3 == new Guid(12,22,32,42,52,62,72,82,92,102,112));
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int,int>().VerifyLayout();
+ new Gen<int,double>().VerifyLayout();
+ new Gen<int,string>().VerifyLayout();
+ new Gen<int,object>().VerifyLayout();
+ new Gen<int,Guid>().VerifyLayout();
+ new Gen<int,RefX1<int>>().VerifyLayout();
+ new Gen<int,RefX1<string>>().VerifyLayout();
+ new Gen<int,RefX1<int[][,,,][]>>().VerifyLayout();
+ new Gen<int,ValX1<int>>().VerifyLayout();
+ new Gen<int,ValX1<string>>().VerifyLayout();
+ new Gen<int,ValX1<int[][,,,][]>>().VerifyLayout();
+
+ new Gen<double,int>().VerifyLayout();
+ new Gen<double,double>().VerifyLayout();
+ new Gen<double,string>().VerifyLayout();
+ new Gen<double,object>().VerifyLayout();
+ new Gen<double,Guid>().VerifyLayout();
+ new Gen<double,RefX1<double>>().VerifyLayout();
+ new Gen<double,RefX1<string>>().VerifyLayout();
+ new Gen<double,RefX1<double[][,,,][]>>().VerifyLayout();
+ new Gen<double,ValX1<double>>().VerifyLayout();
+ new Gen<double,ValX1<string>>().VerifyLayout();
+ new Gen<double,ValX1<double[][,,,][]>>().VerifyLayout();
+
+ new Gen<string,int>().VerifyLayout();
+ new Gen<string,double>().VerifyLayout();
+ new Gen<string,string>().VerifyLayout();
+ new Gen<string,object>().VerifyLayout();
+ new Gen<string,Guid>().VerifyLayout();
+ new Gen<string,RefX1<string>>().VerifyLayout();
+ new Gen<string,RefX1<string>>().VerifyLayout();
+ new Gen<string,RefX1<string[][,,,][]>>().VerifyLayout();
+ new Gen<string,ValX1<string>>().VerifyLayout();
+ new Gen<string,ValX1<string>>().VerifyLayout();
+ new Gen<string,ValX1<string[][,,,][]>>().VerifyLayout();
+
+ new Gen<object,int>().VerifyLayout();
+ new Gen<object,double>().VerifyLayout();
+ new Gen<object,string>().VerifyLayout();
+ new Gen<object,object>().VerifyLayout();
+ new Gen<object,Guid>().VerifyLayout();
+ new Gen<object,RefX1<object>>().VerifyLayout();
+ new Gen<object,RefX1<string>>().VerifyLayout();
+ new Gen<object,RefX1<object[][,,,][]>>().VerifyLayout();
+ new Gen<object,ValX1<object>>().VerifyLayout();
+ new Gen<object,ValX1<string>>().VerifyLayout();
+ new Gen<object,ValX1<object[][,,,][]>>().VerifyLayout();
+
+ new Gen<Guid,int>().VerifyLayout();
+ new Gen<Guid,double>().VerifyLayout();
+ new Gen<Guid,string>().VerifyLayout();
+ new Gen<Guid,object>().VerifyLayout();
+ new Gen<Guid,Guid>().VerifyLayout();
+ new Gen<Guid,RefX1<Guid>>().VerifyLayout();
+ new Gen<Guid,RefX1<string>>().VerifyLayout();
+ new Gen<Guid,RefX1<Guid[][,,,][]>>().VerifyLayout();
+ new Gen<Guid,ValX1<Guid>>().VerifyLayout();
+ new Gen<Guid,ValX1<string>>().VerifyLayout();
+ new Gen<Guid,ValX1<Guid[][,,,][]>>().VerifyLayout();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/Loader/classloader/generics/Layout/General/struct02_seq.csproj b/tests/src/Loader/classloader/generics/Layout/General/struct02_seq.csproj
new file mode 100644
index 0000000000..2aeb171f75
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/struct02_seq.csproj
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <AssemblyName>struct02_seq</AssemblyName>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <OutputType>Exe</OutputType>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Include="struct02_seq.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="project.json" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Loader/classloader/generics/Layout/General/struct02_seq_ser.cs b/tests/src/Loader/classloader/generics/Layout/General/struct02_seq_ser.cs
new file mode 100644
index 0000000000..d7c60532f6
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/struct02_seq_ser.cs
@@ -0,0 +1,178 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+
+public struct ValX1<T> {}
+public struct ValX2<T,U> {}
+public struct ValX3<T,U,V>{}
+public class RefX1<T> {}
+public class RefX2<T,U> {}
+public class RefX3<T,U,V>{}
+
+
+[StructLayout(LayoutKind.Sequential)]
+public struct Gen<T,U>
+{
+ public int _int0;
+ public double _double0;
+ public string _string0;
+ public Guid _Guid0;
+
+ public U Fld20;
+
+ public int _int1;
+ public double _double1;
+ public string _string1;
+ public Guid _Guid1;
+
+ public T Fld11;
+ public U Fld21;
+
+ public int _int2;
+ public double _double2;
+ public string _string2;
+ public Guid _Guid2;
+
+ public T Fld12;
+
+ public int _int3;
+ public double _double3;
+ public string _string3;
+ public Guid _Guid3;
+
+ public U Fld22;
+
+ public void VerifyLayout()
+ {
+ _int0 = 0;
+ _double0 = 0;
+ _string0 = "string0";
+ _Guid0 = new Guid();
+
+ _int1 = 1;
+ _double1 = 1;
+ _string1 = "string1";
+ _Guid1 = new Guid(1,2,3,4,5,6,7,8,9,10,11);
+
+ _int2 = int.MaxValue;
+ _double2 = double.MaxValue;
+ _string2 = "string2";
+ _Guid2 = new Guid(11,21,31,41,51,61,71,81,91,101,111);
+
+ _int3 = int.MinValue;
+ _double3 = double.MinValue;
+ _string3 = "string3";
+ _Guid3 = new Guid(12,22,32,42,52,62,72,82,92,102,112);
+
+ Test.Eval(_int0 == 0);
+ Test.Eval(_int1 == 1);
+ Test.Eval(_int2 == int.MaxValue) ;
+ Test.Eval(_int3 == int.MinValue) ;
+ Test.Eval(_double0 == 0) ;
+ Test.Eval(_double1== 1) ;
+ Test.Eval(_double2 == double.MaxValue) ;
+ Test.Eval(_double3 == double.MinValue) ;
+ Test.Eval(_string0.Equals("string0"));
+ Test.Eval(_string1.Equals("string1"));
+ Test.Eval(_string2.Equals("string2"));
+ Test.Eval(_string3.Equals("string3"));
+ Test.Eval(_Guid0 == new Guid());
+ Test.Eval(_Guid1 == new Guid(1,2,3,4,5,6,7,8,9,10,11));
+ Test.Eval(_Guid2 == new Guid(11,21,31,41,51,61,71,81,91,101,111));
+ Test.Eval(_Guid3 == new Guid(12,22,32,42,52,62,72,82,92,102,112));
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+ new Gen<int,int>().VerifyLayout();
+ new Gen<int,double>().VerifyLayout();
+ new Gen<int,string>().VerifyLayout();
+ new Gen<int,object>().VerifyLayout();
+ new Gen<int,Guid>().VerifyLayout();
+ new Gen<int,RefX1<int>>().VerifyLayout();
+ new Gen<int,RefX1<string>>().VerifyLayout();
+ new Gen<int,RefX1<int[][,,,][]>>().VerifyLayout();
+ new Gen<int,ValX1<int>>().VerifyLayout();
+ new Gen<int,ValX1<string>>().VerifyLayout();
+ new Gen<int,ValX1<int[][,,,][]>>().VerifyLayout();
+
+ new Gen<double,int>().VerifyLayout();
+ new Gen<double,double>().VerifyLayout();
+ new Gen<double,string>().VerifyLayout();
+ new Gen<double,object>().VerifyLayout();
+ new Gen<double,Guid>().VerifyLayout();
+ new Gen<double,RefX1<double>>().VerifyLayout();
+ new Gen<double,RefX1<string>>().VerifyLayout();
+ new Gen<double,RefX1<double[][,,,][]>>().VerifyLayout();
+ new Gen<double,ValX1<double>>().VerifyLayout();
+ new Gen<double,ValX1<string>>().VerifyLayout();
+ new Gen<double,ValX1<double[][,,,][]>>().VerifyLayout();
+
+ new Gen<string,int>().VerifyLayout();
+ new Gen<string,double>().VerifyLayout();
+ new Gen<string,string>().VerifyLayout();
+ new Gen<string,object>().VerifyLayout();
+ new Gen<string,Guid>().VerifyLayout();
+ new Gen<string,RefX1<string>>().VerifyLayout();
+ new Gen<string,RefX1<string>>().VerifyLayout();
+ new Gen<string,RefX1<string[][,,,][]>>().VerifyLayout();
+ new Gen<string,ValX1<string>>().VerifyLayout();
+ new Gen<string,ValX1<string>>().VerifyLayout();
+ new Gen<string,ValX1<string[][,,,][]>>().VerifyLayout();
+
+ new Gen<object,int>().VerifyLayout();
+ new Gen<object,double>().VerifyLayout();
+ new Gen<object,string>().VerifyLayout();
+ new Gen<object,object>().VerifyLayout();
+ new Gen<object,Guid>().VerifyLayout();
+ new Gen<object,RefX1<object>>().VerifyLayout();
+ new Gen<object,RefX1<string>>().VerifyLayout();
+ new Gen<object,RefX1<object[][,,,][]>>().VerifyLayout();
+ new Gen<object,ValX1<object>>().VerifyLayout();
+ new Gen<object,ValX1<string>>().VerifyLayout();
+ new Gen<object,ValX1<object[][,,,][]>>().VerifyLayout();
+
+ new Gen<Guid,int>().VerifyLayout();
+ new Gen<Guid,double>().VerifyLayout();
+ new Gen<Guid,string>().VerifyLayout();
+ new Gen<Guid,object>().VerifyLayout();
+ new Gen<Guid,Guid>().VerifyLayout();
+ new Gen<Guid,RefX1<Guid>>().VerifyLayout();
+ new Gen<Guid,RefX1<string>>().VerifyLayout();
+ new Gen<Guid,RefX1<Guid[][,,,][]>>().VerifyLayout();
+ new Gen<Guid,ValX1<Guid>>().VerifyLayout();
+ new Gen<Guid,ValX1<string>>().VerifyLayout();
+ new Gen<Guid,ValX1<Guid[][,,,][]>>().VerifyLayout();
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+
+}
diff --git a/tests/src/Loader/classloader/generics/Layout/General/struct02_seq_ser.csproj b/tests/src/Loader/classloader/generics/Layout/General/struct02_seq_ser.csproj
new file mode 100644
index 0000000000..52678661dd
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/General/struct02_seq_ser.csproj
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <AssemblyName>struct02_seq_ser</AssemblyName>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <OutputType>Exe</OutputType>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Include="struct02_seq_ser.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="project.json" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Loader/classloader/generics/Layout/Specific/Negative002.cs b/tests/src/Loader/classloader/generics/Layout/Specific/Negative002.cs
new file mode 100644
index 0000000000..076b58ddde
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/Specific/Negative002.cs
@@ -0,0 +1,99 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+
+[StructLayout(LayoutKind.Auto)]
+public class GenBase<T>
+{
+ T t;
+ T Dummy(T t) { this.t = t; return t;}
+}
+
+[StructLayout(LayoutKind.Sequential)]
+public class Gen<T> : GenBase<T>
+{
+ T Dummy(T t) { return t;}
+}
+
+public class GenTest<T>
+{
+ private Gen<T> InternalTest()
+ {
+ return new Gen<T>();
+ }
+
+ private void IndirectTest()
+ {
+ InternalTest();
+ }
+ public bool Test()
+ {
+ try
+ {
+ IndirectTest();
+ Console.WriteLine("Test did not throw expected TypeLoadException");
+ return false;
+ }
+ catch(TypeLoadException)
+ {
+ return true;
+ }
+ catch(Exception E)
+ {
+ Console.WriteLine("Test caught unexpected Exception " + E);
+ return false;
+ }
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+
+ Eval(new GenTest<int>().Test());
+ Eval(new GenTest<double>().Test());
+ Eval(new GenTest<Guid>().Test());
+ Eval(new GenTest<string>().Test());
+ Eval(new GenTest<object>().Test());
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/src/Loader/classloader/generics/Layout/Specific/Negative002.csproj b/tests/src/Loader/classloader/generics/Layout/Specific/Negative002.csproj
new file mode 100644
index 0000000000..f2115abdb9
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/Specific/Negative002.csproj
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <AssemblyName>Negative002</AssemblyName>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <OutputType>Exe</OutputType>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Include="Negative002.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="project.json" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Loader/classloader/generics/Layout/Specific/Negative004.cs b/tests/src/Loader/classloader/generics/Layout/Specific/Negative004.cs
new file mode 100644
index 0000000000..949fc0073a
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/Specific/Negative004.cs
@@ -0,0 +1,95 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+
+[StructLayout(LayoutKind.Auto)]
+public class GenBase<T>
+{
+ T t;
+ T Dummy(T t) { this.t = t; return t;}
+}
+
+[StructLayout(LayoutKind.Sequential)]
+public class GenInt : GenBase<int>
+{
+
+}
+
+public class GenTest
+{
+ private GenInt InternalTest()
+ {
+ return new GenInt();
+ }
+
+ private void IndirectTest()
+ {
+ InternalTest();
+ }
+ public bool Test()
+ {
+ try
+ {
+ IndirectTest();
+ Console.WriteLine("Test did not throw expected TypeLoadException");
+ return false;
+ }
+ catch(TypeLoadException)
+ {
+ return true;
+ }
+ catch(Exception E)
+ {
+ Console.WriteLine("Test caught unexpected Exception " + E);
+ return false;
+ }
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+
+ Eval(new GenTest().Test());
+
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/src/Loader/classloader/generics/Layout/Specific/Negative004.csproj b/tests/src/Loader/classloader/generics/Layout/Specific/Negative004.csproj
new file mode 100644
index 0000000000..595034e28d
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/Specific/Negative004.csproj
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <AssemblyName>Negative004</AssemblyName>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <OutputType>Exe</OutputType>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Include="Negative004.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="project.json" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Loader/classloader/generics/Layout/Specific/Negative_ExplicitGen.cs b/tests/src/Loader/classloader/generics/Layout/Specific/Negative_ExplicitGen.cs
new file mode 100644
index 0000000000..f09338bbab
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/Specific/Negative_ExplicitGen.cs
@@ -0,0 +1,214 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+// This test tests that we throw TypeLoadException when trying to load explicit generic class/struct, since we do not allow
+// explicit generic types anymore.
+
+
+using System;
+using System.Runtime.InteropServices;
+
+[StructLayout(LayoutKind.Explicit)]
+public class Gen1<T>
+{
+ // multiple fields, first generic
+ [FieldOffset(0)] public T t;
+ [FieldOffset(16)]public int _int0 = 0;
+}
+
+[StructLayout(LayoutKind.Explicit)]
+public class Gen2<T>
+{
+ // single field, generic
+ [FieldOffset(0)] public T t;
+}
+
+[StructLayout(LayoutKind.Explicit)]
+public class Gen3<T>
+{
+ // single field, not generic
+ [FieldOffset(0)] public int t;
+}
+
+[StructLayout(LayoutKind.Explicit)]
+public class Gen4<T>
+{
+ // multiple generic fields
+ [FieldOffset(0)] public T t1;
+ [FieldOffset(16)] public T t2;
+ [FieldOffset(32)] public T t3;
+
+}
+
+[StructLayout(LayoutKind.Explicit)]
+public struct Gen5<T>
+{
+ // multiple fields, generic is not first in a struct
+ [FieldOffset(0)] public int t1;
+ [FieldOffset(16)] public T t2;
+}
+
+[StructLayout(LayoutKind.Explicit)]
+public struct Gen6<T>
+{
+ // single generic field in a struct
+ [FieldOffset(0)] public T t1;
+}
+
+[StructLayout(LayoutKind.Sequential)]
+public struct Gen8<T>
+{
+ // single generic field in a struct
+ public T t1;
+ public int i;
+}
+
+
+[StructLayout(LayoutKind.Explicit)]
+public class Gen7<T>
+{
+ // nested sequential struct inside explicit struct
+ [FieldOffset(0)]
+ public Gen8<int> struct_Gen8;
+ [FieldOffset(0)] public T t;
+}
+
+
+
+class Test
+{
+ public static void goGen1()
+ {
+ Gen1<int> gen1 = new Gen1<int>();
+ gen1.t = 5;
+
+ Console.WriteLine("Gen1: FAIL");
+ }
+
+ public static void goGen2()
+ {
+ Gen2<int> gen2 = new Gen2<int>();
+ gen2.t = 5;
+
+ Console.WriteLine("Gen2: FAIL");
+}
+
+ public static void goGen3()
+ {
+ Gen3<int> gen3 = new Gen3<int>();
+ gen3.t = 5;
+
+ Console.WriteLine("Gen3: FAIL");
+}
+
+ public static void goGen4()
+ {
+ Gen4<int> gen4 = new Gen4<int>();
+ gen4.t1 = 5;
+
+ Console.WriteLine("Gen4: FAIL");
+ }
+
+ public static void goGen5(){
+ Gen5<int> gen5 = new Gen5<int>();
+ gen5.t1 = 5;
+
+ Console.WriteLine("Gen5: FAIL");
+ }
+
+ public static void goGen6(){
+ Gen6<int> gen6 = new Gen6<int>();
+ gen6.t1 = 5;
+ Console.WriteLine("Gen6: FAIL");
+ }
+
+ public static void goGen7(){
+ Gen7<int> gen7 = new Gen7<int>();
+ gen7.t = 5;
+ gen7.struct_Gen8 = new Gen8<int>();
+
+ Console.WriteLine("Gen7: FAIL");
+ }
+
+ static int Main(string[] args)
+ {
+ bool pass = true;
+
+ try
+ {
+ goGen1();
+ pass = false;
+ }
+ catch(TypeLoadException)
+ {
+ Console.WriteLine("Gen1: PASS");
+ }
+ try
+ {
+ goGen2();
+ pass = false;
+ }
+ catch(TypeLoadException)
+ {
+ Console.WriteLine("Gen2: PASS");
+ }
+ try
+ {
+ goGen3();
+ pass = false;
+ }
+ catch(TypeLoadException)
+ {
+ Console.WriteLine("Gen3: PASS");
+ }
+ try
+ {
+ goGen4();
+ pass = false;
+ }
+ catch(TypeLoadException)
+ {
+ Console.WriteLine("Gen4: PASS");
+ }
+ try
+ {
+ goGen5();
+ pass = false;
+ }
+ catch(TypeLoadException)
+ {
+ Console.WriteLine("Gen5: PASS");
+ }
+ try
+ {
+ goGen6();
+ pass = false;
+ }
+ catch(TypeLoadException)
+ {
+ Console.WriteLine("Gen6: PASS");
+ }
+
+ try
+ {
+ goGen7();
+ pass = false;
+ }
+ catch(TypeLoadException)
+ {
+ Console.WriteLine("Gen7: PASS");
+ }
+
+ if(pass)
+ {
+ Console.WriteLine("Test passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test failed");
+ return 101;
+ }
+ }
+}
diff --git a/tests/src/Loader/classloader/generics/Layout/Specific/Negative_ExplicitGen.csproj b/tests/src/Loader/classloader/generics/Layout/Specific/Negative_ExplicitGen.csproj
new file mode 100644
index 0000000000..163c328da8
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/Specific/Negative_ExplicitGen.csproj
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <AssemblyName>Negative_ExplicitGen</AssemblyName>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <OutputType>Exe</OutputType>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Include="Negative_ExplicitGen.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="project.json" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Loader/classloader/generics/Layout/Specific/Positive007.cs b/tests/src/Loader/classloader/generics/Layout/Specific/Positive007.cs
new file mode 100644
index 0000000000..b90dd4cb05
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/Specific/Positive007.cs
@@ -0,0 +1,99 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+
+
+[StructLayout(LayoutKind.Sequential, Pack=8)]
+public struct GenStruct<T>
+{
+ T t;
+
+ T Dummy(T t) { this.t = t; return t;}
+}
+
+[StructLayout(LayoutKind.Explicit, Pack=8)]
+public class NonGen
+{
+ [FieldOffset(0)]
+ GenStruct<object> genStruct;
+
+ [FieldOffset(0)]
+ object u;
+
+ GenStruct<object> Dummy(GenStruct<object> t) { this.genStruct = t; return t;}
+ object Dummy(object u) { this.u= u; return u;}
+}
+
+public class GenTest
+{
+ private NonGen InternalTest()
+ {
+ return new NonGen();
+ }
+
+ private void IndirectTest()
+ {
+ InternalTest();
+ }
+ public bool Test()
+ {
+ try
+ {
+ IndirectTest();
+ return true;
+ }
+
+ catch(Exception E)
+ {
+ Console.WriteLine("Test caught unexpected Exception " + E);
+ return false;
+ }
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+
+ Eval(new GenTest().Test());
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/src/Loader/classloader/generics/Layout/Specific/Positive007.csproj b/tests/src/Loader/classloader/generics/Layout/Specific/Positive007.csproj
new file mode 100644
index 0000000000..d24d7ae9f2
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/Specific/Positive007.csproj
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <AssemblyName>Positive007</AssemblyName>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <OutputType>Exe</OutputType>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Include="Positive007.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="project.json" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Loader/classloader/generics/Layout/Specific/Positive008.cs b/tests/src/Loader/classloader/generics/Layout/Specific/Positive008.cs
new file mode 100644
index 0000000000..b5d51a495f
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/Specific/Positive008.cs
@@ -0,0 +1,99 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+
+
+[StructLayout(LayoutKind.Sequential, Pack=8)]
+public struct GenStruct<T>
+{
+ T t;
+
+ T Dummy(T t) { this.t = t; return t;}
+}
+
+[StructLayout(LayoutKind.Explicit, Pack=8)]
+public struct NonGen
+{
+ [FieldOffset(0)]
+ GenStruct<object> genStruct;
+
+ [FieldOffset(0)]
+ object u;
+
+ GenStruct<object> Dummy(GenStruct<object> t) { this.genStruct = t; return t;}
+ object Dummy(object u) { this.u= u; return u;}
+}
+
+public class GenTest
+{
+ private NonGen InternalTest()
+ {
+ return new NonGen();
+ }
+
+ private void IndirectTest()
+ {
+ InternalTest();
+ }
+ public bool Test()
+ {
+ try
+ {
+ IndirectTest();
+ return true;
+ }
+
+ catch(Exception E)
+ {
+ Console.WriteLine("Test caught unexpected Exception " + E);
+ return false;
+ }
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+
+ Eval(new GenTest().Test());
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/src/Loader/classloader/generics/Layout/Specific/Positive008.csproj b/tests/src/Loader/classloader/generics/Layout/Specific/Positive008.csproj
new file mode 100644
index 0000000000..148cdf17ae
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/Specific/Positive008.csproj
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <AssemblyName>Positive008</AssemblyName>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <OutputType>Exe</OutputType>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Include="Positive008.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="project.json" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Loader/classloader/generics/Layout/Specific/Positive009.cs b/tests/src/Loader/classloader/generics/Layout/Specific/Positive009.cs
new file mode 100644
index 0000000000..211e8770cb
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/Specific/Positive009.cs
@@ -0,0 +1,99 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+
+
+[StructLayout(LayoutKind.Sequential, Pack=8)]
+public struct GenStruct<T>
+{
+ T t;
+
+ T Dummy(T t) { this.t = t; return t;}
+}
+
+[StructLayout(LayoutKind.Explicit, Pack=8)]
+public class NonGen
+{
+ [FieldOffset(0)]
+ GenStruct<int> genStruct;
+
+ [FieldOffset(0)]
+ int u;
+
+ GenStruct<int> Dummy(GenStruct<int> t) { this.genStruct = t; return t;}
+ int Dummy(int u) { this.u= u; return u;}
+}
+
+public class GenTest
+{
+ private NonGen InternalTest()
+ {
+ return new NonGen();
+ }
+
+ private void IndirectTest()
+ {
+ InternalTest();
+ }
+ public bool Test()
+ {
+ try
+ {
+ IndirectTest();
+ return true;
+ }
+
+ catch(Exception E)
+ {
+ Console.WriteLine("Test caught unexpected Exception " + E);
+ return false;
+ }
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+
+ Eval(new GenTest().Test());
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/src/Loader/classloader/generics/Layout/Specific/Positive009.csproj b/tests/src/Loader/classloader/generics/Layout/Specific/Positive009.csproj
new file mode 100644
index 0000000000..d4a47fd88a
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/Specific/Positive009.csproj
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <AssemblyName>Positive009</AssemblyName>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <OutputType>Exe</OutputType>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Include="Positive009.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="project.json" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Loader/classloader/generics/Layout/Specific/Positive010.cs b/tests/src/Loader/classloader/generics/Layout/Specific/Positive010.cs
new file mode 100644
index 0000000000..07b178655b
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/Specific/Positive010.cs
@@ -0,0 +1,99 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+
+
+[StructLayout(LayoutKind.Sequential, Pack=8)]
+public struct GenStruct<T>
+{
+ T t;
+
+ T Dummy(T t) { this.t = t; return t;}
+}
+
+[StructLayout(LayoutKind.Explicit, Pack=8)]
+public struct NonGen
+{
+ [FieldOffset(0)]
+ GenStruct<int> genStruct;
+
+ [FieldOffset(0)]
+ int u;
+
+ GenStruct<int> Dummy(GenStruct<int> t) { this.genStruct = t; return t;}
+ int Dummy(int u) { this.u= u; return u;}
+}
+
+public class GenTest
+{
+ private NonGen InternalTest()
+ {
+ return new NonGen();
+ }
+
+ private void IndirectTest()
+ {
+ InternalTest();
+ }
+ public bool Test()
+ {
+ try
+ {
+ IndirectTest();
+ return true;
+ }
+
+ catch(Exception E)
+ {
+ Console.WriteLine("Test caught unexpected Exception " + E);
+ return false;
+ }
+ }
+}
+
+public class Test
+{
+ public static int counter = 0;
+ public static bool result = true;
+ public static void Eval(bool exp)
+ {
+ counter++;
+ if (!exp)
+ {
+ result = exp;
+ Console.WriteLine("Test Failed at location: " + counter);
+ }
+
+ }
+
+ public static int Main()
+ {
+
+ Eval(new GenTest().Test());
+
+ if (result)
+ {
+ Console.WriteLine("Test Passed");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("Test Failed");
+ return 1;
+ }
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/src/Loader/classloader/generics/Layout/Specific/Positive010.csproj b/tests/src/Loader/classloader/generics/Layout/Specific/Positive010.csproj
new file mode 100644
index 0000000000..8909ae68fa
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/Specific/Positive010.csproj
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <AssemblyName>Positive010</AssemblyName>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <OutputType>Exe</OutputType>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Include="Positive010.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="project.json" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Loader/classloader/generics/Layout/Specific/app.config b/tests/src/Loader/classloader/generics/Layout/Specific/app.config
new file mode 100644
index 0000000000..e5622f77ad
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/Specific/app.config
@@ -0,0 +1,27 @@
+<?xml version = "1.0" encoding="utf-8"?>
+<configuration>
+ <runtime>
+ <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+ <dependentAssembly>
+ <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.20.0" newVersion="4.0.20.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Text.Encoding" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.IO" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Reflection" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+ </dependentAssembly>
+ </assemblyBinding>
+ </runtime>
+</configuration>
diff --git a/tests/src/Loader/classloader/generics/Layout/Specific/project.json b/tests/src/Loader/classloader/generics/Layout/Specific/project.json
new file mode 100644
index 0000000000..a2e84dc340
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Layout/Specific/project.json
@@ -0,0 +1,35 @@
+{
+ "dependencies": {
+ "Microsoft.NETCore.Platforms": "1.0.1-rc2-23816",
+ "System.Collections": "4.0.10",
+ "System.Collections.NonGeneric": "4.0.1-rc2-23816",
+ "System.Collections.Specialized": "4.0.1-rc2-23816",
+ "System.ComponentModel": "4.0.1-rc2-23816",
+ "System.Console": "4.0.0-rc2-23816",
+ "System.Diagnostics.Process": "4.1.0-rc2-23816",
+ "System.Globalization": "4.0.10",
+ "System.Globalization.Calendars": "4.0.0",
+ "System.IO": "4.0.10",
+ "System.IO.FileSystem": "4.0.0",
+ "System.IO.FileSystem.Primitives": "4.0.0",
+ "System.Linq": "4.0.1-rc2-23816",
+ "System.Linq.Queryable": "4.0.1-rc2-23816",
+ "System.Reflection": "4.0.10",
+ "System.Reflection.Primitives": "4.0.0",
+ "System.Runtime": "4.1.0-rc2-23816",
+ "System.Runtime.Extensions": "4.0.10",
+ "System.Runtime.Handles": "4.0.0",
+ "System.Runtime.InteropServices": "4.1.0-rc2-23816",
+ "System.Runtime.Loader": "4.0.0-rc2-23816",
+ "System.Text.Encoding": "4.0.10",
+ "System.Threading": "4.0.10",
+ "System.Threading.Thread": "4.0.0-rc2-23816",
+ "System.Xml.ReaderWriter": "4.0.11-rc2-23816",
+ "System.Xml.XDocument": "4.0.11-rc2-23816",
+ "System.Xml.XmlDocument": "4.0.1-rc2-23816",
+ "System.Xml.XmlSerializer": "4.0.11-rc2-23816"
+ },
+ "frameworks": {
+ "dnxcore50": {}
+ }
+}