summaryrefslogtreecommitdiff
path: root/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap
diff options
context:
space:
mode:
authorBryan Arant <bryanar@microsoft.com>2015-11-15 23:13:48 -0800
committerBryan Arant <bryanar@microsoft.com>2015-11-15 23:13:48 -0800
commitea94ba2bae3c3934b1158458dd45f0a93f6eb5dc (patch)
treeb24f38009bc546917db74e72c9384160ca431a96 /tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap
parentf8b864158f4e674791706feda765bb90c9003b22 (diff)
downloadcoreclr-ea94ba2bae3c3934b1158458dd45f0a93f6eb5dc.tar.gz
coreclr-ea94ba2bae3c3934b1158458dd45f0a93f6eb5dc.tar.bz2
coreclr-ea94ba2bae3c3934b1158458dd45f0a93f6eb5dc.zip
Porting loader tests from internal legacy tree.
Diffstat (limited to 'tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap')
-rw-r--r--tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/app.config27
-rw-r--r--tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case1.cs72
-rw-r--r--tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case1.csproj45
-rw-r--r--tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case11.cs85
-rw-r--r--tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case11.csproj45
-rw-r--r--tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case12.cs37
-rw-r--r--tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case12.csproj45
-rw-r--r--tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case14.cs74
-rw-r--r--tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case14.csproj45
-rw-r--r--tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case15.cs76
-rw-r--r--tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case15.csproj45
-rw-r--r--tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case2.cs56
-rw-r--r--tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case2.csproj45
-rw-r--r--tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case3.cs75
-rw-r--r--tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case3.csproj45
-rw-r--r--tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case4.cs74
-rw-r--r--tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case4.csproj45
-rw-r--r--tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case5.cs74
-rw-r--r--tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case5.csproj45
-rw-r--r--tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case6.cs75
-rw-r--r--tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case6.csproj45
-rw-r--r--tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case7.cs78
-rw-r--r--tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case7.csproj45
-rw-r--r--tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case8.cs79
-rw-r--r--tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case8.csproj45
-rw-r--r--tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case9.cs77
-rw-r--r--tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case9.csproj45
-rw-r--r--tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/project.json10
-rw-r--r--tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/project.lock.json612
29 files changed, 2166 insertions, 0 deletions
diff --git a/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/app.config b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/app.config
new file mode 100644
index 0000000000..62803f5972
--- /dev/null
+++ b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/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> \ No newline at end of file
diff --git a/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case1.cs b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case1.cs
new file mode 100644
index 0000000000..aacfbe63b6
--- /dev/null
+++ b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case1.cs
@@ -0,0 +1,72 @@
+// struct
+// int
+// struct
+// objref
+
+using System;
+using System.Runtime.InteropServices;
+
+public class Foo{
+ public int i=42;
+ public int getI(){return i;}
+}
+public class Bar{
+ private int i=1;
+ public int getI(){return i;}
+}
+
+public struct WrapFoo { public Foo o; }
+public struct WrapBar { public Bar o; }
+
+[ StructLayout( LayoutKind.Explicit )] public struct MyUnion1 {
+ [ FieldOffset( 0 )] public int i;
+ [ FieldOffset( 0 )] public WrapBar o;
+}
+
+[ StructLayout( LayoutKind.Explicit )] public struct MyUnion2 {
+ [ FieldOffset( 0 )] public int i;
+ [ FieldOffset( 0 )] public WrapFoo o;
+}
+
+public class Test{
+
+ public static int Main(string[] args){
+ bool caught=false;
+ try{
+ Go();
+ }
+ catch(TypeLoadException e){
+ caught=true;
+ Console.WriteLine(e);
+ }
+ if(caught){
+ Console.WriteLine("PASS: caught expected exception");
+ return 100;
+ }
+ else{
+ Console.WriteLine("FAIL: was allowed to overlap an objref with a scalar.");
+ return 101;
+ }
+ }
+ public static void Go(){
+ MyUnion2 u2;
+ MyUnion1 u1;
+
+ u1.i = 0;
+ u1.o.o = new Bar();
+
+ Console.WriteLine("BEFORE: u1.o.o.getI(): {0}. (EXPECT 1)",u1.o.o.getI());
+
+ u2.i = 0;
+ u2.o.o = new Foo();
+
+ // write the Foo's objref value now in u2.o into the int field of u1,
+ // thereby overwriting the Bar objref that had been in u1.o.
+ u1.i = u2.i;
+
+ // If u1.o.o.getI() returns 42, that means that we were able to write to a private
+ // member variable of Bar, a huge security problem!
+ int curI = u1.o.o.getI();
+ Console.WriteLine("AFTER: u1.o.o.getI(): {0}. (BUG if 42)",curI);
+ }
+}
diff --git a/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case1.csproj b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case1.csproj
new file mode 100644
index 0000000000..e81e448bcf
--- /dev/null
+++ b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case1.csproj
@@ -0,0 +1,45 @@
+<?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>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="case1.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" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case11.cs b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case11.cs
new file mode 100644
index 0000000000..22624b8a74
--- /dev/null
+++ b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case11.cs
@@ -0,0 +1,85 @@
+// here, the overlapping int only partial overlaps with an objref in the nested struct.
+//
+// struct
+// [1] int (partial overlap)
+// [4] struct
+// [0] int
+// [4] objref
+
+using System;
+using System.Runtime.InteropServices;
+
+public class Foo{
+ public int i=42;
+ public int getI(){return i;}
+}
+public class Bar{
+ private int i=1;
+ public int getI(){return i;}
+}
+
+[ StructLayout( LayoutKind.Explicit )]
+public struct WrapFoo {
+ [FieldOffset(1)] public int i; // partial overlap
+[FieldOffset(4)] public Foo o;
+}
+
+[ StructLayout( LayoutKind.Explicit )]
+public struct WrapBar {
+ [FieldOffset(1)] public int i; //partial overlap
+[FieldOffset(4)] public Bar o;
+}
+
+[ StructLayout( LayoutKind.Explicit )] public struct MyUnion1 {
+ [ FieldOffset( 0 )] public int i;
+ [ FieldOffset( 0 )] public WrapBar o;
+}
+
+[ StructLayout( LayoutKind.Explicit )] public struct MyUnion2 {
+ [ FieldOffset( 0 )] public int i;
+ [ FieldOffset( 0 )] public WrapFoo o;
+}
+
+public class Test{
+
+ public static int Main(string[] args){
+ bool caught=false;
+ try{
+ Go();
+ }
+ catch(TypeLoadException e){
+ caught=true;
+ Console.WriteLine(e);
+ }
+
+ if(caught){
+ Console.WriteLine("PASS: caught expected exception");
+ return 100;
+ }
+ else{
+ Console.WriteLine("FAIL: was allowed to overlap an objref with a scalar.");
+ return 101;
+ }
+ }
+ public static void Go(){
+ MyUnion2 u2;
+ MyUnion1 u1;
+
+ u1.i = 0;
+ u1.o.o = new Bar();
+
+ Console.WriteLine("BEFORE: u1.o.o.getI(): {0}. (EXPECT 1)",u1.o.o.getI());
+
+ u2.i = 0;
+ u2.o.o = new Foo();
+
+ // write the Foo's objref value now in u2.o into the int field of u1,
+ // thereby overwriting the Bar objref that had been in u1.o.
+ u1.i = u2.i;
+
+ // If u1.o.o.getI() returns 42, that means that we were able to write to a private
+ // member variable of Bar, a huge security problem!
+ int curI = u1.o.o.getI();
+ Console.WriteLine("AFTER: u1.o.o.getI(): {0}. (BUG if 42)",curI);
+ }
+}
diff --git a/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case11.csproj b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case11.csproj
new file mode 100644
index 0000000000..c1b2306c8a
--- /dev/null
+++ b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case11.csproj
@@ -0,0 +1,45 @@
+<?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>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="case11.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" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case12.cs b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case12.cs
new file mode 100644
index 0000000000..8d12dc4892
--- /dev/null
+++ b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case12.cs
@@ -0,0 +1,37 @@
+// super simple case. forget wrapper structs, just overlap an int and an objref!
+using System;
+using System.Runtime.InteropServices;
+
+[ StructLayout( LayoutKind.Explicit )] public struct MyUnion1 {
+ [ FieldOffset( 0 )] public int i;
+ [ FieldOffset( 0 )] public Object o;
+}
+
+public class Test{
+
+ public static int Main(string[] args){
+ bool caught=false;
+ try{
+ Go();
+ }
+ catch(TypeLoadException e){
+ caught=true;
+ Console.WriteLine(e);
+ }
+ if(caught){
+ Console.WriteLine("PASS: caught expected exception");
+ return 100;
+ }
+ else{
+ Console.WriteLine("FAIL: was allowed to overlap an objref with a scalar.");
+ return 101;
+ }
+ }
+ public static void Go(){
+ MyUnion1 u1;
+
+ u1.i = 0;
+ u1.o = new Object();
+ // that's enough. if we didn't throw a TypeLoadException, the test case will fail.
+ }
+}
diff --git a/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case12.csproj b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case12.csproj
new file mode 100644
index 0000000000..d5e625de4c
--- /dev/null
+++ b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case12.csproj
@@ -0,0 +1,45 @@
+<?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>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="case12.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" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case14.cs b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case14.cs
new file mode 100644
index 0000000000..c8411800f3
--- /dev/null
+++ b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case14.cs
@@ -0,0 +1,74 @@
+// struct
+// enum
+// struct
+// objref
+
+using System;
+using System.Runtime.InteropServices;
+
+public enum MyEnum {nil, alpha, beta};
+
+public class Foo{
+ public MyEnum i=MyEnum.alpha;
+ public MyEnum getI(){return i;}
+}
+public class Bar{
+ private MyEnum i=MyEnum.beta;
+ public MyEnum getI(){return i;}
+}
+
+public struct WrapFoo { public Foo o; }
+public struct WrapBar { public Bar o; }
+
+[ StructLayout( LayoutKind.Explicit )] public struct MyUnion1 {
+ [ FieldOffset( 0 )] public MyEnum i;
+ [ FieldOffset( 0 )] public WrapBar o;
+}
+
+[ StructLayout( LayoutKind.Explicit )] public struct MyUnion2 {
+ [ FieldOffset( 0 )] public MyEnum i;
+ [ FieldOffset( 0 )] public WrapFoo o;
+}
+
+public class Test{
+
+ public static int Main(string[] args){
+ bool caught=false;
+ try{
+ Go();
+ }
+ catch(TypeLoadException e){
+ caught=true;
+ Console.WriteLine(e);
+ }
+ if(caught){
+ Console.WriteLine("PASS: caught expected exception");
+ return 100;
+ }
+ else{
+ Console.WriteLine("FAIL: was allowed to overlap an objref with a scalar.");
+ return 101;
+ }
+ }
+ public static void Go(){
+ MyUnion2 u2;
+ MyUnion1 u1;
+
+ u1.i = MyEnum.nil;
+ u1.o.o = new Bar();
+
+ Console.WriteLine("BEFORE: u1.o.o.getI(): {0}. (EXPECT 1)",u1.o.o.getI());
+
+ u2.i = MyEnum.nil;
+ u2.o.o = new Foo();
+
+ // write the Foo's objref value now in u2.o into the int field of u1,
+ // thereby overwriting the Bar objref that had been in u1.o.
+ u1.i = u2.i;
+
+ // If u1.o.o.getI() returns 42, that means that we were able to write to a private
+ // member variable of Bar, a huge security problem!
+ MyEnum curI = u1.o.o.getI();
+ Console.WriteLine("AFTER: u1.o.o.getI(): {0}. (BUG if 42)",curI);
+ }
+}
diff --git a/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case14.csproj b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case14.csproj
new file mode 100644
index 0000000000..08289ac444
--- /dev/null
+++ b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case14.csproj
@@ -0,0 +1,45 @@
+<?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>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="case14.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" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case15.cs b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case15.cs
new file mode 100644
index 0000000000..e08c3ed462
--- /dev/null
+++ b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case15.cs
@@ -0,0 +1,76 @@
+// struct
+// int
+// struct
+// objref (delegate)
+
+using System;
+using System.Runtime.InteropServices;
+
+public class Foo{
+ public int i=42;
+ public int getI(){return i;}
+}
+public class Bar{
+ private int i=1;
+ public int getI(){return i;}
+}
+
+public delegate void FooDelegate(Object o);
+public delegate void BarDelegate(Object o);
+
+public struct WrapFoo { public FooDelegate o; }
+public struct WrapBar { public BarDelegate o; }
+
+[ StructLayout( LayoutKind.Explicit )] public struct MyUnion1 {
+ [ FieldOffset( 0 )] public int i;
+ [ FieldOffset( 0 )] public WrapBar o;
+}
+
+[ StructLayout( LayoutKind.Explicit )] public struct MyUnion2 {
+ [ FieldOffset( 0 )] public int i;
+ [ FieldOffset( 0 )] public WrapFoo o;
+}
+
+public class Test{
+
+ public static void MyCallback(Object o){
+ return;
+ }
+
+ public static int Main(string[] args){
+ bool caught=false;
+ try{
+ Go();
+ }
+ catch(TypeLoadException e){
+ caught=true;
+ Console.WriteLine(e);
+ }
+ if(caught){
+ Console.WriteLine("PASS: caught expected exception");
+ return 100;
+ }
+ else{
+ Console.WriteLine("FAIL: was allowed to overlap an objref with a scalar.");
+ return 101;
+ }
+ }
+ public static void Go(){
+ MyUnion2 u2;
+ MyUnion1 u1;
+
+ u1.i = 0;
+ u1.o.o = new BarDelegate(MyCallback);
+
+ u2.i = 0;
+ u2.o.o = new FooDelegate(MyCallback);
+
+ // write the Foo's objref value now in u2.o into the int field of u1,
+ // thereby overwriting the Bar objref that had been in u1.o.
+ u1.i = u2.i;
+
+ // Not doing further checks on delegate specific function calls. Unless the bug regresses,
+ // the test case should never reach this point. Even it does, the lack of TypeLoadException
+ // and the mere execution and returning of this method will indicate failure for the test.
+ }
+}
diff --git a/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case15.csproj b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case15.csproj
new file mode 100644
index 0000000000..7c300cf1bd
--- /dev/null
+++ b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case15.csproj
@@ -0,0 +1,45 @@
+<?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>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="case15.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" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case2.cs b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case2.cs
new file mode 100644
index 0000000000..5d7bad7ac5
--- /dev/null
+++ b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case2.cs
@@ -0,0 +1,56 @@
+// Same as case1, but exercises a different error path by going ahead and trying to use
+// the invalid type. That code path should never be reached, however, because the bug fix
+// is "fail-fast".
+
+// Before this bug was fixed, this test would result in a Fatal Execution Engine error.
+// Now, it should produce a TypeLoadException long before it gets to the point where
+// the Fatal Execution Engine error would have occurred.
+// mwilk 8/15/2003.
+
+using System;
+using System.Runtime.InteropServices;
+
+public struct Wrapper { public Object o; }
+
+[ StructLayout( LayoutKind.Explicit )] public struct MyUnion {
+ [ FieldOffset( 0 )] public int i;
+ [ FieldOffset( 0 )] public Wrapper o;
+}
+
+public class Test{
+
+ public static int Main(string[] args){
+ bool caught=false;
+ try{
+ Go();
+ }
+ catch(TypeLoadException e){
+ caught=true;
+ Console.WriteLine(e);
+ }
+ if(caught){
+ Console.WriteLine("PASS: caught expected exception");
+ return 100;
+ }
+ else{
+ Console.WriteLine("FAIL: was allowed to overlap an objref with a scalar.");
+ return 101;
+ }
+ }
+ public static void Go(){
+ MyUnion u;
+ u.i = 1;
+ u.o.o = null;
+
+ Console.WriteLine("u.i = {0}", u.i); // prints 0, showing the null assigned to the object ref overwrote the 1 assigned to the int.
+
+ u.o.o = new object();
+ Console.WriteLine("u.i = {0}", u.i); // prints some large number, now that the object instance has overwritten the int again
+
+ Console.WriteLine("u.o.o = {0}", u.o.o); // prints System.Object
+ u.i = 1000;
+ Console.WriteLine("u.i = {0}", u.i); // prints 1000 now that the int have overwritten 1000
+
+ Console.WriteLine("u.o.o = {0}", u.o.o); // bang! since the object is now invalid, having overwritten the start with 1000.
+ }
+}
diff --git a/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case2.csproj b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case2.csproj
new file mode 100644
index 0000000000..e1a418996d
--- /dev/null
+++ b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case2.csproj
@@ -0,0 +1,45 @@
+<?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>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="case2.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" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case3.cs b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case3.cs
new file mode 100644
index 0000000000..67f4b1b439
--- /dev/null
+++ b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case3.cs
@@ -0,0 +1,75 @@
+// struct
+// int
+// struct
+// struct
+// objref
+using System;
+using System.Runtime.InteropServices;
+
+public class Foo{
+ public int i=42;
+ public int getI(){return i;}
+}
+public class Bar{
+ private int i=1;
+ public int getI(){return i;}
+}
+
+public struct WrapFoo { public Foo o; }
+public struct WrapBar { public Bar o; }
+public struct WrapWrapFoo { public WrapFoo o; }
+public struct WrapWrapBar { public WrapBar o; }
+
+
+[ StructLayout( LayoutKind.Explicit )] public struct MyUnion1 {
+ [ FieldOffset( 0 )] public int i;
+ [ FieldOffset( 0 )] public WrapWrapBar o;
+}
+
+[ StructLayout( LayoutKind.Explicit )] public struct MyUnion2 {
+ [ FieldOffset( 0 )] public int i;
+ [ FieldOffset( 0 )] public WrapWrapFoo o;
+}
+
+public class Test{
+
+ public static int Main(string[] args){
+ bool caught=false;
+ try{
+ Go();
+ }
+ catch(TypeLoadException e){
+ caught=true;
+ Console.WriteLine(e);
+ }
+ if(caught){
+ Console.WriteLine("PASS: caught expected exception");
+ return 100;
+ }
+ else{
+ Console.WriteLine("FAIL: was allowed to overlap an objref with a scalar.");
+ return 101;
+ }
+ }
+ public static void Go(){
+ MyUnion1 u1;
+ MyUnion2 u2;
+
+ u1.i = 0;
+ u1.o.o.o = new Bar();
+
+ Console.WriteLine("BEFORE: u1.o.o.o.getI(): {0}. (EXPECT 1)",u1.o.o.o.getI());
+
+ u2.i = 0;
+ u2.o.o.o = new Foo();
+
+ // write the Foo's objref value now in u2.o into the int field of u1,
+ // thereby overwriting the Bar objref that had been in u1.o.
+ u1.i = u2.i;
+
+ // If u1.o.o.o.getI() returns 42, that means that we were able to write to a private
+ // member variable of Bar, a huge security problem!
+ int curI = u1.o.o.o.getI();
+ Console.WriteLine("AFTER: u1.o.o.o.getI(): {0}. (BUG if 42)",curI);
+ }
+}
diff --git a/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case3.csproj b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case3.csproj
new file mode 100644
index 0000000000..974443016b
--- /dev/null
+++ b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case3.csproj
@@ -0,0 +1,45 @@
+<?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>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="case3.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" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case4.cs b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case4.cs
new file mode 100644
index 0000000000..aaae087b52
--- /dev/null
+++ b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case4.cs
@@ -0,0 +1,74 @@
+// like case1, except that the union type is a class rather than a struct.
+//
+// class
+// int
+// struct
+// objref
+
+using System;
+using System.Runtime.InteropServices;
+
+public class Foo{
+ public int i=42;
+ public int getI(){return i;}
+}
+public class Bar{
+ private int i=1;
+ public int getI(){return i;}
+}
+
+public struct WrapFoo { public Foo o; }
+public struct WrapBar { public Bar o; }
+
+[ StructLayout( LayoutKind.Explicit )] public class MyUnion1 {
+ [ FieldOffset( 0 )] public int i;
+ [ FieldOffset( 0 )] public WrapBar o;
+}
+
+[ StructLayout( LayoutKind.Explicit )] public class MyUnion2 {
+ [ FieldOffset( 0 )] public int i;
+ [ FieldOffset( 0 )] public WrapFoo o;
+}
+
+public class Test{
+
+ public static int Main(string[] args){
+ bool caught=false;
+ try{
+ Go();
+ }
+ catch(TypeLoadException e){
+ caught=true;
+ Console.WriteLine(e);
+ }
+ if(caught){
+ Console.WriteLine("PASS: caught expected exception");
+ return 100;
+ }
+ else{
+ Console.WriteLine("FAIL: was allowed to overlap an objref with a scalar.");
+ return 101;
+ }
+ }
+ public static void Go(){
+ MyUnion2 u2 = new MyUnion2();
+ MyUnion1 u1 = new MyUnion1();
+
+ u1.i = 0;
+ u1.o.o = new Bar();
+
+ Console.WriteLine("BEFORE: u1.o.o.getI(): {0}. (EXPECT 1)",u1.o.o.getI());
+
+ u2.i = 0;
+ u2.o.o = new Foo();
+
+ // write the Foo's objref value now in u2.o into the int field of u1,
+ // thereby overwriting the Bar objref that had been in u1.o.
+ u1.i = u2.i;
+
+ // If u1.o.o.getI() returns 42, that means that we were able to write to a private
+ // member variable of Bar, a huge security problem!
+ int curI = u1.o.o.getI();
+ Console.WriteLine("AFTER: u1.o.o.getI(): {0}. (BUG if 42)",curI);
+ }
+}
diff --git a/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case4.csproj b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case4.csproj
new file mode 100644
index 0000000000..b4cfbb70cf
--- /dev/null
+++ b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case4.csproj
@@ -0,0 +1,45 @@
+<?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>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="case4.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" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case5.cs b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case5.cs
new file mode 100644
index 0000000000..33881e0cd0
--- /dev/null
+++ b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case5.cs
@@ -0,0 +1,74 @@
+// like case1, except that the order of the overlapping fields is
+// struct/int, instead of int/struct.
+// struct
+// struct
+// objref
+// int
+
+using System;
+using System.Runtime.InteropServices;
+
+public class Foo{
+ public int i=42;
+ public int getI(){return i;}
+}
+public class Bar{
+ private int i=1;
+ public int getI(){return i;}
+}
+
+public struct WrapFoo { public Foo o; }
+public struct WrapBar { public Bar o; }
+
+[ StructLayout( LayoutKind.Explicit )] public struct MyUnion1 {
+ [ FieldOffset( 0 )] public WrapBar o;
+ [ FieldOffset( 0 )] public int i;
+}
+
+[ StructLayout( LayoutKind.Explicit )] public struct MyUnion2 {
+ [ FieldOffset( 0 )] public WrapFoo o;
+ [ FieldOffset( 0 )] public int i;
+}
+
+public class Test{
+
+ public static int Main(string[] args){
+ bool caught=false;
+ try{
+ Go();
+ }
+ catch(TypeLoadException e){
+ caught=true;
+ Console.WriteLine(e);
+ }
+ if(caught){
+ Console.WriteLine("PASS: caught expected exception");
+ return 100;
+ }
+ else{
+ Console.WriteLine("FAIL: was allowed to overlap an objref with a scalar.");
+ return 101;
+ }
+ }
+ public static void Go(){
+ MyUnion2 u2;
+ MyUnion1 u1;
+
+ u1.i = 0;
+ u1.o.o = new Bar();
+
+ Console.WriteLine("BEFORE: u1.o.o.getI(): {0}. (EXPECT 1)",u1.o.o.getI());
+
+ u2.i = 0;
+ u2.o.o = new Foo();
+
+ // write the Foo's objref value now in u2.o into the int field of u1,
+ // thereby overwriting the Bar objref that had been in u1.o.
+ u1.i = u2.i;
+
+ // If u1.o.o.getI() returns 42, that means that we were able to write to a private
+ // member variable of Bar, a huge security problem!
+ int curI = u1.o.o.getI();
+ Console.WriteLine("AFTER: u1.o.o.getI(): {0}. (BUG if 42)",curI);
+ }
+}
diff --git a/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case5.csproj b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case5.csproj
new file mode 100644
index 0000000000..085e332216
--- /dev/null
+++ b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case5.csproj
@@ -0,0 +1,45 @@
+<?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>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="case5.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" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case6.cs b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case6.cs
new file mode 100644
index 0000000000..53580c5497
--- /dev/null
+++ b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case6.cs
@@ -0,0 +1,75 @@
+// like case4, except that the order of overlapping fields is reversed.
+// it is struct/int instead of int/struct.
+//
+// class
+// int
+// struct
+// objref
+
+using System;
+using System.Runtime.InteropServices;
+
+public class Foo{
+ public int i=42;
+ public int getI(){return i;}
+}
+public class Bar{
+ private int i=1;
+ public int getI(){return i;}
+}
+
+public struct WrapFoo { public Foo o; }
+public struct WrapBar { public Bar o; }
+
+[ StructLayout( LayoutKind.Explicit )] public class MyUnion1 {
+ [ FieldOffset( 0 )] public WrapBar o;
+ [ FieldOffset( 0 )] public int i;
+}
+
+[ StructLayout( LayoutKind.Explicit )] public class MyUnion2 {
+ [ FieldOffset( 0 )] public WrapFoo o;
+ [ FieldOffset( 0 )] public int i;
+}
+
+public class Test{
+
+ public static int Main(string[] args){
+ bool caught=false;
+ try{
+ Go();
+ }
+ catch(TypeLoadException e){
+ caught=true;
+ Console.WriteLine(e);
+ }
+ if(caught){
+ Console.WriteLine("PASS: caught expected exception");
+ return 100;
+ }
+ else{
+ Console.WriteLine("FAIL: was allowed to overlap an objref with a scalar.");
+ return 101;
+ }
+ }
+ public static void Go(){
+ MyUnion2 u2 = new MyUnion2();
+ MyUnion1 u1 = new MyUnion1();
+
+ u1.i = 0;
+ u1.o.o = new Bar();
+
+ Console.WriteLine("BEFORE: u1.o.o.getI(): {0}. (EXPECT 1)",u1.o.o.getI());
+
+ u2.i = 0;
+ u2.o.o = new Foo();
+
+ // write the Foo's objref value now in u2.o into the int field of u1,
+ // thereby overwriting the Bar objref that had been in u1.o.
+ u1.i = u2.i;
+
+ // If u1.o.o.getI() returns 42, that means that we were able to write to a private
+ // member variable of Bar, a huge security problem!
+ int curI = u1.o.o.getI();
+ Console.WriteLine("AFTER: u1.o.o.getI(): {0}. (BUG if 42)",curI);
+ }
+}
diff --git a/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case6.csproj b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case6.csproj
new file mode 100644
index 0000000000..321c2e3daf
--- /dev/null
+++ b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case6.csproj
@@ -0,0 +1,45 @@
+<?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>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="case6.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" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case7.cs b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case7.cs
new file mode 100644
index 0000000000..c465da451d
--- /dev/null
+++ b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case7.cs
@@ -0,0 +1,78 @@
+// like case1 except that we have multiple instances of structs
+// overlapping with the int.
+// struct
+// int
+// struct
+// objref
+// struct
+// objref
+
+using System;
+using System.Runtime.InteropServices;
+
+public class Foo{
+ public int i=42;
+ public int getI(){return i;}
+}
+public class Bar{
+ private int i=1;
+ public int getI(){return i;}
+}
+
+public struct WrapFoo { public Foo o; }
+public struct WrapBar { public Bar o; }
+
+[ StructLayout( LayoutKind.Explicit )] public struct MyUnion1 {
+ [ FieldOffset( 0 )] public int i;
+ [ FieldOffset( 0 )] public WrapBar o;
+ [ FieldOffset( 0 )] public WrapBar o2;
+}
+
+[ StructLayout( LayoutKind.Explicit )] public struct MyUnion2 {
+ [ FieldOffset( 0 )] public int i;
+ [ FieldOffset( 0 )] public WrapFoo o;
+ [ FieldOffset( 0 )] public WrapFoo o2;
+}
+
+public class Test{
+
+ public static int Main(string[] args){
+ bool caught=false;
+ try{
+ Go();
+ }
+ catch(TypeLoadException e){
+ caught=true;
+ Console.WriteLine(e);
+ }
+ if(caught){
+ Console.WriteLine("PASS: caught expected exception");
+ return 100;
+ }
+ else{
+ Console.WriteLine("FAIL: was allowed to overlap an objref with a scalar.");
+ return 101;
+ }
+ }
+ public static void Go(){
+ MyUnion2 u2;
+ MyUnion1 u1;
+
+ u1.i = 0;
+ u1.o.o = new Bar();
+
+ Console.WriteLine("BEFORE: u1.o.o.getI(): {0}. (EXPECT 1)",u1.o.o.getI());
+
+ u2.i = 0;
+ u2.o.o = new Foo();
+
+ // write the Foo's objref value now in u2.o into the int field of u1,
+ // thereby overwriting the Bar objref that had been in u1.o.
+ u1.i = u2.i;
+
+ // If u1.o.o.getI() returns 42, that means that we were able to write to a private
+ // member variable of Bar, a huge security problem!
+ int curI = u1.o.o.getI();
+ Console.WriteLine("AFTER: u1.o.o.getI(): {0}. (BUG if 42)",curI);
+ }
+}
diff --git a/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case7.csproj b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case7.csproj
new file mode 100644
index 0000000000..882f0afa3a
--- /dev/null
+++ b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case7.csproj
@@ -0,0 +1,45 @@
+<?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>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="case7.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" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case8.cs b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case8.cs
new file mode 100644
index 0000000000..90e6d3ece2
--- /dev/null
+++ b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case8.cs
@@ -0,0 +1,79 @@
+// like case4, except that there are multiple structs overlapping with the int.
+//
+// class
+// int
+// struct
+// objref
+// struct
+// objref
+
+
+using System;
+using System.Runtime.InteropServices;
+
+public class Foo{
+ public int i=42;
+ public int getI(){return i;}
+}
+public class Bar{
+ private int i=1;
+ public int getI(){return i;}
+}
+
+public struct WrapFoo { public Foo o; }
+public struct WrapBar { public Bar o; }
+
+[ StructLayout( LayoutKind.Explicit )] public class MyUnion1 {
+ [ FieldOffset( 0 )] public int i;
+ [ FieldOffset( 0 )] public WrapBar o;
+ [ FieldOffset( 0 )] public WrapBar o2;
+}
+
+[ StructLayout( LayoutKind.Explicit )] public class MyUnion2 {
+ [ FieldOffset( 0 )] public int i;
+ [ FieldOffset( 0 )] public WrapFoo o;
+ [ FieldOffset( 0 )] public WrapFoo o2;
+}
+
+public class Test{
+
+ public static int Main(string[] args){
+ bool caught=false;
+ try{
+ Go();
+ }
+ catch(TypeLoadException e){
+ caught=true;
+ Console.WriteLine(e);
+ }
+ if(caught){
+ Console.WriteLine("PASS: caught expected exception");
+ return 100;
+ }
+ else{
+ Console.WriteLine("FAIL: was allowed to overlap an objref with a scalar.");
+ return 101;
+ }
+ }
+ public static void Go(){
+ MyUnion2 u2 = new MyUnion2();
+ MyUnion1 u1 = new MyUnion1();
+
+ u1.i = 0;
+ u1.o.o = new Bar();
+
+ Console.WriteLine("BEFORE: u1.o.o.getI(): {0}. (EXPECT 1)",u1.o.o.getI());
+
+ u2.i = 0;
+ u2.o.o = new Foo();
+
+ // write the Foo's objref value now in u2.o into the int field of u1,
+ // thereby overwriting the Bar objref that had been in u1.o.
+ u1.i = u2.i;
+
+ // If u1.o.o.getI() returns 42, that means that we were able to write to a private
+ // member variable of Bar, a huge security problem!
+ int curI = u1.o.o.getI();
+ Console.WriteLine("AFTER: u1.o.o.getI(): {0}. (BUG if 42)",curI);
+ }
+}
diff --git a/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case8.csproj b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case8.csproj
new file mode 100644
index 0000000000..482b9dd250
--- /dev/null
+++ b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case8.csproj
@@ -0,0 +1,45 @@
+<?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>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="case8.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" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case9.cs b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case9.cs
new file mode 100644
index 0000000000..de93a315c3
--- /dev/null
+++ b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case9.cs
@@ -0,0 +1,77 @@
+// like case1, except that the overlapping doesn't occur in the first
+// "slot" of the union.
+// struct
+// [0] int
+// [4] int
+// [4] struct
+// objref
+
+using System;
+using System.Runtime.InteropServices;
+
+public class Foo{
+ public int i=42;
+ public int getI(){return i;}
+}
+public class Bar{
+ private int i=1;
+ public int getI(){return i;}
+}
+
+public struct WrapFoo { public Foo o; }
+public struct WrapBar { public Bar o; }
+
+[ StructLayout( LayoutKind.Explicit )] public struct MyUnion1 {
+ [ FieldOffset( 0 )] public int i2;
+ [ FieldOffset( 4 )] public int i;
+ [ FieldOffset( 4 )] public WrapBar o;
+}
+
+[ StructLayout( LayoutKind.Explicit )] public struct MyUnion2 {
+ [ FieldOffset( 0 )] public int i2;
+ [ FieldOffset( 4 )] public int i;
+ [ FieldOffset( 4 )] public WrapFoo o;
+}
+
+public class Test{
+
+ public static int Main(string[] args){
+ bool caught=false;
+ try{
+ Go();
+ }
+ catch(TypeLoadException e){
+ caught=true;
+ Console.WriteLine(e);
+ }
+ if(caught){
+ Console.WriteLine("PASS: caught expected exception");
+ return 100;
+ }
+ else{
+ Console.WriteLine("FAIL: was allowed to overlap an objref with a scalar.");
+ return 101;
+ }
+ }
+ public static void Go(){
+ MyUnion2 u2;
+ MyUnion1 u1;
+
+ u1.i = 0;
+ u1.o.o = new Bar();
+
+ Console.WriteLine("BEFORE: u1.o.o.getI(): {0}. (EXPECT 1)",u1.o.o.getI());
+
+ u2.i = 0;
+ u2.o.o = new Foo();
+
+ // write the Foo's objref value now in u2.o into the int field of u1,
+ // thereby overwriting the Bar objref that had been in u1.o.
+ u1.i = u2.i;
+
+ // If u1.o.o.getI() returns 42, that means that we were able to write to a private
+ // member variable of Bar, a huge security problem!
+ int curI = u1.o.o.getI();
+ Console.WriteLine("AFTER: u1.o.o.getI(): {0}. (BUG if 42)",curI);
+ }
+}
diff --git a/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case9.csproj b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case9.csproj
new file mode 100644
index 0000000000..3398341d2d
--- /dev/null
+++ b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/case9.csproj
@@ -0,0 +1,45 @@
+<?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>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <!-- Add Compile Object Here -->
+ <Compile Include="case9.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" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/project.json b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/project.json
new file mode 100644
index 0000000000..7fad5ffff3
--- /dev/null
+++ b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/project.json
@@ -0,0 +1,10 @@
+{
+ "dependencies": {
+ "System.Console": "4.0.0-beta-*",
+ "System.Runtime": "4.0.20-beta-*",
+ "System.Runtime.Extensions": "4.0.10-beta-*"
+ },
+ "frameworks": {
+ "dnxcore50": {}
+ }
+} \ No newline at end of file
diff --git a/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/project.lock.json b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/project.lock.json
new file mode 100644
index 0000000000..b2c00b900a
--- /dev/null
+++ b/tests/src/Loader/classloader/explicitlayout/objrefandnonobjrefoverlap/project.lock.json
@@ -0,0 +1,612 @@
+{
+ "locked": true,
+ "version": -9996,
+ "targets": {
+ "DNXCore,Version=v5.0": {
+ "System.Console/4.0.0-beta-23024": {
+ "dependencies": {
+ "System.Runtime": "4.0.20-beta-23024",
+ "System.Runtime.InteropServices": "4.0.20-beta-23024",
+ "System.Resources.ResourceManager": "4.0.0-beta-23024",
+ "System.IO.FileSystem.Primitives": "4.0.0-beta-23024",
+ "System.IO": "4.0.10-beta-23024",
+ "System.Threading.Tasks": "4.0.10-beta-23024",
+ "System.Text.Encoding": "4.0.10-beta-23024",
+ "System.Threading": "4.0.10-beta-23024",
+ "System.Text.Encoding.Extensions": "4.0.10-beta-23024"
+ },
+ "compile": {
+ "ref/dotnet/System.Console.dll": {}
+ },
+ "runtime": {
+ "lib/DNXCore50/System.Console.dll": {}
+ }
+ },
+ "System.Globalization/4.0.0-beta-23024": {
+ "dependencies": {
+ "System.Runtime": "4.0.0-beta-23024"
+ },
+ "compile": {
+ "ref/dotnet/System.Globalization.dll": {}
+ }
+ },
+ "System.IO/4.0.10-beta-23024": {
+ "dependencies": {
+ "System.Runtime": "4.0.20-beta-23024",
+ "System.Text.Encoding": "4.0.0-beta-23024",
+ "System.Threading.Tasks": "4.0.0-beta-23024"
+ },
+ "compile": {
+ "ref/dotnet/System.IO.dll": {}
+ },
+ "runtime": {
+ "lib/DNXCore50/System.IO.dll": {}
+ }
+ },
+ "System.IO.FileSystem.Primitives/4.0.0-beta-23024": {
+ "dependencies": {
+ "System.Runtime": "4.0.20-beta-23024"
+ },
+ "compile": {
+ "ref/dotnet/System.IO.FileSystem.Primitives.dll": {}
+ },
+ "runtime": {
+ "lib/dotnet/System.IO.FileSystem.Primitives.dll": {}
+ }
+ },
+ "System.Private.Uri/4.0.0-beta-23024": {
+ "runtime": {
+ "lib/DNXCore50/System.Private.Uri.dll": {}
+ }
+ },
+ "System.Reflection/4.0.0-beta-23024": {
+ "dependencies": {
+ "System.IO": "4.0.0-beta-23024",
+ "System.Reflection.Primitives": "4.0.0-beta-23024",
+ "System.Runtime": "4.0.0-beta-23024"
+ },
+ "compile": {
+ "ref/dotnet/System.Reflection.dll": {}
+ }
+ },
+ "System.Reflection.Primitives/4.0.0-beta-23024": {
+ "dependencies": {
+ "System.Runtime": "4.0.0-beta-23024"
+ },
+ "compile": {
+ "ref/dotnet/System.Reflection.Primitives.dll": {}
+ },
+ "runtime": {
+ "lib/DNXCore50/System.Reflection.Primitives.dll": {}
+ }
+ },
+ "System.Resources.ResourceManager/4.0.0-beta-23024": {
+ "dependencies": {
+ "System.Runtime": "4.0.0-beta-23024",
+ "System.Reflection": "4.0.0-beta-23024",
+ "System.Globalization": "4.0.0-beta-23024"
+ },
+ "compile": {
+ "ref/dotnet/System.Resources.ResourceManager.dll": {}
+ },
+ "runtime": {
+ "lib/DNXCore50/System.Resources.ResourceManager.dll": {}
+ }
+ },
+ "System.Runtime/4.0.20-beta-23024": {
+ "dependencies": {
+ "System.Private.Uri": "4.0.0-beta-23024"
+ },
+ "compile": {
+ "ref/dotnet/System.Runtime.dll": {}
+ },
+ "runtime": {
+ "lib/DNXCore50/System.Runtime.dll": {}
+ }
+ },
+ "System.Runtime.Extensions/4.0.10-beta-23024": {
+ "dependencies": {
+ "System.Runtime": "4.0.20-beta-23024"
+ },
+ "compile": {
+ "ref/dotnet/System.Runtime.Extensions.dll": {}
+ },
+ "runtime": {
+ "lib/DNXCore50/System.Runtime.Extensions.dll": {}
+ }
+ },
+ "System.Runtime.Handles/4.0.0-beta-23024": {
+ "dependencies": {
+ "System.Runtime": "4.0.0-beta-23024"
+ },
+ "compile": {
+ "ref/dotnet/System.Runtime.Handles.dll": {}
+ },
+ "runtime": {
+ "lib/DNXCore50/System.Runtime.Handles.dll": {}
+ }
+ },
+ "System.Runtime.InteropServices/4.0.20-beta-23024": {
+ "dependencies": {
+ "System.Runtime": "4.0.0-beta-23024",
+ "System.Reflection": "4.0.0-beta-23024",
+ "System.Reflection.Primitives": "4.0.0-beta-23024",
+ "System.Runtime.Handles": "4.0.0-beta-23024"
+ },
+ "compile": {
+ "ref/dotnet/System.Runtime.InteropServices.dll": {}
+ },
+ "runtime": {
+ "lib/DNXCore50/System.Runtime.InteropServices.dll": {}
+ }
+ },
+ "System.Text.Encoding/4.0.10-beta-23024": {
+ "dependencies": {
+ "System.Runtime": "4.0.0-beta-23024"
+ },
+ "compile": {
+ "ref/dotnet/System.Text.Encoding.dll": {}
+ },
+ "runtime": {
+ "lib/DNXCore50/System.Text.Encoding.dll": {}
+ }
+ },
+ "System.Text.Encoding.Extensions/4.0.10-beta-23024": {
+ "dependencies": {
+ "System.Runtime": "4.0.0-beta-23024",
+ "System.Text.Encoding": "4.0.10-beta-23024"
+ },
+ "compile": {
+ "ref/dotnet/System.Text.Encoding.Extensions.dll": {}
+ },
+ "runtime": {
+ "lib/DNXCore50/System.Text.Encoding.Extensions.dll": {}
+ }
+ },
+ "System.Threading/4.0.10-beta-23024": {
+ "dependencies": {
+ "System.Runtime": "4.0.0-beta-23024",
+ "System.Threading.Tasks": "4.0.0-beta-23024"
+ },
+ "compile": {
+ "ref/dotnet/System.Threading.dll": {}
+ },
+ "runtime": {
+ "lib/DNXCore50/System.Threading.dll": {}
+ }
+ },
+ "System.Threading.Tasks/4.0.10-beta-23024": {
+ "dependencies": {
+ "System.Runtime": "4.0.0-beta-23024"
+ },
+ "compile": {
+ "ref/dotnet/System.Threading.Tasks.dll": {}
+ },
+ "runtime": {
+ "lib/DNXCore50/System.Threading.Tasks.dll": {}
+ }
+ }
+ }
+ },
+ "libraries": {
+ "System.Console/4.0.0-beta-23024": {
+ "serviceable": true,
+ "sha512": "UZq1tgMJ/8TknBXBRVHDrLq4cK7f6m1pxyKbGwadmiapWowkNiB0J8wAFM30iWdiZDr8awzWLBigHxC4/8a8bQ==",
+ "files": [
+ "System.Console.4.0.0-beta-23024.nupkg",
+ "System.Console.4.0.0-beta-23024.nupkg.sha512",
+ "System.Console.nuspec",
+ "lib/DNXCore50/System.Console.dll",
+ "lib/net46/System.Console.dll",
+ "ref/dotnet/System.Console.dll",
+ "ref/dotnet/System.Console.xml",
+ "ref/dotnet/de/System.Console.xml",
+ "ref/dotnet/es/System.Console.xml",
+ "ref/dotnet/fr/System.Console.xml",
+ "ref/dotnet/it/System.Console.xml",
+ "ref/dotnet/ja/System.Console.xml",
+ "ref/dotnet/ko/System.Console.xml",
+ "ref/dotnet/ru/System.Console.xml",
+ "ref/dotnet/zh-hans/System.Console.xml",
+ "ref/dotnet/zh-hant/System.Console.xml",
+ "ref/net46/System.Console.dll"
+ ]
+ },
+ "System.Globalization/4.0.0-beta-23024": {
+ "sha512": "spLUZdsogiGRrw0J/WPrayNmvrKO9luR3SewdrW6Khw2Jc3K5dVTlF75d7oRHAQ7zELn37/Pvb66ASFuJg835g==",
+ "files": [
+ "License.rtf",
+ "System.Globalization.4.0.0-beta-23024.nupkg",
+ "System.Globalization.4.0.0-beta-23024.nupkg.sha512",
+ "System.Globalization.nuspec",
+ "lib/net45/_._",
+ "lib/win8/_._",
+ "ref/dotnet/System.Globalization.dll",
+ "ref/dotnet/System.Globalization.xml",
+ "ref/dotnet/de/System.Globalization.xml",
+ "ref/dotnet/es/System.Globalization.xml",
+ "ref/dotnet/fr/System.Globalization.xml",
+ "ref/dotnet/it/System.Globalization.xml",
+ "ref/dotnet/ja/System.Globalization.xml",
+ "ref/dotnet/ko/System.Globalization.xml",
+ "ref/dotnet/ru/System.Globalization.xml",
+ "ref/dotnet/zh-hans/System.Globalization.xml",
+ "ref/dotnet/zh-hant/System.Globalization.xml",
+ "ref/net45/_._",
+ "ref/netcore50/System.Globalization.dll",
+ "ref/netcore50/System.Globalization.xml",
+ "ref/netcore50/de/System.Globalization.xml",
+ "ref/netcore50/es/System.Globalization.xml",
+ "ref/netcore50/fr/System.Globalization.xml",
+ "ref/netcore50/it/System.Globalization.xml",
+ "ref/netcore50/ja/System.Globalization.xml",
+ "ref/netcore50/ko/System.Globalization.xml",
+ "ref/netcore50/ru/System.Globalization.xml",
+ "ref/netcore50/zh-hans/System.Globalization.xml",
+ "ref/netcore50/zh-hant/System.Globalization.xml",
+ "ref/win8/_._"
+ ]
+ },
+ "System.IO/4.0.10-beta-23024": {
+ "serviceable": true,
+ "sha512": "WSXeleSR+UFJqZQUhzkgcq/O4iyR+YTOIh0IXFXW6ABw+JfH56jb6AuQJwltzZXXtNbdz7Ha2A5OIeYIT6QRFw==",
+ "files": [
+ "System.IO.4.0.10-beta-23024.nupkg",
+ "System.IO.4.0.10-beta-23024.nupkg.sha512",
+ "System.IO.nuspec",
+ "lib/DNXCore50/System.IO.dll",
+ "lib/net46/_._",
+ "lib/netcore50/System.IO.dll",
+ "ref/dotnet/System.IO.dll",
+ "ref/dotnet/System.IO.xml",
+ "ref/dotnet/de/System.IO.xml",
+ "ref/dotnet/es/System.IO.xml",
+ "ref/dotnet/fr/System.IO.xml",
+ "ref/dotnet/it/System.IO.xml",
+ "ref/dotnet/ja/System.IO.xml",
+ "ref/dotnet/ko/System.IO.xml",
+ "ref/dotnet/ru/System.IO.xml",
+ "ref/dotnet/zh-hans/System.IO.xml",
+ "ref/dotnet/zh-hant/System.IO.xml",
+ "ref/net46/_._",
+ "runtimes/win8-aot/lib/netcore50/System.IO.dll"
+ ]
+ },
+ "System.IO.FileSystem.Primitives/4.0.0-beta-23024": {
+ "serviceable": true,
+ "sha512": "86WpDEexzC+lt1oFesANFdk3BQ2tP74YgPS4uVnlhEqr/XZG/H7qbEWP72Dve/x+xbJ7/ifayfitIpc9byUu7Q==",
+ "files": [
+ "System.IO.FileSystem.Primitives.4.0.0-beta-23024.nupkg",
+ "System.IO.FileSystem.Primitives.4.0.0-beta-23024.nupkg.sha512",
+ "System.IO.FileSystem.Primitives.nuspec",
+ "lib/dotnet/System.IO.FileSystem.Primitives.dll",
+ "lib/net46/System.IO.FileSystem.Primitives.dll",
+ "ref/dotnet/System.IO.FileSystem.Primitives.dll",
+ "ref/dotnet/System.IO.FileSystem.Primitives.xml",
+ "ref/dotnet/de/System.IO.FileSystem.Primitives.xml",
+ "ref/dotnet/es/System.IO.FileSystem.Primitives.xml",
+ "ref/dotnet/fr/System.IO.FileSystem.Primitives.xml",
+ "ref/dotnet/it/System.IO.FileSystem.Primitives.xml",
+ "ref/dotnet/ja/System.IO.FileSystem.Primitives.xml",
+ "ref/dotnet/ko/System.IO.FileSystem.Primitives.xml",
+ "ref/dotnet/ru/System.IO.FileSystem.Primitives.xml",
+ "ref/dotnet/zh-hans/System.IO.FileSystem.Primitives.xml",
+ "ref/dotnet/zh-hant/System.IO.FileSystem.Primitives.xml",
+ "ref/net46/System.IO.FileSystem.Primitives.dll"
+ ]
+ },
+ "System.Private.Uri/4.0.0-beta-23024": {
+ "serviceable": true,
+ "sha512": "SJbplxSAYqzECE4GzsXfkES5vug34KI34ERs2ySNAfuVcEbtto0YieQQqLQERzYINfbFVbOPbV4yN3VTzjW0DQ==",
+ "files": [
+ "System.Private.Uri.4.0.0-beta-23024.nupkg",
+ "System.Private.Uri.4.0.0-beta-23024.nupkg.sha512",
+ "System.Private.Uri.nuspec",
+ "lib/DNXCore50/System.Private.Uri.dll",
+ "lib/netcore50/System.Private.Uri.dll",
+ "ref/dnxcore50/_._",
+ "ref/netcore50/_._",
+ "runtimes/win8-aot/lib/netcore50/System.Private.Uri.dll"
+ ]
+ },
+ "System.Reflection/4.0.0-beta-23024": {
+ "sha512": "UmA+4UuB+4xIaP1ok9i+Jg2BV6rFKyX35puGZmnXQiaKFFEs9jMF0cInSrwAxbi1ggzuqoZ1gJo2mrmU+sMdkA==",
+ "files": [
+ "License.rtf",
+ "System.Reflection.4.0.0-beta-23024.nupkg",
+ "System.Reflection.4.0.0-beta-23024.nupkg.sha512",
+ "System.Reflection.nuspec",
+ "lib/net45/_._",
+ "lib/win8/_._",
+ "ref/dotnet/System.Reflection.dll",
+ "ref/dotnet/System.Reflection.xml",
+ "ref/dotnet/de/System.Reflection.xml",
+ "ref/dotnet/es/System.Reflection.xml",
+ "ref/dotnet/fr/System.Reflection.xml",
+ "ref/dotnet/it/System.Reflection.xml",
+ "ref/dotnet/ja/System.Reflection.xml",
+ "ref/dotnet/ko/System.Reflection.xml",
+ "ref/dotnet/ru/System.Reflection.xml",
+ "ref/dotnet/zh-hans/System.Reflection.xml",
+ "ref/dotnet/zh-hant/System.Reflection.xml",
+ "ref/net45/_._",
+ "ref/netcore50/System.Reflection.dll",
+ "ref/netcore50/System.Reflection.xml",
+ "ref/netcore50/de/System.Reflection.xml",
+ "ref/netcore50/es/System.Reflection.xml",
+ "ref/netcore50/fr/System.Reflection.xml",
+ "ref/netcore50/it/System.Reflection.xml",
+ "ref/netcore50/ja/System.Reflection.xml",
+ "ref/netcore50/ko/System.Reflection.xml",
+ "ref/netcore50/ru/System.Reflection.xml",
+ "ref/netcore50/zh-hans/System.Reflection.xml",
+ "ref/netcore50/zh-hant/System.Reflection.xml",
+ "ref/win8/_._"
+ ]
+ },
+ "System.Reflection.Primitives/4.0.0-beta-23024": {
+ "serviceable": true,
+ "sha512": "y2g5Rwm68Nnt3Ag+pAKLRwUifIKhm1gMy36bnU5rFrZhxg21hls93QH75HDZqXjK80leEr0BC1ajZZ+IcZvKCw==",
+ "files": [
+ "System.Reflection.Primitives.4.0.0-beta-23024.nupkg",
+ "System.Reflection.Primitives.4.0.0-beta-23024.nupkg.sha512",
+ "System.Reflection.Primitives.nuspec",
+ "lib/DNXCore50/System.Reflection.Primitives.dll",
+ "lib/net45/_._",
+ "lib/netcore50/System.Reflection.Primitives.dll",
+ "lib/win8/_._",
+ "ref/dotnet/System.Reflection.Primitives.dll",
+ "ref/dotnet/System.Reflection.Primitives.xml",
+ "ref/dotnet/de/System.Reflection.Primitives.xml",
+ "ref/dotnet/es/System.Reflection.Primitives.xml",
+ "ref/dotnet/fr/System.Reflection.Primitives.xml",
+ "ref/dotnet/it/System.Reflection.Primitives.xml",
+ "ref/dotnet/ja/System.Reflection.Primitives.xml",
+ "ref/dotnet/ko/System.Reflection.Primitives.xml",
+ "ref/dotnet/ru/System.Reflection.Primitives.xml",
+ "ref/dotnet/zh-hans/System.Reflection.Primitives.xml",
+ "ref/dotnet/zh-hant/System.Reflection.Primitives.xml",
+ "ref/net45/_._",
+ "ref/netcore50/System.Reflection.Primitives.dll",
+ "ref/netcore50/System.Reflection.Primitives.xml",
+ "ref/win8/_._",
+ "runtimes/win8-aot/lib/netcore50/System.Reflection.Primitives.dll"
+ ]
+ },
+ "System.Resources.ResourceManager/4.0.0-beta-23024": {
+ "serviceable": true,
+ "sha512": "xIiopNepii+eLPHo3lak0jmJK2EhQa/Su33Kjpin3t2/ZrFB2m8NoJF/LMV7wpsz2k7rr74RsG1+/m8pZprx+w==",
+ "files": [
+ "System.Resources.ResourceManager.4.0.0-beta-23024.nupkg",
+ "System.Resources.ResourceManager.4.0.0-beta-23024.nupkg.sha512",
+ "System.Resources.ResourceManager.nuspec",
+ "lib/DNXCore50/System.Resources.ResourceManager.dll",
+ "lib/net45/_._",
+ "lib/netcore50/System.Resources.ResourceManager.dll",
+ "lib/win8/_._",
+ "ref/dotnet/System.Resources.ResourceManager.dll",
+ "ref/dotnet/System.Resources.ResourceManager.xml",
+ "ref/dotnet/de/System.Resources.ResourceManager.xml",
+ "ref/dotnet/es/System.Resources.ResourceManager.xml",
+ "ref/dotnet/fr/System.Resources.ResourceManager.xml",
+ "ref/dotnet/it/System.Resources.ResourceManager.xml",
+ "ref/dotnet/ja/System.Resources.ResourceManager.xml",
+ "ref/dotnet/ko/System.Resources.ResourceManager.xml",
+ "ref/dotnet/ru/System.Resources.ResourceManager.xml",
+ "ref/dotnet/zh-hans/System.Resources.ResourceManager.xml",
+ "ref/dotnet/zh-hant/System.Resources.ResourceManager.xml",
+ "ref/net45/_._",
+ "ref/netcore50/System.Resources.ResourceManager.dll",
+ "ref/netcore50/System.Resources.ResourceManager.xml",
+ "ref/win8/_._",
+ "runtimes/win8-aot/lib/netcore50/System.Resources.ResourceManager.dll"
+ ]
+ },
+ "System.Runtime/4.0.20-beta-23024": {
+ "serviceable": true,
+ "sha512": "vacwPrf5OZcHwSL58Vdoq/vqqMrz1xbHXdZiSA5cHBCIVmo5bD9Gw+Qu4NgGekCxV3fgKs9Qq97oibezsZZ+8w==",
+ "files": [
+ "System.Runtime.4.0.20-beta-23024.nupkg",
+ "System.Runtime.4.0.20-beta-23024.nupkg.sha512",
+ "System.Runtime.nuspec",
+ "lib/DNXCore50/System.Runtime.dll",
+ "lib/net46/_._",
+ "lib/netcore50/System.Runtime.dll",
+ "ref/dotnet/System.Runtime.dll",
+ "ref/dotnet/System.Runtime.xml",
+ "ref/dotnet/de/System.Runtime.xml",
+ "ref/dotnet/es/System.Runtime.xml",
+ "ref/dotnet/fr/System.Runtime.xml",
+ "ref/dotnet/it/System.Runtime.xml",
+ "ref/dotnet/ja/System.Runtime.xml",
+ "ref/dotnet/ko/System.Runtime.xml",
+ "ref/dotnet/ru/System.Runtime.xml",
+ "ref/dotnet/zh-hans/System.Runtime.xml",
+ "ref/dotnet/zh-hant/System.Runtime.xml",
+ "ref/net46/_._",
+ "runtimes/win8-aot/lib/netcore50/System.Runtime.dll"
+ ]
+ },
+ "System.Runtime.Extensions/4.0.10-beta-23024": {
+ "serviceable": true,
+ "sha512": "Cj6RMtpMINFjTBHeClYAWk3SvDTdmo6c3rHIGwzn0R0P5B7wt0YclQibiZnjRzN/00XQ44067E6ZvRU/Z6AWgA==",
+ "files": [
+ "System.Runtime.Extensions.4.0.10-beta-23024.nupkg",
+ "System.Runtime.Extensions.4.0.10-beta-23024.nupkg.sha512",
+ "System.Runtime.Extensions.nuspec",
+ "lib/DNXCore50/System.Runtime.Extensions.dll",
+ "lib/net46/_._",
+ "lib/netcore50/System.Runtime.Extensions.dll",
+ "ref/dotnet/System.Runtime.Extensions.dll",
+ "ref/dotnet/System.Runtime.Extensions.xml",
+ "ref/dotnet/de/System.Runtime.Extensions.xml",
+ "ref/dotnet/es/System.Runtime.Extensions.xml",
+ "ref/dotnet/fr/System.Runtime.Extensions.xml",
+ "ref/dotnet/it/System.Runtime.Extensions.xml",
+ "ref/dotnet/ja/System.Runtime.Extensions.xml",
+ "ref/dotnet/ko/System.Runtime.Extensions.xml",
+ "ref/dotnet/ru/System.Runtime.Extensions.xml",
+ "ref/dotnet/zh-hans/System.Runtime.Extensions.xml",
+ "ref/dotnet/zh-hant/System.Runtime.Extensions.xml",
+ "ref/net46/_._",
+ "runtimes/win8-aot/lib/netcore50/System.Runtime.Extensions.dll"
+ ]
+ },
+ "System.Runtime.Handles/4.0.0-beta-23024": {
+ "serviceable": true,
+ "sha512": "O82TxLtp/afDkQixdjJutB7jdVlRx7vrQ+RPgL7iVLSREYE+HpuXpaKsW/3HqKm2G5D/FLmvYxZLiZitHfZ4Vw==",
+ "files": [
+ "System.Runtime.Handles.4.0.0-beta-23024.nupkg",
+ "System.Runtime.Handles.4.0.0-beta-23024.nupkg.sha512",
+ "System.Runtime.Handles.nuspec",
+ "lib/DNXCore50/System.Runtime.Handles.dll",
+ "lib/net46/_._",
+ "lib/netcore50/System.Runtime.Handles.dll",
+ "ref/dotnet/System.Runtime.Handles.dll",
+ "ref/dotnet/System.Runtime.Handles.xml",
+ "ref/dotnet/de/System.Runtime.Handles.xml",
+ "ref/dotnet/es/System.Runtime.Handles.xml",
+ "ref/dotnet/fr/System.Runtime.Handles.xml",
+ "ref/dotnet/it/System.Runtime.Handles.xml",
+ "ref/dotnet/ja/System.Runtime.Handles.xml",
+ "ref/dotnet/ko/System.Runtime.Handles.xml",
+ "ref/dotnet/ru/System.Runtime.Handles.xml",
+ "ref/dotnet/zh-hans/System.Runtime.Handles.xml",
+ "ref/dotnet/zh-hant/System.Runtime.Handles.xml",
+ "ref/net46/_._",
+ "runtimes/win8-aot/lib/netcore50/System.Runtime.Handles.dll"
+ ]
+ },
+ "System.Runtime.InteropServices/4.0.20-beta-23024": {
+ "serviceable": true,
+ "sha512": "004lCjqaK1zgrQ8d+on557Qny5Szp/l0W6PqB10vgs9pe+0BqfHNPui1eDnzmfhIkp6OW5t35Oqu5Lo3fROqCA==",
+ "files": [
+ "System.Runtime.InteropServices.4.0.20-beta-23024.nupkg",
+ "System.Runtime.InteropServices.4.0.20-beta-23024.nupkg.sha512",
+ "System.Runtime.InteropServices.nuspec",
+ "lib/DNXCore50/System.Runtime.InteropServices.dll",
+ "lib/net46/_._",
+ "lib/netcore50/System.Runtime.InteropServices.dll",
+ "ref/dotnet/System.Runtime.InteropServices.dll",
+ "ref/dotnet/System.Runtime.InteropServices.xml",
+ "ref/dotnet/de/System.Runtime.InteropServices.xml",
+ "ref/dotnet/es/System.Runtime.InteropServices.xml",
+ "ref/dotnet/fr/System.Runtime.InteropServices.xml",
+ "ref/dotnet/it/System.Runtime.InteropServices.xml",
+ "ref/dotnet/ja/System.Runtime.InteropServices.xml",
+ "ref/dotnet/ko/System.Runtime.InteropServices.xml",
+ "ref/dotnet/ru/System.Runtime.InteropServices.xml",
+ "ref/dotnet/zh-hans/System.Runtime.InteropServices.xml",
+ "ref/dotnet/zh-hant/System.Runtime.InteropServices.xml",
+ "ref/net46/_._",
+ "runtimes/win8-aot/lib/netcore50/System.Runtime.InteropServices.dll"
+ ]
+ },
+ "System.Text.Encoding/4.0.10-beta-23024": {
+ "sha512": "rNCH8+rj+jrlVbw91Xrj6NpT2bhcQn0D66oCzSDPmXhf6+udI74M8SBGLI2qz48lc8L4Mr5dEIifEq2p4D1P3w==",
+ "files": [
+ "System.Text.Encoding.4.0.10-beta-23024.nupkg",
+ "System.Text.Encoding.4.0.10-beta-23024.nupkg.sha512",
+ "System.Text.Encoding.nuspec",
+ "lib/DNXCore50/System.Text.Encoding.dll",
+ "lib/net46/_._",
+ "lib/netcore50/System.Text.Encoding.dll",
+ "ref/dotnet/System.Text.Encoding.dll",
+ "ref/dotnet/System.Text.Encoding.xml",
+ "ref/dotnet/de/System.Text.Encoding.xml",
+ "ref/dotnet/es/System.Text.Encoding.xml",
+ "ref/dotnet/fr/System.Text.Encoding.xml",
+ "ref/dotnet/it/System.Text.Encoding.xml",
+ "ref/dotnet/ja/System.Text.Encoding.xml",
+ "ref/dotnet/ko/System.Text.Encoding.xml",
+ "ref/dotnet/ru/System.Text.Encoding.xml",
+ "ref/dotnet/zh-hans/System.Text.Encoding.xml",
+ "ref/dotnet/zh-hant/System.Text.Encoding.xml",
+ "ref/net46/_._",
+ "runtimes/win8-aot/lib/netcore50/System.Text.Encoding.dll"
+ ]
+ },
+ "System.Text.Encoding.Extensions/4.0.10-beta-23024": {
+ "sha512": "Y8JU73DQZKSSY7sz4I8PFOz5/Cp3Te02deN1Qfx8ndIOg9/uFi55p/SeeeaowvF+/iUqENRerSy5KX5YPZxcOQ==",
+ "files": [
+ "System.Text.Encoding.Extensions.4.0.10-beta-23024.nupkg",
+ "System.Text.Encoding.Extensions.4.0.10-beta-23024.nupkg.sha512",
+ "System.Text.Encoding.Extensions.nuspec",
+ "lib/DNXCore50/System.Text.Encoding.Extensions.dll",
+ "lib/net46/_._",
+ "lib/netcore50/System.Text.Encoding.Extensions.dll",
+ "ref/dotnet/System.Text.Encoding.Extensions.dll",
+ "ref/dotnet/System.Text.Encoding.Extensions.xml",
+ "ref/dotnet/de/System.Text.Encoding.Extensions.xml",
+ "ref/dotnet/es/System.Text.Encoding.Extensions.xml",
+ "ref/dotnet/fr/System.Text.Encoding.Extensions.xml",
+ "ref/dotnet/it/System.Text.Encoding.Extensions.xml",
+ "ref/dotnet/ja/System.Text.Encoding.Extensions.xml",
+ "ref/dotnet/ko/System.Text.Encoding.Extensions.xml",
+ "ref/dotnet/ru/System.Text.Encoding.Extensions.xml",
+ "ref/dotnet/zh-hans/System.Text.Encoding.Extensions.xml",
+ "ref/dotnet/zh-hant/System.Text.Encoding.Extensions.xml",
+ "ref/net46/_._",
+ "runtimes/win8-aot/lib/netcore50/System.Text.Encoding.Extensions.dll"
+ ]
+ },
+ "System.Threading/4.0.10-beta-23024": {
+ "serviceable": true,
+ "sha512": "uoRg44bzPk9KE9Sg6rLZmGfUmFZBDc7y25692VYna/WW3Smip/aGX0ESXyuNvWA8k8oXdV4Z/M4ZKdB3ahtdDw==",
+ "files": [
+ "System.Threading.4.0.10-beta-23024.nupkg",
+ "System.Threading.4.0.10-beta-23024.nupkg.sha512",
+ "System.Threading.nuspec",
+ "lib/DNXCore50/System.Threading.dll",
+ "lib/net46/_._",
+ "lib/netcore50/System.Threading.dll",
+ "ref/dotnet/System.Threading.dll",
+ "ref/dotnet/System.Threading.xml",
+ "ref/dotnet/de/System.Threading.xml",
+ "ref/dotnet/es/System.Threading.xml",
+ "ref/dotnet/fr/System.Threading.xml",
+ "ref/dotnet/it/System.Threading.xml",
+ "ref/dotnet/ja/System.Threading.xml",
+ "ref/dotnet/ko/System.Threading.xml",
+ "ref/dotnet/ru/System.Threading.xml",
+ "ref/dotnet/zh-hans/System.Threading.xml",
+ "ref/dotnet/zh-hant/System.Threading.xml",
+ "ref/net46/_._",
+ "runtimes/win8-aot/lib/netcore50/System.Threading.dll"
+ ]
+ },
+ "System.Threading.Tasks/4.0.10-beta-23024": {
+ "serviceable": true,
+ "sha512": "QQaCcvp6FL14X2Hp3v+LoRoJKLWa0B6stwC5haZUfVICJnhgnOAPaeXcGc7R/x9TMN5+aGfxTgp+2cKgmOmrNQ==",
+ "files": [
+ "System.Threading.Tasks.4.0.10-beta-23024.nupkg",
+ "System.Threading.Tasks.4.0.10-beta-23024.nupkg.sha512",
+ "System.Threading.Tasks.nuspec",
+ "lib/DNXCore50/System.Threading.Tasks.dll",
+ "lib/net46/_._",
+ "lib/netcore50/System.Threading.Tasks.dll",
+ "ref/dotnet/System.Threading.Tasks.dll",
+ "ref/dotnet/System.Threading.Tasks.xml",
+ "ref/dotnet/de/System.Threading.Tasks.xml",
+ "ref/dotnet/es/System.Threading.Tasks.xml",
+ "ref/dotnet/fr/System.Threading.Tasks.xml",
+ "ref/dotnet/it/System.Threading.Tasks.xml",
+ "ref/dotnet/ja/System.Threading.Tasks.xml",
+ "ref/dotnet/ko/System.Threading.Tasks.xml",
+ "ref/dotnet/ru/System.Threading.Tasks.xml",
+ "ref/dotnet/zh-hans/System.Threading.Tasks.xml",
+ "ref/dotnet/zh-hant/System.Threading.Tasks.xml",
+ "ref/net46/_._",
+ "runtimes/win8-aot/lib/netcore50/System.Threading.Tasks.dll"
+ ]
+ }
+ },
+ "projectFileDependencyGroups": {
+ "": [
+ "System.Console >= 4.0.0-beta-*",
+ "System.Runtime >= 4.0.20-beta-*",
+ "System.Runtime.Extensions >= 4.0.10-beta-*"
+ ],
+ "DNXCore,Version=v5.0": []
+ }
+} \ No newline at end of file