Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corefx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/System.Runtime/System.Runtime.sln101
-rw-r--r--src/System.Runtime/pkg/System.Runtime.pkgproj2
-rw-r--r--src/System.Runtime/ref/System.Runtime.csproj1
-rw-r--r--src/System.Runtime/tests/Performance/System.Runtime.Performance.Tests.csproj2
-rw-r--r--src/System.Runtime/tests/System.Runtime.Tests.csproj24
-rw-r--r--src/System.Runtime/tests/System/Reflection/ModuleTests.cs318
-rw-r--r--src/System.Runtime/tests/System/Reflection/PointerTests.cs226
-rw-r--r--src/System.Runtime/tests/System/Reflection/RuntimeReflectionExtensionsTests.cs95
-rw-r--r--src/System.Runtime/tests/System/Reflection/TypeDelegatorTests.cs46
-rw-r--r--src/System.Runtime/tests/System/Reflection/TypeInfoTests.cs263
-rw-r--r--src/System.Runtime/tests/TestModule/System.Reflection.TestModule.dllbin0 -> 2048 bytes
-rw-r--r--src/System.Runtime/tests/TestModule/System.Reflection.TestModule.il32
-rw-r--r--src/System.Runtime/tests/TestModule/System.Reflection.TestModule.ilproj12
-rw-r--r--src/System.Runtime/tests/project.json7
14 files changed, 1074 insertions, 55 deletions
diff --git a/src/System.Runtime/System.Runtime.sln b/src/System.Runtime/System.Runtime.sln
index 08af6ed1fc..43a5cc12cf 100644
--- a/src/System.Runtime/System.Runtime.sln
+++ b/src/System.Runtime/System.Runtime.sln
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2013
-VisualStudioVersion = 12.0.21005.1
+# Visual Studio 14
+VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Runtime.Tests", "tests\System.Runtime.Tests.csproj", "{7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}"
EndProject
@@ -51,48 +51,54 @@ Global
Windows_Release|x86 = Windows_Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Debug|ARM.ActiveCfg = Debug|Any CPU
- {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Debug|x64.ActiveCfg = Debug|Any CPU
- {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Debug|x86.ActiveCfg = Debug|Any CPU
- {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Release|Any CPU.Build.0 = Release|Any CPU
- {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Release|ARM.ActiveCfg = Release|Any CPU
- {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Release|x64.ActiveCfg = Release|Any CPU
- {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Release|x86.ActiveCfg = Release|Any CPU
- {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Unix_Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Unix_Debug|Any CPU.Build.0 = Debug|Any CPU
- {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Unix_Debug|ARM.ActiveCfg = Debug|Any CPU
- {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Unix_Debug|ARM.Build.0 = Debug|Any CPU
- {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Unix_Debug|x64.ActiveCfg = Debug|Any CPU
- {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Unix_Debug|x64.Build.0 = Debug|Any CPU
- {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Unix_Debug|x86.ActiveCfg = Debug|Any CPU
- {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Unix_Debug|x86.Build.0 = Debug|Any CPU
- {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Unix_Release|Any CPU.ActiveCfg = Release|Any CPU
- {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Unix_Release|Any CPU.Build.0 = Release|Any CPU
- {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Unix_Release|ARM.ActiveCfg = Release|Any CPU
- {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Unix_Release|ARM.Build.0 = Release|Any CPU
- {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Unix_Release|x64.ActiveCfg = Release|Any CPU
- {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Unix_Release|x64.Build.0 = Release|Any CPU
- {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Unix_Release|x86.ActiveCfg = Release|Any CPU
- {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Unix_Release|x86.Build.0 = Release|Any CPU
- {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Windows_Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Windows_Debug|Any CPU.Build.0 = Debug|Any CPU
- {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Windows_Debug|ARM.ActiveCfg = Debug|Any CPU
- {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Windows_Debug|ARM.Build.0 = Debug|Any CPU
- {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Windows_Debug|x64.ActiveCfg = Debug|Any CPU
- {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Windows_Debug|x64.Build.0 = Debug|Any CPU
- {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Windows_Debug|x86.ActiveCfg = Debug|Any CPU
- {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Windows_Debug|x86.Build.0 = Debug|Any CPU
- {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Windows_Release|Any CPU.ActiveCfg = Release|Any CPU
- {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Windows_Release|Any CPU.Build.0 = Release|Any CPU
- {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Windows_Release|ARM.ActiveCfg = Release|Any CPU
- {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Windows_Release|ARM.Build.0 = Release|Any CPU
- {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Windows_Release|x64.ActiveCfg = Release|Any CPU
- {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Windows_Release|x64.Build.0 = Release|Any CPU
- {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Windows_Release|x86.ActiveCfg = Release|Any CPU
- {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Windows_Release|x86.Build.0 = Release|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Debug|Any CPU.ActiveCfg = netstandard1.7_Debug|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Debug|Any CPU.Build.0 = netstandard1.7_Debug|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Debug|ARM.ActiveCfg = netstandard1.5_Debug|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Debug|ARM.Build.0 = netstandard1.5_Debug|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Debug|x64.ActiveCfg = netstandard1.5_Debug|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Debug|x64.Build.0 = netstandard1.5_Debug|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Debug|x86.ActiveCfg = netstandard1.5_Debug|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Debug|x86.Build.0 = netstandard1.5_Debug|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Release|Any CPU.ActiveCfg = netstandard1.7_Release|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Release|Any CPU.Build.0 = netstandard1.7_Release|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Release|ARM.ActiveCfg = netstandard1.5_Release|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Release|ARM.Build.0 = netstandard1.5_Release|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Release|x64.ActiveCfg = netstandard1.5_Release|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Release|x64.Build.0 = netstandard1.5_Release|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Release|x86.ActiveCfg = netstandard1.5_Release|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Release|x86.Build.0 = netstandard1.5_Release|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Unix_Debug|Any CPU.ActiveCfg = netstandard1.5_Release|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Unix_Debug|Any CPU.Build.0 = netstandard1.5_Release|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Unix_Debug|ARM.ActiveCfg = netstandard1.5_Release|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Unix_Debug|ARM.Build.0 = netstandard1.5_Release|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Unix_Debug|x64.ActiveCfg = netstandard1.5_Release|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Unix_Debug|x64.Build.0 = netstandard1.5_Release|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Unix_Debug|x86.ActiveCfg = netstandard1.5_Release|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Unix_Debug|x86.Build.0 = netstandard1.5_Release|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Unix_Release|Any CPU.ActiveCfg = netstandard1.5_Release|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Unix_Release|Any CPU.Build.0 = netstandard1.5_Release|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Unix_Release|ARM.ActiveCfg = netstandard1.5_Release|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Unix_Release|ARM.Build.0 = netstandard1.5_Release|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Unix_Release|x64.ActiveCfg = netstandard1.5_Release|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Unix_Release|x64.Build.0 = netstandard1.5_Release|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Unix_Release|x86.ActiveCfg = netstandard1.5_Release|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Unix_Release|x86.Build.0 = netstandard1.5_Release|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Windows_Debug|Any CPU.ActiveCfg = netstandard1.5_Release|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Windows_Debug|Any CPU.Build.0 = netstandard1.5_Release|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Windows_Debug|ARM.ActiveCfg = netstandard1.5_Release|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Windows_Debug|ARM.Build.0 = netstandard1.5_Release|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Windows_Debug|x64.ActiveCfg = netstandard1.5_Release|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Windows_Debug|x64.Build.0 = netstandard1.5_Release|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Windows_Debug|x86.ActiveCfg = netstandard1.5_Release|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Windows_Debug|x86.Build.0 = netstandard1.5_Release|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Windows_Release|Any CPU.ActiveCfg = netstandard1.5_Release|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Windows_Release|Any CPU.Build.0 = netstandard1.5_Release|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Windows_Release|ARM.ActiveCfg = netstandard1.5_Release|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Windows_Release|ARM.Build.0 = netstandard1.5_Release|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Windows_Release|x64.ActiveCfg = netstandard1.5_Release|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Windows_Release|x64.Build.0 = netstandard1.5_Release|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Windows_Release|x86.ActiveCfg = netstandard1.5_Release|Any CPU
+ {7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.Windows_Release|x86.Build.0 = netstandard1.5_Release|Any CPU
{ADBCF120-3454-4A3C-9D1D-AC4293E795D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ADBCF120-3454-4A3C-9D1D-AC4293E795D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ADBCF120-3454-4A3C-9D1D-AC4293E795D6}.Debug|ARM.ActiveCfg = Debug|Any CPU
@@ -177,8 +183,8 @@ Global
{56B9D0A9-44D3-488E-8B42-C14A6E30CAB2}.Windows_Release|x64.Build.0 = Release|Any CPU
{56B9D0A9-44D3-488E-8B42-C14A6E30CAB2}.Windows_Release|x86.ActiveCfg = Release|Any CPU
{56B9D0A9-44D3-488E-8B42-C14A6E30CAB2}.Windows_Release|x86.Build.0 = Release|Any CPU
- {4AC5343E-6E31-4BA5-A795-0493AE7E9008}.Debug|Any CPU.ActiveCfg = Unix_netstandard13aot_Debug|Any CPU
- {4AC5343E-6E31-4BA5-A795-0493AE7E9008}.Debug|Any CPU.Build.0 = Unix_netstandard13aot_Debug|Any CPU
+ {4AC5343E-6E31-4BA5-A795-0493AE7E9008}.Debug|Any CPU.ActiveCfg = Windows_Debug|Any CPU
+ {4AC5343E-6E31-4BA5-A795-0493AE7E9008}.Debug|Any CPU.Build.0 = Windows_Debug|Any CPU
{4AC5343E-6E31-4BA5-A795-0493AE7E9008}.Debug|ARM.ActiveCfg = Unix_netstandard13aot_Debug|Any CPU
{4AC5343E-6E31-4BA5-A795-0493AE7E9008}.Debug|x64.ActiveCfg = Unix_netstandard13aot_Debug|Any CPU
{4AC5343E-6E31-4BA5-A795-0493AE7E9008}.Debug|x86.ActiveCfg = Unix_netstandard13aot_Debug|Any CPU
@@ -220,7 +226,6 @@ Global
{4AC5343E-6E31-4BA5-A795-0493AE7E9008}.Windows_Release|x86.ActiveCfg = Windows_Release|Any CPU
{4AC5343E-6E31-4BA5-A795-0493AE7E9008}.Windows_Release|x86.Build.0 = Windows_Release|Any CPU
{DA859552-898C-4098-BE42-063BD7EE5394}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {DA859552-898C-4098-BE42-063BD7EE5394}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DA859552-898C-4098-BE42-063BD7EE5394}.Debug|ARM.ActiveCfg = Debug|Any CPU
{DA859552-898C-4098-BE42-063BD7EE5394}.Debug|x64.ActiveCfg = Debug|Any CPU
{DA859552-898C-4098-BE42-063BD7EE5394}.Debug|x86.ActiveCfg = Debug|Any CPU
@@ -256,7 +261,7 @@ Global
GlobalSection(NestedProjects) = preSolution
{7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68} = {49386B8A-1FEC-4FFD-8565-E7372925961C}
{ADBCF120-3454-4A3C-9D1D-AC4293E795D6} = {CABF1020-B981-4D9C-AB79-409123D746CC}
- {4AC5343E-6E31-4BA5-A795-0493AE7E9008} = {91A9BE2D-F9A5-4C5C-8F12-C34F34967BA8}
{56B9D0A9-44D3-488E-8B42-C14A6E30CAB2} = {91A9BE2D-F9A5-4C5C-8F12-C34F34967BA8}
+ {4AC5343E-6E31-4BA5-A795-0493AE7E9008} = {91A9BE2D-F9A5-4C5C-8F12-C34F34967BA8}
EndGlobalSection
EndGlobal
diff --git a/src/System.Runtime/pkg/System.Runtime.pkgproj b/src/System.Runtime/pkg/System.Runtime.pkgproj
index 69152cbdb6..448a13f1a1 100644
--- a/src/System.Runtime/pkg/System.Runtime.pkgproj
+++ b/src/System.Runtime/pkg/System.Runtime.pkgproj
@@ -28,4 +28,4 @@
<InboxOnTargetFramework Include="xamarinwatchos10" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project> \ No newline at end of file
+</Project>
diff --git a/src/System.Runtime/ref/System.Runtime.csproj b/src/System.Runtime/ref/System.Runtime.csproj
index dd15c9aabd..4895f249ba 100644
--- a/src/System.Runtime/ref/System.Runtime.csproj
+++ b/src/System.Runtime/ref/System.Runtime.csproj
@@ -7,6 +7,7 @@
<IsCoreAssembly>true</IsCoreAssembly>
<NuGetTargetMoniker>.NETStandard,Version=v1.7</NuGetTargetMoniker>
<PackageTargetFramework Condition="'$(TargetGroup)'==''">netstandard1.7;uap10.1</PackageTargetFramework>
+ <ProjectGuid>{ADBCF120-3454-4A3C-9D1D-AC4293E795D6}</ProjectGuid>
</PropertyGroup>
<ItemGroup>
<Compile Include="System.Runtime.cs" />
diff --git a/src/System.Runtime/tests/Performance/System.Runtime.Performance.Tests.csproj b/src/System.Runtime/tests/Performance/System.Runtime.Performance.Tests.csproj
index fed20fbc0f..53cb8425a6 100644
--- a/src/System.Runtime/tests/Performance/System.Runtime.Performance.Tests.csproj
+++ b/src/System.Runtime/tests/Performance/System.Runtime.Performance.Tests.csproj
@@ -45,4 +45,4 @@
</ProjectReference>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project> \ No newline at end of file
+</Project>
diff --git a/src/System.Runtime/tests/System.Runtime.Tests.csproj b/src/System.Runtime/tests/System.Runtime.Tests.csproj
index 5d56a662ce..c2cedfdff2 100644
--- a/src/System.Runtime/tests/System.Runtime.Tests.csproj
+++ b/src/System.Runtime/tests/System.Runtime.Tests.csproj
@@ -13,9 +13,13 @@
<NugetTargetMoniker Condition="'$(NugetTargetMoniker)'==''">.NETStandard,Version=v1.5</NugetTargetMoniker>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'netstandard1.7_Debug|AnyCPU' ">
</PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'netstandard1.7_Release|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'netstandard1.5_Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'netstandard1.5_Release|AnyCPU' ">
</PropertyGroup>
<ItemGroup>
<Compile Include="$(CommonTestPath)\System\EnumTypes.cs" >
@@ -144,17 +148,29 @@
</EmbeddedResource>
<Compile Include="System\Threading\WaitHandleTests.netstandard1.7.cs" />
<Compile Include="Microsoft\Win32\SafeHandles\SafeHandleZeroOrMinusOneIsInvalid.netstandard1.7.cs" />
+ <Compile Include="System\Reflection\ModuleTests.cs" />
+ <Compile Include="System\Reflection\PointerTests.cs" />
+ <Compile Include="System\Reflection\RuntimeReflectionExtensionsTests.cs" />
+ <Compile Include="System\Reflection\TypeDelegatorTests.cs" />
+ <Compile Include="System\Reflection\TypeInfoTests.cs" />
+ <Compile Include="$(CommonTestPath)\System\Runtime\Serialization\Formatters\BinaryFormatterHelpers.cs">
+ <Link>System\Runtime\Serialization\Formatters\BinaryFormatterHelpers.cs</Link>
+ </Compile>
</ItemGroup>
<ItemGroup>
<None Include="project.json" />
</ItemGroup>
<ItemGroup>
+ <Reference Include="TestModule\System.Reflection.TestModule.dll">
+ </Reference>
<ProjectReference Include="..\pkg\System.Runtime.pkgproj">
- <Project>{1e689c1b-690c-4799-bde9-6e7990585894}</Project>
+ <Project>{ADBCF120-3454-4A3C-9D1D-AC4293E795D6}</Project>
<Name>System.Runtime</Name>
</ProjectReference>
<ProjectReference Include="..\..\System.Private.Uri\pkg\System.Private.Uri.pkgproj">
+ <Project>{4AC5343E-6E31-4BA5-A795-0493AE7E9008}</Project>
+ <Name>System.Private.Uri</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project> \ No newline at end of file
+</Project>
diff --git a/src/System.Runtime/tests/System/Reflection/ModuleTests.cs b/src/System.Runtime/tests/System/Reflection/ModuleTests.cs
new file mode 100644
index 0000000000..624707a9f2
--- /dev/null
+++ b/src/System.Runtime/tests/System/Reflection/ModuleTests.cs
@@ -0,0 +1,318 @@
+// 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.Collections.Generic;
+using System.Linq;
+using System.Runtime.Serialization.Formatters.Tests;
+using Xunit;
+using TestAttributes;
+
+[module: Foo]
+[module: Complicated(1, Stuff = 2)]
+
+namespace TestAttributes
+{
+ public class FooAttribute : Attribute
+ {
+ }
+
+ public class ComplicatedAttribute : Attribute
+ {
+ public int Stuff
+ {
+ get;
+ set;
+ }
+
+ public int Foo
+ {
+ get;
+ }
+
+ public ComplicatedAttribute(int foo)
+ {
+ Foo = foo;
+ }
+ }
+}
+
+namespace System.Reflection.Tests
+{
+ public class ModuleTests
+ {
+ public static Module Module => typeof(ModuleTests).Module;
+ public static Module TestModule => typeof(TestModule.Dummy).Module;
+
+ [Fact]
+ public void TestAssembly()
+ {
+ Assert.Equal(Assembly.GetExecutingAssembly(), Module.Assembly);
+ }
+
+ [Fact]
+ public void ModuleHandle()
+ {
+ Assert.Equal(typeof(PointerTests).Module.ModuleHandle, Module.ModuleHandle);
+ }
+
+ [Fact]
+ public void CustomAttributes()
+ {
+ List<CustomAttributeData> customAttributes = Module.CustomAttributes.ToList();
+ Assert.Equal(2, customAttributes.Count);
+ CustomAttributeData fooAttribute = customAttributes.Single(a => a.AttributeType == typeof(FooAttribute));
+ Assert.Equal(typeof(FooAttribute).GetConstructors().First(), fooAttribute.Constructor);
+ Assert.Equal(0, fooAttribute.ConstructorArguments.Count);
+ Assert.Equal(0, fooAttribute.NamedArguments.Count);
+ CustomAttributeData complicatedAttribute = customAttributes.Single(a => a.AttributeType == typeof(ComplicatedAttribute));
+ Assert.Equal(typeof(ComplicatedAttribute).GetConstructors().First(), complicatedAttribute.Constructor);
+ Assert.Equal(1, complicatedAttribute.ConstructorArguments.Count);
+ Assert.Equal(typeof(int), complicatedAttribute.ConstructorArguments[0].ArgumentType);
+ Assert.Equal(1, (int)complicatedAttribute.ConstructorArguments[0].Value);
+ Assert.Equal(1, complicatedAttribute.NamedArguments.Count);
+ Assert.Equal(false, complicatedAttribute.NamedArguments[0].IsField);
+ Assert.Equal("Stuff", complicatedAttribute.NamedArguments[0].MemberName);
+ Assert.Equal(typeof(ComplicatedAttribute).GetProperty("Stuff"), complicatedAttribute.NamedArguments[0].MemberInfo);
+ Assert.Equal(typeof(int), complicatedAttribute.NamedArguments[0].TypedValue.ArgumentType);
+ Assert.Equal(2, complicatedAttribute.NamedArguments[0].TypedValue.Value);
+ }
+
+ [Fact]
+ public void FullyQualifiedName()
+ {
+ Assert.Equal(Assembly.GetExecutingAssembly().Location, Module.FullyQualifiedName);
+ }
+
+ [Fact]
+ public void Name()
+ {
+ Assert.Equal("system.runtime.tests.dll", Module.Name, ignoreCase: true);
+ }
+
+ [Fact]
+ public void Equality()
+ {
+ Assert.True(Assembly.GetExecutingAssembly().GetModules().First() == Module);
+ Assert.True(Module.Equals(Assembly.GetExecutingAssembly().GetModules().First()));
+ }
+
+ [Fact]
+ public void TestGetHashCode()
+ {
+ Assert.Equal(Assembly.GetExecutingAssembly().GetModules().First().GetHashCode(), Module.GetHashCode());
+ }
+
+ [Theory]
+ [InlineData(typeof(ModuleTests))]
+ [InlineData(typeof(PointerTests))]
+ [InlineData(typeof(EventInfoTests))]
+ public void TestGetType(Type type)
+ {
+ Assert.Equal(type, Module.GetType(type.FullName, true, true));
+ }
+
+ [Fact]
+ public void TestToString()
+ {
+ Assert.Equal("System.Runtime.Tests.dll", Module.ToString());
+ }
+
+ [Fact]
+ public void IsDefined_NullType()
+ {
+ ArgumentNullException ex = Assert.Throws<ArgumentNullException>(() =>
+ {
+ Module.IsDefined(null, false);
+ });
+ Assert.Null(ex.InnerException);
+ Assert.NotNull(ex.Message);
+ Assert.Equal("attributeType", ex.ParamName);
+ }
+
+ [Fact]
+ public void GetField_NullName()
+ {
+ ArgumentNullException ex = Assert.Throws<ArgumentNullException>(() =>
+ {
+ Module.GetField(null);
+ });
+ Assert.Null(ex.InnerException);
+ Assert.NotNull(ex.Message);
+ Assert.Equal("name", ex.ParamName);
+
+ ex = Assert.Throws<ArgumentNullException>(() =>
+ {
+ Module.GetField(null, 0);
+ });
+ Assert.Null(ex.InnerException);
+ Assert.NotNull(ex.Message);
+ Assert.Equal("name", ex.ParamName);
+ }
+
+ [Fact]
+ public void GetField()
+ {
+ FieldInfo testInt = TestModule.GetField("TestInt", BindingFlags.Public | BindingFlags.Static);
+ Assert.Equal(1, (int)testInt.GetValue(null));
+ testInt.SetValue(null, 100);
+ Assert.Equal(100, (int)testInt.GetValue(null));
+ FieldInfo testLong = TestModule.GetField("TestLong", BindingFlags.NonPublic | BindingFlags.Static);
+ Assert.Equal(2L, (long)testLong.GetValue(null));
+ testLong.SetValue(null, 200);
+ Assert.Equal(200L, (long)testLong.GetValue(null));
+ }
+
+ [Fact]
+ public void GetFields()
+ {
+ List<FieldInfo> fields = TestModule.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static).OrderBy(f => f.Name).ToList();
+ Assert.Equal(2, fields.Count);
+ Assert.Equal(TestModule.GetField("TestInt"), fields[0]);
+ Assert.Equal(TestModule.GetField("TestLong", BindingFlags.NonPublic | BindingFlags.Static), fields[1]);
+ }
+
+ public static IEnumerable<object[]> Types =>
+ Module.GetTypes().Select(t => new object[] { t });
+
+ [Theory]
+ [MemberData(nameof(Types))]
+ public void ResolveType(Type t)
+ {
+ Assert.Equal(t, Module.ResolveType(t.MetadataToken));
+ }
+
+ public static IEnumerable<object[]> BadResolveTypes =>
+ new[]
+ {
+ new object[] { 1234 },
+ new object[] { typeof(ModuleTests).GetMethod("ResolveType").MetadataToken },
+ new object[] { typeof(ModuleTests).MetadataToken + 1000 },
+ };
+
+ [Theory]
+ [MemberData(nameof(BadResolveTypes))]
+ public void ResolveTypeFail(int token)
+ {
+ Assert.ThrowsAny<ArgumentException>(() =>
+ {
+ Module.ResolveType(token);
+ });
+ }
+
+ public static IEnumerable<object[]> Methods =>
+ Module.GetMethods().Select(m => new object[] { m });
+
+ [Theory]
+ [MemberData(nameof(Methods))]
+ public void ResolveMethod(MethodInfo t)
+ {
+ Assert.Equal(t, Module.ResolveMethod(t.MetadataToken));
+ }
+
+ public static IEnumerable<object[]> BadResolveMethods =>
+ new[]
+ {
+ new object[] { 1234 },
+ new object[] { typeof(ModuleTests).MetadataToken },
+ new object[] { typeof(ModuleTests).MetadataToken + 1000 },
+ };
+
+ [Theory]
+ [MemberData(nameof(BadResolveMethods))]
+ public void ResolveMethodFail(int token)
+ {
+ Assert.ThrowsAny<ArgumentException>(() =>
+ {
+ Module.ResolveMethod(token);
+ });
+ }
+
+ public static IEnumerable<object[]> Fields =>
+ Module.GetFields().Select(f => new object[] { f });
+
+ [Theory]
+ [MemberData(nameof(Fields))]
+ public void ResolveField(FieldInfo t)
+ {
+ Assert.Equal(t, Module.ResolveField(t.MetadataToken));
+ }
+
+ public static IEnumerable<object[]> BadResolveFields =>
+ new[]
+ {
+ new object[] { 1234 },
+ new object[] { typeof(ModuleTests).MetadataToken },
+ new object[] { typeof(ModuleTests).MetadataToken + 1000 },
+ };
+
+ [Theory]
+ [MemberData(nameof(BadResolveFields))]
+ public void ResolveFieldFail(int token)
+ {
+ Assert.ThrowsAny<ArgumentException>(() =>
+ {
+ Module.ResolveField(token);
+ });
+ }
+
+ public static IEnumerable<object[]> BadResolveStrings =>
+ new[]
+ {
+ new object[] { 1234 },
+ new object[] { typeof(ModuleTests).MetadataToken },
+ new object[] { typeof(ModuleTests).MetadataToken + 1000 },
+ };
+
+ [Theory]
+ [MemberData(nameof(BadResolveStrings))]
+ public void ResolveStringFail(int token)
+ {
+ Assert.ThrowsAny<ArgumentException>(() =>
+ {
+ Module.ResolveString(token);
+ });
+ }
+
+ [Theory]
+ [MemberData(nameof(Types))]
+ [MemberData(nameof(Methods))]
+ [MemberData(nameof(Fields))]
+ public void ResolveMember(MemberInfo member)
+ {
+ Assert.Equal(member, Module.ResolveMember(member.MetadataToken));
+ }
+
+ [Fact]
+ public void ResolveMethodOfGenericClass()
+ {
+ Type t = typeof(Foo<>);
+ Module mod = t.Module;
+ MethodInfo method = t.GetMethod("Bar");
+ MethodBase actual = mod.ResolveMethod(method.MetadataToken);
+ Assert.Equal(method, actual);
+ }
+
+ [Fact]
+ public void GetTypes()
+ {
+ List<Type> types = TestModule.GetTypes().ToList();
+ Assert.Equal(1, types.Count);
+ Assert.Equal("System.Reflection.TestModule.Dummy, System.Reflection.TestModule, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", types[0].AssemblyQualifiedName);
+ }
+
+ [Fact]
+ public void SerializeModule()
+ {
+ Assert.Equal(TestModule, BinaryFormatterHelpers.Clone(TestModule));
+ }
+ }
+
+ public class Foo<T>
+ {
+ public void Bar(T t)
+ {
+ }
+ }
+}
diff --git a/src/System.Runtime/tests/System/Reflection/PointerTests.cs b/src/System.Runtime/tests/System/Reflection/PointerTests.cs
new file mode 100644
index 0000000000..55a22b842f
--- /dev/null
+++ b/src/System.Runtime/tests/System/Reflection/PointerTests.cs
@@ -0,0 +1,226 @@
+// 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.Collections.Generic;
+using System.Runtime.Serialization.Formatters.Tests;
+using Xunit;
+
+namespace System.Reflection.Tests
+{
+ public unsafe class PointerHolder
+ {
+ public int* field;
+ public char* Property { get; set; }
+ public void Method(byte* ptr, int expected)
+ {
+ Assert.Equal(expected, (int)ptr);
+ }
+
+ public bool* Return(int expected)
+ {
+ return (bool*)expected;
+ }
+ }
+
+ public unsafe class PointerTests
+ {
+ [Fact]
+ public void Box_TypeNull()
+ {
+ ArgumentNullException ex = Assert.Throws<ArgumentNullException>(() =>
+ {
+ Pointer.Box((void*)0, null);
+ });
+ Assert.Equal("type", ex.ParamName);
+ }
+
+ [Fact]
+ public void Box_NonPointerType()
+ {
+ Assert.Throws<ArgumentException>(() =>
+ {
+ Pointer.Box((void*)0, typeof(int));
+ });
+ }
+
+ [Fact]
+ public void Unbox_Null()
+ {
+ Assert.Throws<ArgumentException>(() =>
+ {
+ Pointer.Unbox(null);
+ });
+ }
+
+ [Fact]
+ public void Unbox_NotPointer()
+ {
+ Assert.Throws<ArgumentException>(() =>
+ {
+ Pointer.Unbox(new object());
+ });
+ }
+
+ [Theory]
+ [MemberData(nameof(Pointers))]
+ public void PointerValueRoundtrips(int value)
+ {
+ void* ptr = (void*)value;
+ void* result = Pointer.Unbox(Pointer.Box(ptr, typeof(int*)));
+ Assert.Equal((IntPtr)ptr, (IntPtr)result);
+ }
+
+ public static IEnumerable<object[]> Pointers =>
+ new[]
+ {
+ new object[] { 0 },
+ new object[] { 1 },
+ new object[] { -1 },
+ new object[] { int.MaxValue },
+ new object[] { int.MinValue },
+ };
+
+ [Theory]
+ [MemberData(nameof(Pointers))]
+ public void PointerFieldSetValue(int value)
+ {
+ var obj = new PointerHolder();
+ FieldInfo field = typeof(PointerHolder).GetField("field");
+ field.SetValue(obj, Pointer.Box((void*)value, typeof(int*)));
+ Assert.Equal(value, (int)obj.field);
+ }
+
+ [Theory]
+ [MemberData(nameof(Pointers))]
+ public void IntPtrFieldSetValue(int value)
+ {
+ var obj = new PointerHolder();
+ FieldInfo field = typeof(PointerHolder).GetField("field");
+ field.SetValue(obj, (IntPtr)value);
+ Assert.Equal(value, (int)obj.field);
+ }
+
+ [Theory]
+ [MemberData(nameof(Pointers))]
+ public void PointerFieldSetValue_InvalidType(int value)
+ {
+ var obj = new PointerHolder();
+ FieldInfo field = typeof(PointerHolder).GetField("field");
+ Assert.Throws<ArgumentException>(() =>
+ {
+ field.SetValue(obj, Pointer.Box((void*)value, typeof(long*)));
+ });
+ }
+
+ [Theory]
+ [MemberData(nameof(Pointers))]
+ public void PointerFieldGetValue(int value)
+ {
+ var obj = new PointerHolder();
+ obj.field = (int*)value;
+ FieldInfo field = typeof(PointerHolder).GetField("field");
+ object actualValue = field.GetValue(obj);
+ Assert.IsType<Pointer>(actualValue);
+ void* actualPointer = Pointer.Unbox(actualValue);
+ Assert.Equal(value, (int)actualPointer);
+ }
+
+ [Theory]
+ [MemberData(nameof(Pointers))]
+ public void PointerPropertySetValue(int value)
+ {
+ var obj = new PointerHolder();
+ PropertyInfo property = typeof(PointerHolder).GetProperty("Property");
+ property.SetValue(obj, Pointer.Box((void*)value, typeof(char*)));
+ Assert.Equal(value, (int)obj.Property);
+ }
+
+ [Theory]
+ [MemberData(nameof(Pointers))]
+ public void IntPtrPropertySetValue(int value)
+ {
+ var obj = new PointerHolder();
+ PropertyInfo property = typeof(PointerHolder).GetProperty("Property");
+ property.SetValue(obj, (IntPtr)value);
+ Assert.Equal(value, (int)obj.Property);
+ }
+
+ [Theory]
+ [MemberData(nameof(Pointers))]
+ public void PointerPropertySetValue_InvalidType(int value)
+ {
+ var obj = new PointerHolder();
+ PropertyInfo property = typeof(PointerHolder).GetProperty("Property");
+ Assert.Throws<ArgumentException>(() =>
+ {
+ property.SetValue(obj, Pointer.Box((void*)value, typeof(long*)));
+ });
+ }
+
+ [Theory]
+ [MemberData(nameof(Pointers))]
+ public void PointerPropertyGetValue(int value)
+ {
+ var obj = new PointerHolder();
+ obj.Property = (char*)value;
+ PropertyInfo property = typeof(PointerHolder).GetProperty("Property");
+ object actualValue = property.GetValue(obj);
+ Assert.IsType<Pointer>(actualValue);
+ void* actualPointer = Pointer.Unbox(actualValue);
+ Assert.Equal(value, (int)actualPointer);
+ }
+
+ [Theory]
+ [MemberData(nameof(Pointers))]
+ public void PointerMethodParameter(int value)
+ {
+ var obj = new PointerHolder();
+ MethodInfo method = typeof(PointerHolder).GetMethod("Method");
+ method.Invoke(obj, new[] { Pointer.Box((void*)value, typeof(byte*)), value });
+ }
+
+ [Theory]
+ [MemberData(nameof(Pointers))]
+ public void IntPtrMethodParameter(int value)
+ {
+ var obj = new PointerHolder();
+ MethodInfo method = typeof(PointerHolder).GetMethod("Method");
+ method.Invoke(obj, new object[] { (IntPtr)value, value });
+ }
+
+ [Theory]
+ [MemberData(nameof(Pointers))]
+ public void PointerMethodParameter_InvalidType(int value)
+ {
+ var obj = new PointerHolder();
+ MethodInfo method = typeof(PointerHolder).GetMethod("Method");
+ Assert.Throws<ArgumentException>(() =>
+ {
+ method.Invoke(obj, new[] { Pointer.Box((void*)value, typeof(long*)), value });
+ });
+ }
+
+ [Theory]
+ [MemberData(nameof(Pointers))]
+ public void PointerMethodReturn(int value)
+ {
+ var obj = new PointerHolder();
+ MethodInfo method = typeof(PointerHolder).GetMethod("Return");
+ object actualValue = method.Invoke(obj, new object[] { value });
+ Assert.IsType<Pointer>(actualValue);
+ void* actualPointer = Pointer.Unbox(actualValue);
+ Assert.Equal(value, (int)actualPointer);
+ }
+
+ [Theory]
+ [MemberData(nameof(Pointers))]
+ [ActiveIssue(11980)]
+ public void PointerSerializes(int value)
+ {
+ object pointer = Pointer.Box((void*)value, typeof(int*));
+ Pointer cloned = BinaryFormatterHelpers.Clone((Pointer)pointer);
+ Assert.Equal((long)Pointer.Unbox(pointer), (long)Pointer.Unbox(cloned));
+ }
+ }
+} \ No newline at end of file
diff --git a/src/System.Runtime/tests/System/Reflection/RuntimeReflectionExtensionsTests.cs b/src/System.Runtime/tests/System/Reflection/RuntimeReflectionExtensionsTests.cs
new file mode 100644
index 0000000000..148768ad76
--- /dev/null
+++ b/src/System.Runtime/tests/System/Reflection/RuntimeReflectionExtensionsTests.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.Collections.Generic;
+using System.IO;
+using System.Linq;
+using Xunit;
+
+namespace System.Reflection.Tests
+{
+ public class RuntimeReflectionExtensionsTests
+ {
+ [Fact]
+ public void GetMethodInfo()
+ {
+ Assert.Equal(typeof(RuntimeReflectionExtensionsTests).GetMethod("GetMethodInfo"), ((Action)GetMethodInfo).GetMethodInfo());
+ }
+
+ [Fact]
+ public void GetRuntimeBaseDefinition()
+ {
+ Assert.Equal(typeof(Stream).GetMethod("Read"), typeof(MemoryStream).GetMethod("Read").GetRuntimeBaseDefinition());
+ }
+
+ [Fact]
+ public void GetRuntimeEvent()
+ {
+ Assert.Equal(typeof(TestType).GetEvent("StuffHappened"), typeof(TestType).GetRuntimeEvent("StuffHappened"));
+ }
+
+ [Fact]
+ public void GetRuntimeField()
+ {
+ Assert.Equal(typeof(TestType).GetField("_pizzaSize"), typeof(TestType).GetRuntimeField("_pizzaSize"));
+ }
+
+ [Fact]
+ public void GetRuntimeMethod()
+ {
+ Assert.Equal(typeof(TestType).GetMethod("Flush"), typeof(TestType).GetRuntimeMethod("Flush", Array.Empty<Type>()));
+ }
+
+ [Fact]
+ public void GetRuntimeProperty()
+ {
+ Assert.Equal(typeof(TestType).GetProperty("Length"), typeof(TestType).GetRuntimeProperty("Length"));
+ }
+
+ [Fact]
+ public void GetRuntimeEvents()
+ {
+ List<EventInfo> events = typeof(TestType).GetRuntimeEvents().ToList();
+ Assert.Equal(1, events.Count);
+ Assert.Equal("StuffHappened", events[0].Name);
+ }
+
+ [Fact]
+ public void GetRuntimeFields()
+ {
+ List<FieldInfo> fields = typeof(TestType).GetRuntimeFields().ToList();
+ Assert.Equal(2, fields.Count);
+ List<string> fieldNames = fields.Select(f => f.Name).ToList();
+ Assert.Contains("StuffHappened", fieldNames);
+ Assert.Contains("_pizzaSize", fieldNames);
+ }
+
+ [Fact]
+ public void GetRuntimeMethods()
+ {
+ List<MethodInfo> methods = typeof(TestType).GetRuntimeMethods().ToList();
+ List<string> methodNames = methods.Select(m => m.Name).Distinct().ToList();
+ Assert.Contains("remove_StuffHappened", methodNames);
+ Assert.Contains("add_StuffHappened", methodNames);
+ Assert.Contains("Equals", methodNames);
+ Assert.Contains("GetHashCode", methodNames);
+ Assert.Contains("ToString", methodNames);
+ Assert.Contains("get_CanRead", methodNames);
+ Assert.Contains("Read", methodNames);
+ }
+
+ [Fact]
+ public void GetRuntimeProperties()
+ {
+ List<PropertyInfo> properties = typeof(TestType).GetRuntimeProperties().ToList();
+ List<string> propertyNames = properties.Select(p => p.Name).Distinct().ToList();
+ Assert.Equal(5, properties.Count);
+ Assert.Contains("Length", propertyNames);
+ Assert.Contains("Position", propertyNames);
+ Assert.Contains("CanRead", propertyNames);
+ Assert.Contains("CanWrite", propertyNames);
+ Assert.Contains("CanSeek", propertyNames);
+ }
+ }
+} \ No newline at end of file
diff --git a/src/System.Runtime/tests/System/Reflection/TypeDelegatorTests.cs b/src/System.Runtime/tests/System/Reflection/TypeDelegatorTests.cs
new file mode 100644
index 0000000000..9ac27116e3
--- /dev/null
+++ b/src/System.Runtime/tests/System/Reflection/TypeDelegatorTests.cs
@@ -0,0 +1,46 @@
+// 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 Xunit;
+
+namespace System.Reflection.Tests
+{
+ public class TypeDelegatorTests
+ {
+ [Fact]
+ public void IsAssignableFrom()
+ {
+ TypeDelegator td = new TypeDelegator(typeof(int));
+
+ Assert.True(typeof(int).IsAssignableFrom(td));
+ Assert.False(typeof(string).IsAssignableFrom(td));
+ Assert.True(td.IsAssignableFrom(typeof(int)));
+ Assert.False(td.IsAssignableFrom(typeof(string)));
+ }
+
+ [Fact]
+ public void CreateInstance()
+ {
+ Assert.Equal(typeof(int[]), Array.CreateInstance(new TypeDelegator(typeof(int)), 100).GetType());
+ }
+
+ [Fact]
+ public void Properties()
+ {
+ Assert.False(new TypeDelegator(typeof(IComparable)).IsClass);
+ Assert.False(new TypeDelegator(typeof(IComparable)).IsValueType);
+ Assert.False(new TypeDelegator(typeof(IComparable)).IsEnum);
+ Assert.True(new TypeDelegator(typeof(IComparable)).IsInterface);
+
+ Assert.True(new TypeDelegator(typeof(TypeDelegatorTests)).IsClass);
+ Assert.False(new TypeDelegator(typeof(TypeDelegatorTests)).IsValueType);
+ Assert.False(new TypeDelegator(typeof(TypeDelegatorTests)).IsInterface);
+
+ Assert.False(new TypeDelegator(typeof(TypeCode)).IsClass);
+ Assert.False(new TypeDelegator(typeof(TypeCode)).IsInterface);
+ Assert.True(new TypeDelegator(typeof(TypeCode)).IsValueType);
+ Assert.True(new TypeDelegator(typeof(TypeCode)).IsEnum);
+ }
+ }
+}
diff --git a/src/System.Runtime/tests/System/Reflection/TypeInfoTests.cs b/src/System.Runtime/tests/System/Reflection/TypeInfoTests.cs
new file mode 100644
index 0000000000..ed3c620f59
--- /dev/null
+++ b/src/System.Runtime/tests/System/Reflection/TypeInfoTests.cs
@@ -0,0 +1,263 @@
+// 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.Collections;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace System.Reflection.Tests
+{
+ public abstract class TestTypeBase : IDisposable
+ {
+ public abstract bool CanRead { get; }
+ public abstract bool CanWrite { get; }
+ public abstract bool CanSeek { get; }
+ public abstract long Length { get; }
+ public abstract long Position { get; set; }
+
+ public virtual Task FlushAsync()
+ {
+ throw null;
+ }
+
+ public abstract void Flush();
+
+ public virtual Task<int> ReadAsync(byte[] buffer, int offset, int count)
+ {
+ throw null;
+ }
+
+ public abstract int Read(byte[] buffer, int offset, int count);
+
+ public abstract long Seek(long offset, SeekOrigin origin);
+
+ public abstract void SetLength(long value);
+
+ public abstract void Write(byte[] buffer, int offset, int count);
+ public virtual Task WriteAsync(byte[] buffer, int offset, int count)
+ {
+ throw null;
+ }
+
+ public void Dispose()
+ {
+ throw null;
+ }
+ }
+
+ public class TestType : TestTypeBase
+ {
+ public TestType()
+ {
+ }
+
+ public class Nested
+ {
+
+ }
+
+#pragma warning disable 0067 // event never used
+ public event Action<int> StuffHappened;
+#pragma warning restore 0067
+
+#pragma warning disable 0169 // field never used
+ private int _pizzaSize;
+#pragma warning restore 0169
+
+ public override bool CanRead => false;
+
+ public override bool CanSeek => false;
+
+ public override bool CanWrite => false;
+
+ public override long Length
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ public override long Position
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+
+ set
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ public override void Flush()
+ {
+ throw new NotImplementedException();
+ }
+
+ public override int Read(byte[] buffer, int offset, int count)
+ {
+ throw new NotImplementedException();
+ }
+
+ public override long Seek(long offset, SeekOrigin origin)
+ {
+ throw new NotImplementedException();
+ }
+
+ public override void SetLength(long value)
+ {
+ throw new NotImplementedException();
+ }
+
+ public override void Write(byte[] buffer, int offset, int count)
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ public class TypeInfoTests
+ {
+ public TypeInfo TestTypeInfo => typeof(TestType).GetTypeInfo();
+
+ [Fact]
+ public void DeclaredConstructors()
+ {
+ List<ConstructorInfo> ctors = TestTypeInfo.DeclaredConstructors.ToList();
+ Assert.Equal(1, ctors.Count);
+ Assert.True(ctors[0].IsSpecialName);
+ Assert.Equal(0, ctors[0].GetParameters().Count());
+ }
+
+ [Fact]
+ public void DeclaredEvents()
+ {
+ List<EventInfo> events = TestTypeInfo.DeclaredEvents.ToList();
+ Assert.Equal(1, events.Count);
+ Assert.Equal("StuffHappened", events[0].Name);
+ Assert.Equal("Action`1", events[0].EventHandlerType.Name);
+ }
+
+ [Fact]
+ public void GetDeclaredEvent()
+ {
+ Assert.Equal("StuffHappened", TestTypeInfo.GetDeclaredEvent("StuffHappened").Name);
+ }
+
+ [Fact]
+ public void DeclaredFields()
+ {
+ List<FieldInfo> fields = TestTypeInfo.DeclaredFields.ToList();
+ Assert.Equal(2, fields.Count);
+ FieldInfo stuffHappened = fields.Single(f => f.Name == "StuffHappened");
+ Assert.Equal(typeof(Action<int>), stuffHappened.FieldType);
+ Assert.True(stuffHappened.IsPrivate);
+ FieldInfo pizzaSize = fields.Single(f => f.Name == "_pizzaSize");
+ Assert.Equal(typeof(int), pizzaSize.FieldType);
+ Assert.True(pizzaSize.IsPrivate);
+ }
+
+ [Fact]
+ public void GetDeclaredField()
+ {
+ Assert.Equal("_pizzaSize", TestTypeInfo.GetDeclaredField("_pizzaSize").Name);
+ }
+
+ [Fact]
+ public void DeclaredMethods()
+ {
+ List<MethodInfo> methods = TestTypeInfo.DeclaredMethods.OrderBy(m => m.Name).ToList();
+ Assert.Equal(13, methods.Count);
+ List<string> methodNames = methods.Select(m => m.Name).ToList();
+ Assert.Contains("add_StuffHappened", methodNames);
+ Assert.Contains("Flush", methodNames);
+ Assert.Contains("get_CanRead", methodNames);
+ Assert.Contains("get_CanSeek", methodNames);
+ Assert.Contains("get_CanWrite", methodNames);
+ Assert.Contains("get_Length", methodNames);
+ Assert.Contains("get_Position", methodNames);
+ Assert.Contains("Read", methodNames);
+ Assert.Contains("remove_StuffHappened", methodNames);
+ Assert.Contains("Seek", methodNames);
+ Assert.Contains("set_Position", methodNames);
+ Assert.Contains("SetLength", methodNames);
+ Assert.Contains("Write", methodNames);
+ }
+
+ [Fact]
+ public void GetDeclaredMethod()
+ {
+ Assert.Equal("Flush", TestTypeInfo.GetDeclaredMethod("Flush").Name);
+ }
+
+ [Fact]
+ public void DeclaredNestedTypes()
+ {
+ List<TypeInfo> types = TestTypeInfo.DeclaredNestedTypes.ToList();
+ Assert.Equal(1, types.Count);
+ Assert.Equal("Nested", types[0].Name);
+ Assert.True(types[0].IsNestedPublic);
+ }
+
+ [Fact]
+ public void GetDeclaredNestedType()
+ {
+ Assert.Equal("Nested", TestTypeInfo.GetDeclaredNestedType("Nested").Name);
+ }
+
+ [Fact]
+ public void DeclaredProperties()
+ {
+ List<PropertyInfo> properties = TestTypeInfo.DeclaredProperties.OrderBy(p => p.Name).ToList();
+ Assert.Equal(5, properties.Count);
+ Assert.Equal("CanRead", properties[0].Name);
+ Assert.Equal("CanSeek", properties[1].Name);
+ Assert.Equal("CanWrite", properties[2].Name);
+ Assert.Equal("Length", properties[3].Name);
+ Assert.Equal("Position", properties[4].Name);
+ }
+
+ [Fact]
+ public void GetDeclaredProperty()
+ {
+ Assert.Equal("CanRead", TestTypeInfo.GetDeclaredProperty("CanRead").Name);
+ }
+
+ [Fact]
+ public void GenericTypeParameters()
+ {
+ Type[] parameters = TestTypeInfo.GenericTypeParameters;
+ Assert.Equal(0, parameters.Length);
+ }
+
+ [Fact]
+ public void ImplementedInterfaces()
+ {
+ List<Type> interfaces = TestTypeInfo.ImplementedInterfaces.OrderBy(t => t.Name).ToList();
+ Assert.Equal(1, interfaces.Count);
+ Assert.Equal(typeof(IDisposable), interfaces[0]);
+ }
+
+ [Fact]
+ public void AsType()
+ {
+ Type type = TestTypeInfo.AsType();
+ Assert.Equal(typeof(TestType), type);
+ }
+
+ [Theory]
+ [InlineData(typeof(IDisposable), typeof(Stream))]
+ [InlineData(typeof(IList), typeof(ArrayList))]
+ [InlineData(typeof(object), typeof(int))]
+ [InlineData(typeof(object), typeof(string))]
+ public void IsAssignableFrom(Type to, Type from)
+ {
+ Assert.True(to.GetTypeInfo().IsAssignableFrom(from));
+ }
+ }
+} \ No newline at end of file
diff --git a/src/System.Runtime/tests/TestModule/System.Reflection.TestModule.dll b/src/System.Runtime/tests/TestModule/System.Reflection.TestModule.dll
new file mode 100644
index 0000000000..510688e66e
--- /dev/null
+++ b/src/System.Runtime/tests/TestModule/System.Reflection.TestModule.dll
Binary files differ
diff --git a/src/System.Runtime/tests/TestModule/System.Reflection.TestModule.il b/src/System.Runtime/tests/TestModule/System.Reflection.TestModule.il
new file mode 100644
index 0000000000..4c9082dc54
--- /dev/null
+++ b/src/System.Runtime/tests/TestModule/System.Reflection.TestModule.il
@@ -0,0 +1,32 @@
+.assembly extern System.Runtime
+{
+ .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A)
+ .ver 4:0:0:0
+}
+
+.assembly System.Reflection.TestModule
+{
+ .ver 1:0:0:0
+}
+
+.module System.Reflection.TestModule.dll
+
+.field public static int32 TestInt
+
+.field private static int64 TestLong
+
+.method public static void .cctor()
+{
+ ldc.i4.1
+ stsfld int32 TestInt
+ ldc.i4.2
+ stsfld int64 TestLong
+ ret
+}
+
+.namespace System.Reflection.TestModule
+{
+ .class public Dummy extends [System.Runtime]System.Object
+ {
+ }
+}
diff --git a/src/System.Runtime/tests/TestModule/System.Reflection.TestModule.ilproj b/src/System.Runtime/tests/TestModule/System.Reflection.TestModule.ilproj
new file mode 100644
index 0000000000..0fff1390f4
--- /dev/null
+++ b/src/System.Runtime/tests/TestModule/System.Reflection.TestModule.ilproj
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>1.0.0.0</AssemblyVersion>
+ <NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="System.Reflection.TestModule.il" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/src/System.Runtime/tests/project.json b/src/System.Runtime/tests/project.json
index e00c655e9f..6f87550a40 100644
--- a/src/System.Runtime/tests/project.json
+++ b/src/System.Runtime/tests/project.json
@@ -10,6 +10,7 @@
"System.Reflection": "4.3.0-beta-24522-03",
"System.Reflection.Primitives": "4.3.0-beta-24522-03",
"System.Reflection.Emit": "4.3.0-beta-24522-03",
+ "System.Reflection.Extensions": "4.3.0-beta-24522-03",
"System.Runtime.Extensions": "4.3.0-beta-24522-03",
"System.Runtime.InteropServices": "4.3.0-beta-24522-03",
"System.Runtime.InteropServices.RuntimeInformation": "4.3.0-beta-24522-03",
@@ -27,7 +28,11 @@
},
"frameworks": {
"netstandard1.5": {},
- "netstandard1.7": {}
+ "netstandard1.7": {
+ "dependencies": {
+ "System.Runtime.Serialization.Formatters": "4.3.0-beta-24522-03"
+ }
+ }
},
"supports": {
"coreFx.Test.netcoreapp1.0": {},