diff options
Diffstat (limited to 'tests/src/Loader/classloader/nesting')
34 files changed, 1815 insertions, 52 deletions
diff --git a/tests/src/Loader/classloader/nesting/Regressions/dev10_602978/Library.cs b/tests/src/Loader/classloader/nesting/Regressions/dev10_602978/Library.cs new file mode 100644 index 0000000000..db1dd79fbb --- /dev/null +++ b/tests/src/Loader/classloader/nesting/Regressions/dev10_602978/Library.cs @@ -0,0 +1,9 @@ +// 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. + +public class RemoteBase_InSeparateAssembly +{ + protected interface IProtected_InSeparateAssembly { string Touch(); } + protected static string UseIProtected(IProtected_InSeparateAssembly intrf) { return intrf.Touch(); } +} diff --git a/tests/src/Loader/classloader/nesting/coreclr/VSW491577_1.csproj b/tests/src/Loader/classloader/nesting/Regressions/dev10_602978/Library.csproj index b488850aa9..fe8b032aae 100644 --- a/tests/src/Loader/classloader/nesting/coreclr/VSW491577_1.csproj +++ b/tests/src/Loader/classloader/nesting/Regressions/dev10_602978/Library.csproj @@ -1,43 +1,39 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> <PropertyGroup> + <AssemblyName>Library</AssemblyName> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> - <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> - <CLRTestKind>RunOnly</CLRTestKind> - <CLRTestPriority>1</CLRTestPriority> - <CLRTestProjectToRun>VSW491577.csproj</CLRTestProjectToRun> - </PropertyGroup> - <!-- Default configurations to help VS understand the configurations --> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib> + <OutputType>Library</OutputType> + <CLRTestKind>BuildOnly</CLRTestKind> + <CLRTestPriority>0</CLRTestPriority> </PropertyGroup> + <ItemGroup> <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> <Visible>False</Visible> </CodeAnalysisDependentAssemblyPaths> </ItemGroup> + <ItemGroup> - <!-- Add Compile Object Here --> + <Compile Include="Library.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 +</Project> diff --git a/tests/src/Loader/classloader/nesting/Regressions/dev10_602978/MainApp.cs b/tests/src/Loader/classloader/nesting/Regressions/dev10_602978/MainApp.cs new file mode 100644 index 0000000000..94ec1ba845 --- /dev/null +++ b/tests/src/Loader/classloader/nesting/Regressions/dev10_602978/MainApp.cs @@ -0,0 +1,68 @@ +// 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; + +public class RemoteBase +{ + protected interface IProtected { string Touch(); } + protected static string UseIProtected(IProtected intrf) { return intrf.Touch(); } +} + +class LocalImpl : RemoteBase +{ + protected class DirectImpl : IProtected + { + string IProtected.Touch() + { + return "IProtected.Touch"; + } + } + + public static string Touch() + { + return RemoteBase.UseIProtected(new DirectImpl()); + } +} + +class LocalImpl2 : RemoteBase_InSeparateAssembly +{ + protected class DirectImpl2 : IProtected_InSeparateAssembly + { + string IProtected_InSeparateAssembly.Touch() + { + return "IProtected_InSeparateAssembly.Touch"; + } + } + + public static string Touch() + { + return RemoteBase_InSeparateAssembly.UseIProtected(new DirectImpl2()); + } +} + +static class App +{ + + public static int Main() + { + string res = LocalImpl.Touch(); + if (res != "IProtected.Touch") + { + Console.WriteLine("Fail: Expected 'IProtected.Touch', got '" + res + "'"); + return -1; + } + + res = LocalImpl2.Touch(); + if (res != "IProtected_InSeparateAssembly.Touch") + { + Console.WriteLine("Fail: Expected 'IProtected_InSeparateAssembly.Touch', got '" + res + "'"); + return -1; + } + + Console.WriteLine("Pass"); + return 100; + } + +} diff --git a/tests/src/Loader/classloader/nesting/coreclr/VSW491577_2.csproj b/tests/src/Loader/classloader/nesting/Regressions/dev10_602978/MainApp.csproj index b488850aa9..7324d4fb14 100644 --- a/tests/src/Loader/classloader/nesting/coreclr/VSW491577_2.csproj +++ b/tests/src/Loader/classloader/nesting/Regressions/dev10_602978/MainApp.csproj @@ -1,43 +1,43 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> <PropertyGroup> + <AssemblyName>MainApp</AssemblyName> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> - <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> - <CLRTestKind>RunOnly</CLRTestKind> - <CLRTestPriority>1</CLRTestPriority> - <CLRTestProjectToRun>VSW491577.csproj</CLRTestProjectToRun> - </PropertyGroup> - <!-- Default configurations to help VS understand the configurations --> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib> + <OutputType>Exe</OutputType> + <CLRTestKind>BuildAndRun</CLRTestKind> + <CLRTestPriority>0</CLRTestPriority> </PropertyGroup> + <ItemGroup> <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> <Visible>False</Visible> </CodeAnalysisDependentAssemblyPaths> </ItemGroup> + <ItemGroup> - <!-- Add Compile Object Here --> + <Compile Include="MainApp.cs" /> </ItemGroup> + <ItemGroup> <None Include="app.config" /> <None Include="project.json" /> </ItemGroup> + + <ItemGroup> + <ProjectReference Include="Library.csproj" /> + </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 +</Project> diff --git a/tests/src/Loader/classloader/nesting/Regressions/dev10_602978/app.config b/tests/src/Loader/classloader/nesting/Regressions/dev10_602978/app.config new file mode 100644 index 0000000000..e5622f77ad --- /dev/null +++ b/tests/src/Loader/classloader/nesting/Regressions/dev10_602978/app.config @@ -0,0 +1,27 @@ +<?xml version = "1.0" encoding="utf-8"?> +<configuration> + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.20.0" newVersion="4.0.20.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Text.Encoding" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Reflection" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + </assemblyBinding> + </runtime> +</configuration> diff --git a/tests/src/Loader/classloader/nesting/Regressions/dev10_602978/project.json b/tests/src/Loader/classloader/nesting/Regressions/dev10_602978/project.json new file mode 100644 index 0000000000..a2e84dc340 --- /dev/null +++ b/tests/src/Loader/classloader/nesting/Regressions/dev10_602978/project.json @@ -0,0 +1,35 @@ +{ + "dependencies": { + "Microsoft.NETCore.Platforms": "1.0.1-rc2-23816", + "System.Collections": "4.0.10", + "System.Collections.NonGeneric": "4.0.1-rc2-23816", + "System.Collections.Specialized": "4.0.1-rc2-23816", + "System.ComponentModel": "4.0.1-rc2-23816", + "System.Console": "4.0.0-rc2-23816", + "System.Diagnostics.Process": "4.1.0-rc2-23816", + "System.Globalization": "4.0.10", + "System.Globalization.Calendars": "4.0.0", + "System.IO": "4.0.10", + "System.IO.FileSystem": "4.0.0", + "System.IO.FileSystem.Primitives": "4.0.0", + "System.Linq": "4.0.1-rc2-23816", + "System.Linq.Queryable": "4.0.1-rc2-23816", + "System.Reflection": "4.0.10", + "System.Reflection.Primitives": "4.0.0", + "System.Runtime": "4.1.0-rc2-23816", + "System.Runtime.Extensions": "4.0.10", + "System.Runtime.Handles": "4.0.0", + "System.Runtime.InteropServices": "4.1.0-rc2-23816", + "System.Runtime.Loader": "4.0.0-rc2-23816", + "System.Text.Encoding": "4.0.10", + "System.Threading": "4.0.10", + "System.Threading.Thread": "4.0.0-rc2-23816", + "System.Xml.ReaderWriter": "4.0.11-rc2-23816", + "System.Xml.XDocument": "4.0.11-rc2-23816", + "System.Xml.XmlDocument": "4.0.1-rc2-23816", + "System.Xml.XmlSerializer": "4.0.11-rc2-23816" + }, + "frameworks": { + "dnxcore50": {} + } +} diff --git a/tests/src/Loader/classloader/nesting/Tests/app.config b/tests/src/Loader/classloader/nesting/Tests/app.config new file mode 100644 index 0000000000..e5622f77ad --- /dev/null +++ b/tests/src/Loader/classloader/nesting/Tests/app.config @@ -0,0 +1,27 @@ +<?xml version = "1.0" encoding="utf-8"?> +<configuration> + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.20.0" newVersion="4.0.20.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Text.Encoding" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Reflection" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + </assemblyBinding> + </runtime> +</configuration> diff --git a/tests/src/Loader/classloader/nesting/Tests/nesting4.il b/tests/src/Loader/classloader/nesting/Tests/nesting4.il new file mode 100644 index 0000000000..a5ee7e9bf2 --- /dev/null +++ b/tests/src/Loader/classloader/nesting/Tests/nesting4.il @@ -0,0 +1,126 @@ +// 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. + +.assembly extern System.Console { } +// model revision #2 +// To compile: ilasm nesting4.il + +.assembly extern mscorlib {} +.assembly nesting4{} + +// Nesting module: PureManaged +// Nesting location: MainModule + +// enclosing type +// kind: Class +// flag: None +// visibility: private +// generics: Nongeneric +// depends on nested: InstanceField + +.class private EnclType +{ + // nested type + // kind: Interface + // flag: abstract + // visibility: public + // generics: Nongeneric + // depends on enclosing: StaticField + + .class interface abstract nested public NestedType + { + // nested depends on enclosing: StaticField + // nested member visibility: public + .field public static class EnclType sEnclType + } + + // enclosing depends on nested: InstanceField + // enclosing member visibility: famorassem + .field famorassem class EnclType/NestedType sNestClass + + // entry point location: EnclosingType + + .method public static int32 Main() + { + .entrypoint + .locals init (class [mscorlib]System.Exception V_0, + int32 V_1) + + .try + { + newobj instance void class Client::.ctor() + call instance void Client::method1() + ldstr "PASS" + call void [System.Console]System.Console::WriteLine(string) + ldc.i4.s 100 + stloc.1 + leave.s end + } + catch [mscorlib]System.Exception + { + stloc.0 + ldstr "{0}Caught unexpected exception." + ldloc.0 + call void [System.Console]System.Console::WriteLine(string,object) + ldstr "FAIL" + call void [System.Console]System.Console::WriteLine(string) + ldc.i4.s 101 + stloc.1 + leave.s end + } + end: ldloc.1 + ret + } + + .method public specialname instance void .ctor() cil managed + { + .maxstack 8 + ldarg.0 + call instance void [mscorlib]System.Object::.ctor() + ret + } +} + + +// Client module: PureManaged +// Client location: MainModule +// Client interaction: None + +.class public Client +{ + + .method public specialname instance void .ctor() cil managed + { + .maxstack 8 + ldarg.0 + call instance void [mscorlib]System.Object::.ctor() + ret + } + .method public instance void method1() + { + + // load enclosing and nested types + + newobj instance void class EnclType::.ctor() + stsfld class EnclType class EnclType/NestedType::sEnclType + ldsfld class EnclType class EnclType/NestedType::sEnclType + + // Helper1 implements EnclType/NestedType + + newobj instance void class Helper1::.ctor() + stfld class EnclType/NestedType class EnclType::sNestClass + ret + } +} + +.class public Helper1 implements EnclType/NestedType +{ + .method public specialname instance void .ctor() cil managed + { + ldarg.0 + call instance void [mscorlib]System.Object::.ctor() + ret + } + +} diff --git a/tests/src/Loader/classloader/nesting/Tests/nesting4.ilproj b/tests/src/Loader/classloader/nesting/Tests/nesting4.ilproj new file mode 100644 index 0000000000..d6245f6662 --- /dev/null +++ b/tests/src/Loader/classloader/nesting/Tests/nesting4.ilproj @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <AssemblyName>nesting4</AssemblyName> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + <ReferenceLocalMscorlib>true</ReferenceLocalMscorlib> + <OutputType>Exe</OutputType> + <CLRTestKind>BuildAndRun</CLRTestKind> + <CLRTestPriority>0</CLRTestPriority> + </PropertyGroup> + + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + + <ItemGroup> + <Compile Include="nesting4.il" /> + </ItemGroup> + + <ItemGroup> + <None Include="app.config" /> + </ItemGroup> + + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> +</Project> diff --git a/tests/src/Loader/classloader/nesting/Tests/nesting63.il b/tests/src/Loader/classloader/nesting/Tests/nesting63.il new file mode 100644 index 0000000000..a689fed08a --- /dev/null +++ b/tests/src/Loader/classloader/nesting/Tests/nesting63.il @@ -0,0 +1,145 @@ +// 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. + +.assembly extern System.Console { } +// model revision #2 +// To compile: ilasm nesting63.il + +.assembly extern mscorlib{} +.assembly nesting63{} + +// Nesting module: PureManaged +// Nesting location: MainModule + +// enclosing type +// kind: Class +// flag: None +// visibility: public +// generics: Nongeneric +// depends on nested: None + +.class public EnclType +{ + // nested type + // kind: Delegate + // flag: sealed + // visibility: assembly + // generics: Generic + // depends on enclosing: None + + .class sealed nested assembly NestedType<([mscorlib]System.Object) T> extends [mscorlib]System.MulticastDelegate + { + // nested member visibility: public + + .method public hidebysig specialname rtspecialname + instance void .ctor(object 'object', + native int 'method') runtime managed + {} + + .method public hidebysig newslot virtual + instance void Invoke(int32 i) runtime managed + {} + + .method public hidebysig newslot virtual + instance class [mscorlib]System.IAsyncResult + BeginInvoke(int32 i, + class [mscorlib]System.AsyncCallback callback, + object 'object') runtime managed + {} + + .method public hidebysig newslot virtual + instance void EndInvoke(class [mscorlib]System.IAsyncResult result) runtime managed + {} + + } + + // enclosing depends on nested: None + // enclosing member visibility: famorassem + // none + + // entry point location: EnclosingType + + .method public static int32 Main() + { + .entrypoint + .locals init (class [mscorlib]System.Exception V_0, + int32 V_1) + + .try + { + + newobj instance void class Client::.ctor() + call instance void class Client::method2() + + ldstr "PASS" + call void [System.Console]System.Console::WriteLine(string) + ldc.i4.s 100 + stloc.1 + leave.s end + } + catch [mscorlib]System.Exception + { + stloc.0 + ldstr "{0}Caught unexpected exception." + ldloc.0 + call void [System.Console]System.Console::WriteLine(string,object) + ldstr "FAIL" + call void [System.Console]System.Console::WriteLine(string) + ldc.i4.s 101 + stloc.1 + leave.s end + } + end: ldloc.1 + ret + } + + .method public hidebysig static void TakesADelegate(class EnclType/NestedType<int32> SomeFunction) cil managed + { + ldarg.0 + ldc.i4.s 21 + callvirt instance void class EnclType/NestedType<int32>::Invoke(int32) + ret + } + + .method public hidebysig static void DelegateFunction(int32 i) cil managed + { + ret + } + + .method public specialname instance void .ctor() cil managed + { + .maxstack 8 + ldarg.0 + call instance void [mscorlib]System.Object::.ctor() + ret + } + +} + + +// Client module: PureManaged +// Client location: MainModule +// Client interaction: ExtendsEncl + +.class public Client extends EnclType +{ + + .method public specialname instance void .ctor() cil managed + { + .maxstack 8 + ldarg.0 + call instance void EnclType::.ctor() + ret + } + + .method public hidebysig instance void method2() + { + ldarg.0 + ldftn void class EnclType::DelegateFunction(int32) + newobj instance void class EnclType/NestedType<int32>::.ctor(object, native int) + + call void class EnclType::TakesADelegate(class EnclType/NestedType<int32>) + ret + } +} diff --git a/tests/src/Loader/classloader/nesting/Tests/nesting63.ilproj b/tests/src/Loader/classloader/nesting/Tests/nesting63.ilproj new file mode 100644 index 0000000000..795567b349 --- /dev/null +++ b/tests/src/Loader/classloader/nesting/Tests/nesting63.ilproj @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <AssemblyName>nesting63</AssemblyName> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + <ReferenceLocalMscorlib>true</ReferenceLocalMscorlib> + <OutputType>Exe</OutputType> + <CLRTestKind>BuildAndRun</CLRTestKind> + <CLRTestPriority>0</CLRTestPriority> + </PropertyGroup> + + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + + <ItemGroup> + <Compile Include="nesting63.il" /> + </ItemGroup> + + <ItemGroup> + <None Include="app.config" /> + </ItemGroup> + + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> +</Project> diff --git a/tests/src/Loader/classloader/nesting/Tests/nesting7.il b/tests/src/Loader/classloader/nesting/Tests/nesting7.il new file mode 100644 index 0000000000..d162d24d67 --- /dev/null +++ b/tests/src/Loader/classloader/nesting/Tests/nesting7.il @@ -0,0 +1,139 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +.assembly extern System.Console { } +// model revision #2 +// To compile: ilasm nesting7.il /err + +.assembly nesting7{} + +// Nesting module: PureManaged +// Nesting location: MainModule + +// enclosing type +// kind: Interface +// flag: abstract +// visibility: private +// generics: Nongeneric +// depends on nested: StaticField + +.class interface abstract private EnclType +{ + // nested type + // kind: Delegate + // flag: sealed + // visibility: assembly + // generics: Nongeneric + // depends on enclosing: None + + .class sealed nested assembly NestedType extends [mscorlib]System.MulticastDelegate + { + + // nested member visibility: assembly + + .method assembly hidebysig specialname rtspecialname + instance void .ctor(object 'object', + native int 'method') runtime managed + {} + + .method assembly hidebysig newslot virtual + instance void Invoke(int32 i) runtime managed + {} + + .method assembly hidebysig newslot virtual + instance class [mscorlib]System.IAsyncResult + BeginInvoke(int32 i, + class [mscorlib]System.AsyncCallback callback, + object 'object') runtime managed + {} + + .method assembly hidebysig newslot virtual + instance void EndInvoke(class [mscorlib]System.IAsyncResult result) runtime managed + {} + } + + // enclosing depends on nested: StaticField + // enclosing member visibility: assembly + .field assembly static class EnclType/NestedType sNestClass + + .method public hidebysig static void TakesADelegate(class EnclType/NestedType SomeFunction) cil managed + { + ldarg.0 + ldc.i4.s 21 + callvirt instance void EnclType/NestedType::Invoke(int32) + ret + } + + .method public hidebysig static void DelegateFunction(int32 i) cil managed + { + ret + } + +} + + +// Client module: PureManaged +// Client location: MainModule +// Client interaction: ImplementsEncl + +.class public Client implements EnclType +{ + + .method public specialname instance void .ctor() cil managed + { + .maxstack 8 + ldarg.0 + call instance void [mscorlib]System.Object::.ctor() + ret + } + + .method public hidebysig instance void method2() + { + // create the delegate which is a static field of EnclType + ldarg.0 + ldftn void class EnclType::DelegateFunction(int32) + newobj instance void class EnclType/NestedType::.ctor(object, native int) + + stsfld class EnclType/NestedType class EnclType::sNestClass + ldsfld class EnclType/NestedType class EnclType::sNestClass + call void class EnclType::TakesADelegate(class EnclType/NestedType) + ret + } + +} + +// entry point location: GlobalManaged + +.method public static int32 Main() +{ + .entrypoint + .locals init (class [mscorlib]System.Exception V_0, + int32 V_1) + + .try + { + newobj instance void class Client::.ctor() + call instance void class Client::method2() + + ldstr "PASS" + call void [System.Console]System.Console::WriteLine(string) + ldc.i4.s 100 + stloc.1 + leave.s end + } + catch [mscorlib]System.Exception + { + stloc.0 + ldstr "{0}Caught unexpected exception." + ldloc.0 + call void [System.Console]System.Console::WriteLine(string,object) + ldstr "FAIL" + call void [System.Console]System.Console::WriteLine(string) + ldc.i4.s 101 + stloc.1 + leave.s end + } + end: ldloc.1 + ret +} diff --git a/tests/src/Loader/classloader/nesting/Tests/nesting7.ilproj b/tests/src/Loader/classloader/nesting/Tests/nesting7.ilproj new file mode 100644 index 0000000000..e75d197d94 --- /dev/null +++ b/tests/src/Loader/classloader/nesting/Tests/nesting7.ilproj @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <AssemblyName>nesting7</AssemblyName> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + <ReferenceLocalMscorlib>true</ReferenceLocalMscorlib> + <OutputType>Exe</OutputType> + <CLRTestKind>BuildAndRun</CLRTestKind> + <CLRTestPriority>0</CLRTestPriority> + </PropertyGroup> + + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + + <ItemGroup> + <Compile Include="nesting7.il" /> + </ItemGroup> + + <ItemGroup> + <None Include="app.config" /> + </ItemGroup> + + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> +</Project> diff --git a/tests/src/Loader/classloader/nesting/Tests/nesting88.il b/tests/src/Loader/classloader/nesting/Tests/nesting88.il new file mode 100644 index 0000000000..006ac766bd --- /dev/null +++ b/tests/src/Loader/classloader/nesting/Tests/nesting88.il @@ -0,0 +1,61 @@ +// 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. + +.assembly extern System.Console { } +// model revision #2 +// To compile: ilasm /dll client88.il + +.assembly extern client88 {} +.assembly extern mscorlib{} + +.assembly nesting88 {} + +// Nesting module: PureManaged +// Nesting location: DLL + +// enclosing type +// kind: Class +// flag: abstract +// visibility: public +// generics: Nongeneric +// depends on nested: InstanceField + +.class abstract public EnclType +{ + // nested type + // kind: Interface + // flag: abstract + // visibility: public + // generics: Nongeneric + // depends on enclosing: StaticField + + .class interface abstract nested public NestedType + { + // nested depends on enclosing: StaticField + // nested member visibility: public + .field public static class EnclType enclType + } + + // enclosing depends on nested: InstanceField + // enclosing member visibility: public + .field public class EnclType/NestedType sNestClass + + .method public specialname instance void .ctor() cil managed + { + ldarg.0 + call instance void [mscorlib]System.Object::.ctor() + ret + } +} + +// we need this to load EnclType (since it is an abstract class) +.class public Helper extends EnclType +{ + .method public specialname instance void .ctor() cil managed + { + ldarg.0 + call instance void EnclType::.ctor() + ret + } +} diff --git a/tests/src/Loader/classloader/nesting/Tests/nesting88.ilproj b/tests/src/Loader/classloader/nesting/Tests/nesting88.ilproj new file mode 100644 index 0000000000..d3526ba689 --- /dev/null +++ b/tests/src/Loader/classloader/nesting/Tests/nesting88.ilproj @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <AssemblyName>nesting88</AssemblyName> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + <ReferenceLocalMscorlib>true</ReferenceLocalMscorlib> + <OutputType>Library</OutputType> + <CLRTestKind>BuildOnly</CLRTestKind> + <CLRTestPriority>0</CLRTestPriority> + </PropertyGroup> + + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + + <ItemGroup> + <Compile Include="nesting88.il" /> + </ItemGroup> + + <ItemGroup> + <None Include="app.config" /> + </ItemGroup> + + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> +</Project> diff --git a/tests/src/Loader/classloader/nesting/Tests/project.json b/tests/src/Loader/classloader/nesting/Tests/project.json new file mode 100644 index 0000000000..a2e84dc340 --- /dev/null +++ b/tests/src/Loader/classloader/nesting/Tests/project.json @@ -0,0 +1,35 @@ +{ + "dependencies": { + "Microsoft.NETCore.Platforms": "1.0.1-rc2-23816", + "System.Collections": "4.0.10", + "System.Collections.NonGeneric": "4.0.1-rc2-23816", + "System.Collections.Specialized": "4.0.1-rc2-23816", + "System.ComponentModel": "4.0.1-rc2-23816", + "System.Console": "4.0.0-rc2-23816", + "System.Diagnostics.Process": "4.1.0-rc2-23816", + "System.Globalization": "4.0.10", + "System.Globalization.Calendars": "4.0.0", + "System.IO": "4.0.10", + "System.IO.FileSystem": "4.0.0", + "System.IO.FileSystem.Primitives": "4.0.0", + "System.Linq": "4.0.1-rc2-23816", + "System.Linq.Queryable": "4.0.1-rc2-23816", + "System.Reflection": "4.0.10", + "System.Reflection.Primitives": "4.0.0", + "System.Runtime": "4.1.0-rc2-23816", + "System.Runtime.Extensions": "4.0.10", + "System.Runtime.Handles": "4.0.0", + "System.Runtime.InteropServices": "4.1.0-rc2-23816", + "System.Runtime.Loader": "4.0.0-rc2-23816", + "System.Text.Encoding": "4.0.10", + "System.Threading": "4.0.10", + "System.Threading.Thread": "4.0.0-rc2-23816", + "System.Xml.ReaderWriter": "4.0.11-rc2-23816", + "System.Xml.XDocument": "4.0.11-rc2-23816", + "System.Xml.XmlDocument": "4.0.1-rc2-23816", + "System.Xml.XmlSerializer": "4.0.11-rc2-23816" + }, + "frameworks": { + "dnxcore50": {} + } +} diff --git a/tests/src/Loader/classloader/nesting/coreclr/VSW491577.csproj b/tests/src/Loader/classloader/nesting/coreclr/VSW491577.csproj index c5731b434d..55b4f9f4e9 100644 --- a/tests/src/Loader/classloader/nesting/coreclr/VSW491577.csproj +++ b/tests/src/Loader/classloader/nesting/coreclr/VSW491577.csproj @@ -1,45 +1,39 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> <PropertyGroup> + <AssemblyName>VSW491577</AssemblyName> <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>BuildOnly</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' "> + <OutputType>Exe</OutputType> + <CLRTestKind>BuildAndRun</CLRTestKind> + <CLRTestPriority>0</CLRTestPriority> </PropertyGroup> + <ItemGroup> <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> <Visible>False</Visible> </CodeAnalysisDependentAssemblyPaths> </ItemGroup> + <ItemGroup> - <!-- Add Compile Object Here --> - <Compile Include="vsw491577.cs" /> + <Compile Include="VSW491577.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 +</Project> diff --git a/tests/src/Loader/classloader/nesting/coreclr/app.config b/tests/src/Loader/classloader/nesting/coreclr/app.config index 62803f5972..e5622f77ad 100644 --- a/tests/src/Loader/classloader/nesting/coreclr/app.config +++ b/tests/src/Loader/classloader/nesting/coreclr/app.config @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version = "1.0" encoding="utf-8"?> <configuration> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> @@ -24,4 +24,4 @@ </dependentAssembly> </assemblyBinding> </runtime> -</configuration>
\ No newline at end of file +</configuration> diff --git a/tests/src/Loader/classloader/nesting/coreclr/exec16.il b/tests/src/Loader/classloader/nesting/coreclr/exec16.il new file mode 100644 index 0000000000..ea307259a9 --- /dev/null +++ b/tests/src/Loader/classloader/nesting/coreclr/exec16.il @@ -0,0 +1,49 @@ +// 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. + +.assembly extern System.Console { } +// model revision #2 +// To compile: ilasm exec16.il + +.assembly exec {} + +.assembly extern mscorlib{} +.assembly extern nesting16 {} + + + // entry point location: GlobalManaged + + .method public static int32 Main() + { + .entrypoint + .locals init (class [mscorlib]System.Exception V_0, + int32 V_1) + + .try + { + newobj instance void class [nesting16]Client::.ctor() + call instance void [nesting16]Client::method1() + + + ldstr "PASS" + call void [System.Console]System.Console::WriteLine(string) + ldc.i4.s 100 + stloc.1 + leave.s end + } + catch [mscorlib]System.Exception + { + stloc.0 + ldstr "{0}Caught unexpected exception." + ldloc.0 + call void [System.Console]System.Console::WriteLine(string,object) + ldstr "FAIL" + call void [System.Console]System.Console::WriteLine(string) + ldc.i4.s 101 + stloc.1 + leave.s end + } + end: ldloc.1 + ret + } diff --git a/tests/src/Loader/classloader/nesting/coreclr/exec16.ilproj b/tests/src/Loader/classloader/nesting/coreclr/exec16.ilproj new file mode 100644 index 0000000000..6e1d7bd472 --- /dev/null +++ b/tests/src/Loader/classloader/nesting/coreclr/exec16.ilproj @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <AssemblyName>exec16</AssemblyName> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + <ReferenceLocalMscorlib>true</ReferenceLocalMscorlib> + <OutputType>Exe</OutputType> + <CLRTestKind>BuildAndRun</CLRTestKind> + <CLRTestPriority>0</CLRTestPriority> + </PropertyGroup> + + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + + <ItemGroup> + <Compile Include="exec16.il" /> + </ItemGroup> + + <ItemGroup> + <None Include="app.config" /> + </ItemGroup> + + <ItemGroup> + <ProjectReference Include="nesting16.ilproj" /> + </ItemGroup> + + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> +</Project> diff --git a/tests/src/Loader/classloader/nesting/coreclr/exec3.il b/tests/src/Loader/classloader/nesting/coreclr/exec3.il new file mode 100644 index 0000000000..6c6e71e2c8 --- /dev/null +++ b/tests/src/Loader/classloader/nesting/coreclr/exec3.il @@ -0,0 +1,50 @@ +// 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. + +.assembly extern System.Console { } +// model revision #2 +// To compile: ilasm exec3.il + +.assembly exec {} +.assembly extern mscorlib {} + +.assembly extern nesting3 {} + +.class public Exec +{ + + // entry point location: MainManagedType + + .method public static int32 Main() + { + .entrypoint + .locals init (class [mscorlib]System.Exception V_0, + int32 V_1) + + .try + { + newobj instance void class [nesting3]Client<class [nesting3]EnclType<int32>>::.ctor() + call instance void class [nesting3] Client<class [nesting3]EnclType<int32>>::method1() + ldstr "PASS" + call void [System.Console]System.Console::WriteLine(string) + ldc.i4.s 100 + stloc.1 + leave.s end + } + catch [mscorlib]System.Exception + { + stloc.0 + ldstr "{0}Caught unexpected exception." + ldloc.0 + call void [System.Console]System.Console::WriteLine(string,object) + ldstr "FAIL" + call void [System.Console]System.Console::WriteLine(string) + ldc.i4.s 101 + stloc.1 + leave.s end + } + end: ldloc.1 + ret + } +} diff --git a/tests/src/Loader/classloader/nesting/coreclr/exec3.ilproj b/tests/src/Loader/classloader/nesting/coreclr/exec3.ilproj new file mode 100644 index 0000000000..21ee0505bf --- /dev/null +++ b/tests/src/Loader/classloader/nesting/coreclr/exec3.ilproj @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <AssemblyName>exec3</AssemblyName> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + <ReferenceLocalMscorlib>true</ReferenceLocalMscorlib> + <OutputType>Exe</OutputType> + <CLRTestKind>BuildAndRun</CLRTestKind> + <CLRTestPriority>0</CLRTestPriority> + </PropertyGroup> + + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + + <ItemGroup> + <Compile Include="exec3.il" /> + </ItemGroup> + + <ItemGroup> + <None Include="app.config" /> + </ItemGroup> + + <ItemGroup> + <ProjectReference Include="nesting3.ilproj" /> + </ItemGroup> + + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> +</Project> diff --git a/tests/src/Loader/classloader/nesting/coreclr/nesting16.il b/tests/src/Loader/classloader/nesting/coreclr/nesting16.il new file mode 100644 index 0000000000..a8b7173d65 --- /dev/null +++ b/tests/src/Loader/classloader/nesting/coreclr/nesting16.il @@ -0,0 +1,93 @@ +// 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. + +.assembly extern System.Console { } +// model revision #2 +// To compile: ilasm /dll nesting.il + +.assembly extern mscorlib{} +.assembly nesting16{} + +// Nesting module: PureManaged +// Nesting location: DLL + +// enclosing type +// kind: Struct +// flag: sealed +// visibility: public +// generics: Nongeneric +// depends on nested: MethodParam + +.class public value EnclType +{ + // nested type + // kind: Struct + // flag: sealed + // visibility: famorassem + // generics: Nongeneric + // depends on enclosing: MethodParam + + .class nested famorassem value NestedType + { + // nested depends on enclosing: MethodParam + // nested member visibility: assembly + .method assembly instance void method2(valuetype EnclType enclType) + { + ret + } + } + + // enclosing depends on nested: MethodParam + // enclosing member visibility: famorassem + .method famorassem instance void method2(valuetype EnclType/NestedType nestClass) + { + ret + } +} + + +// Client module: PureManaged +// Client location: DLL +// Client interaction: None + +.class public Client +{ + + .method public specialname instance void .ctor() cil managed + { + .maxstack 8 + ldarg.0 + call instance void [mscorlib]System.Object::.ctor() + ret + } + + .method public instance void method1() + { + .locals init ( valuetype EnclType V_0, + valuetype EnclType/NestedType V_1) + + + // create EnclType struct + // create EnclType/NestedType struct + + ldloca.s V_0 + initobj EnclType + ldloca.s V_1 + initobj EnclType/NestedType + + // call method2(valuetype EnclType/NestedType nestClass) in EnclType + + ldloca.s V_0 + ldloc.1 + call instance void EnclType::method2(valuetype EnclType/NestedType nestClass) + + // call method2(valuetype EnclType enclType) in EnclType/NestedType + + ldloca.s V_1 + ldloc.0 + call instance void EnclType/NestedType::method2(valuetype EnclType enclType) + + ret + } +} diff --git a/tests/src/Loader/classloader/nesting/coreclr/nesting16.ilproj b/tests/src/Loader/classloader/nesting/coreclr/nesting16.ilproj new file mode 100644 index 0000000000..0075099a44 --- /dev/null +++ b/tests/src/Loader/classloader/nesting/coreclr/nesting16.ilproj @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <AssemblyName>nesting16</AssemblyName> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + <ReferenceLocalMscorlib>true</ReferenceLocalMscorlib> + <OutputType>Library</OutputType> + <CLRTestKind>BuildOnly</CLRTestKind> + <CLRTestPriority>0</CLRTestPriority> + </PropertyGroup> + + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + + <ItemGroup> + <Compile Include="nesting16.il" /> + </ItemGroup> + + <ItemGroup> + <None Include="app.config" /> + </ItemGroup> + + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> +</Project> diff --git a/tests/src/Loader/classloader/nesting/coreclr/nesting18.il b/tests/src/Loader/classloader/nesting/coreclr/nesting18.il new file mode 100644 index 0000000000..ec9add0109 --- /dev/null +++ b/tests/src/Loader/classloader/nesting/coreclr/nesting18.il @@ -0,0 +1,121 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +.assembly extern System.Console { } +// model revision #1 +// to compile: ilasm nesting18.il + +// Nesting and Client in the same module + +.assembly extern mscorlib{} +.assembly nesting18 {} + +// Nesting module: Pure Managed +// Nesting location: MainModule + +// enclosing type +// kind: class +// flag: abstract +// visibility: private +// generics: nongeneric +// depends on nested: static field + +.class private abstract EnclType +{ + // enclosing member visibility: assembly + .field assembly static class EnclType/NestedType nestField + + // nested type + // kind: class + // flag: sealed + // visibility: public + // generics: nongeneric + // depends on enclosing: extends + + .class sealed nested public NestedType extends EnclType + { + + // nested member visibility: famorassem + .field famorassem static class EnclType/NestedType nestField + + + // entry point location: nested type + .method public static int32 Main() + { + .entrypoint + + .locals init (class Client<class EnclType/NestedType> V_0, + class [mscorlib]System.Exception V_1, + int32 V_2) + .try + { + newobj instance void class Client<class EnclType/NestedType>::.ctor() + pop + ldstr "PASS" + call void [System.Console]System.Console::WriteLine(string) + ldc.i4.s 100 + stloc.2 + leave.s end + } + catch [mscorlib]System.Exception + { + stloc.1 + ldstr "{0}Caught unexpected exception." + ldloc.1 + call void [System.Console]System.Console::WriteLine(string,object) + ldstr "FAIL" + call void [System.Console]System.Console::WriteLine(string) + ldc.i4.s 101 + stloc.2 + leave.s end + } + end: ldloc.2 + ret + } + + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + .maxstack 8 + ldarg.0 + call instance void EnclType::.ctor() + ret + } + + // need static constructor to initialize the static field + .method public hidebysig specialname rtspecialname static void .cctor() il managed + { + newobj instance void EnclType/NestedType::.ctor() + stsfld class EnclType/NestedType EnclType/NestedType::nestField + ret + } + } + + + .method family hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + ldarg.0 + call instance void [mscorlib]System.Object::.ctor() + ret + } + +} + + +// Client module: Pure Managed +// Client location: MainModule +// Client interaction: constructed type nested + +.class public Client<([mscorlib]System.Object) T> +{ + + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + ldarg.0 + call instance void [mscorlib]System.Object::.ctor() + ret + } +} diff --git a/tests/src/Loader/classloader/nesting/coreclr/nesting18.ilproj b/tests/src/Loader/classloader/nesting/coreclr/nesting18.ilproj new file mode 100644 index 0000000000..5860132028 --- /dev/null +++ b/tests/src/Loader/classloader/nesting/coreclr/nesting18.ilproj @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <AssemblyName>nesting18</AssemblyName> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + <ReferenceLocalMscorlib>true</ReferenceLocalMscorlib> + <OutputType>Exe</OutputType> + <CLRTestKind>BuildAndRun</CLRTestKind> + <CLRTestPriority>0</CLRTestPriority> + </PropertyGroup> + + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + + <ItemGroup> + <Compile Include="nesting18.il" /> + </ItemGroup> + + <ItemGroup> + <None Include="app.config" /> + </ItemGroup> + + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> +</Project> diff --git a/tests/src/Loader/classloader/nesting/coreclr/nesting3.il b/tests/src/Loader/classloader/nesting/coreclr/nesting3.il new file mode 100644 index 0000000000..5d8e764324 --- /dev/null +++ b/tests/src/Loader/classloader/nesting/coreclr/nesting3.il @@ -0,0 +1,90 @@ +// 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. + +.assembly extern System.Console { } +// model revision #2 +// To compile: ilasm /dll nesting3.il + +.assembly extern mscorlib {} +.assembly nesting3{} + +// Nesting module: PureManaged +// Nesting location: DLL + +// enclosing type +// kind: Class +// flag: abstract +// visibility: public +// generics: Generic +// depends on nested: InstanceField + +.class abstract public EnclType<([mscorlib]System.Object) T> +{ + // nested type + // kind: Struct + // flag: sealed + // visibility: famorassem + // generics: Generic + // depends on enclosing: None + + .class nested famorassem value NestedType<([mscorlib]System.Object) M> + { + // nested depends on enclosing: None + } + + // enclosing depends on nested: InstanceField + // enclosing member visibility: assembly + .field public valuetype EnclType/NestedType<int32> sNestClass + + .method public specialname instance void .ctor() cil managed + { + .maxstack 8 + ldarg.0 + call instance void [mscorlib]System.Object::.ctor() + ret + } +} + + +// Client module: PureManaged +// Client location: DLL +// Client interaction: ConstructedTypeEncl + +.class public Client<([mscorlib]System.Object) T> +{ + + .method public specialname instance void .ctor() cil managed + { + .maxstack 8 + ldarg.0 + call instance void [mscorlib]System.Object::.ctor() + ret + } + + .method public instance void method1() + { + .locals init (valuetype EnclType/NestedType<int32> V_0) + + // Helper2 extends EnclType + newobj instance void Helper2::.ctor() + + // load instance field of EnclType (which has NestedType) + ldflda valuetype EnclType/NestedType<int32> class EnclType<int32>::sNestClass + initobj valuetype EnclType/NestedType<int32> + + ret + } +} + +// we need this Helper class to load EnclType +.class public Helper2 extends class EnclType<int32> +{ + .method public specialname instance void .ctor() cil managed + { + ldarg.0 + call instance void class EnclType<int32>::.ctor() + ret + } + +} diff --git a/tests/src/Loader/classloader/nesting/coreclr/nesting3.ilproj b/tests/src/Loader/classloader/nesting/coreclr/nesting3.ilproj new file mode 100644 index 0000000000..e0fe09f6c6 --- /dev/null +++ b/tests/src/Loader/classloader/nesting/coreclr/nesting3.ilproj @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <AssemblyName>nesting3</AssemblyName> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + <ReferenceLocalMscorlib>true</ReferenceLocalMscorlib> + <OutputType>Library</OutputType> + <CLRTestKind>BuildOnly</CLRTestKind> + <CLRTestPriority>0</CLRTestPriority> + </PropertyGroup> + + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + + <ItemGroup> + <Compile Include="nesting3.il" /> + </ItemGroup> + + <ItemGroup> + <None Include="app.config" /> + </ItemGroup> + + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> +</Project> diff --git a/tests/src/Loader/classloader/nesting/coreclr/nesting31.il b/tests/src/Loader/classloader/nesting/coreclr/nesting31.il new file mode 100644 index 0000000000..384faa9d77 --- /dev/null +++ b/tests/src/Loader/classloader/nesting/coreclr/nesting31.il @@ -0,0 +1,121 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +.assembly extern System.Console { } +// model revision #1 +// to compile: ilasm nesting31.il + +// Nesting and Client in the same module + +.assembly extern mscorlib{} +.assembly nesting31{} + +// Nesting module: Pure Managed +// Nesting location: MainModule + +// enclosing type +// kind: class +// flag: abstract +// visibility: public +// generics: nongeneric +// depends on nested: extends + + +.class abstract public EnclType extends EnclType/NestedType +{ + + // nested type + // kind: class + // flag: none + // visibility: public + // generics: nongeneric + // depends on enclosing: none + + .class nested public NestedType + { + + // nested memeber visibility: assembly + .field assembly int32 i + + .method public specialname instance void .ctor() cil managed + { + .maxstack 8 + ldarg.0 + call instance void [mscorlib]System.Object::.ctor() + ret + } + } + + // enclosing memeber visibility: assembly + .field assembly int32 i + + + // entrypoint location: Enclosing type + .method public static int32 Main() + { + .entrypoint + + .locals init (class Client V_0, + class [mscorlib]System.Exception V_1, + int32 V_2) + .try + { + newobj instance void Client::.ctor() + stloc.0 + ldloc.0 + call instance void Client::method4() + + ldstr "PASS" + call void [System.Console]System.Console::WriteLine(string) + ldc.i4.s 100 + stloc.2 + leave.s end + } + catch [mscorlib]System.Exception + { + stloc.1 + ldstr "{0}Caught unexpected exception." + ldloc.1 + call void [System.Console]System.Console::WriteLine(string,object) + ldstr "FAIL" + call void [System.Console]System.Console::WriteLine(string) + ldc.i4.s 101 + stloc.2 + leave.s end + } + end: ldloc.2 + ret + } +} + +// Client module: Pure Managed +// Client location: MainModule +// Client interaction: none + +.class public Client +{ + + .method public specialname instance void .ctor() cil managed + { + .maxstack 8 + ldarg.0 + call instance void [mscorlib]System.Object::.ctor() + ret + } + + // since there is no interaction between client and nested/enclosing types + // method4() is a helper method that allows us to load nested and enclosing types + .method public void method4() + { + .locals init (class EnclType/NestedType V_0) + newobj instance void class EnclType/NestedType::.ctor() + + // we need this to make sure we test the member of nested type + stloc.0 + ldloc.0 + ldc.i4.5 + stfld int32 class EnclType/NestedType::i + ret + } +} diff --git a/tests/src/Loader/classloader/nesting/coreclr/nesting31.ilproj b/tests/src/Loader/classloader/nesting/coreclr/nesting31.ilproj new file mode 100644 index 0000000000..422c7cbe3a --- /dev/null +++ b/tests/src/Loader/classloader/nesting/coreclr/nesting31.ilproj @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <AssemblyName>nesting31</AssemblyName> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + <ReferenceLocalMscorlib>true</ReferenceLocalMscorlib> + <OutputType>Exe</OutputType> + <CLRTestKind>BuildAndRun</CLRTestKind> + <CLRTestPriority>0</CLRTestPriority> + </PropertyGroup> + + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + + <ItemGroup> + <Compile Include="nesting31.il" /> + </ItemGroup> + + <ItemGroup> + <None Include="app.config" /> + </ItemGroup> + + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> +</Project> diff --git a/tests/src/Loader/classloader/nesting/coreclr/nesting4.il b/tests/src/Loader/classloader/nesting/coreclr/nesting4.il new file mode 100644 index 0000000000..a5ee7e9bf2 --- /dev/null +++ b/tests/src/Loader/classloader/nesting/coreclr/nesting4.il @@ -0,0 +1,126 @@ +// 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. + +.assembly extern System.Console { } +// model revision #2 +// To compile: ilasm nesting4.il + +.assembly extern mscorlib {} +.assembly nesting4{} + +// Nesting module: PureManaged +// Nesting location: MainModule + +// enclosing type +// kind: Class +// flag: None +// visibility: private +// generics: Nongeneric +// depends on nested: InstanceField + +.class private EnclType +{ + // nested type + // kind: Interface + // flag: abstract + // visibility: public + // generics: Nongeneric + // depends on enclosing: StaticField + + .class interface abstract nested public NestedType + { + // nested depends on enclosing: StaticField + // nested member visibility: public + .field public static class EnclType sEnclType + } + + // enclosing depends on nested: InstanceField + // enclosing member visibility: famorassem + .field famorassem class EnclType/NestedType sNestClass + + // entry point location: EnclosingType + + .method public static int32 Main() + { + .entrypoint + .locals init (class [mscorlib]System.Exception V_0, + int32 V_1) + + .try + { + newobj instance void class Client::.ctor() + call instance void Client::method1() + ldstr "PASS" + call void [System.Console]System.Console::WriteLine(string) + ldc.i4.s 100 + stloc.1 + leave.s end + } + catch [mscorlib]System.Exception + { + stloc.0 + ldstr "{0}Caught unexpected exception." + ldloc.0 + call void [System.Console]System.Console::WriteLine(string,object) + ldstr "FAIL" + call void [System.Console]System.Console::WriteLine(string) + ldc.i4.s 101 + stloc.1 + leave.s end + } + end: ldloc.1 + ret + } + + .method public specialname instance void .ctor() cil managed + { + .maxstack 8 + ldarg.0 + call instance void [mscorlib]System.Object::.ctor() + ret + } +} + + +// Client module: PureManaged +// Client location: MainModule +// Client interaction: None + +.class public Client +{ + + .method public specialname instance void .ctor() cil managed + { + .maxstack 8 + ldarg.0 + call instance void [mscorlib]System.Object::.ctor() + ret + } + .method public instance void method1() + { + + // load enclosing and nested types + + newobj instance void class EnclType::.ctor() + stsfld class EnclType class EnclType/NestedType::sEnclType + ldsfld class EnclType class EnclType/NestedType::sEnclType + + // Helper1 implements EnclType/NestedType + + newobj instance void class Helper1::.ctor() + stfld class EnclType/NestedType class EnclType::sNestClass + ret + } +} + +.class public Helper1 implements EnclType/NestedType +{ + .method public specialname instance void .ctor() cil managed + { + ldarg.0 + call instance void [mscorlib]System.Object::.ctor() + ret + } + +} diff --git a/tests/src/Loader/classloader/nesting/coreclr/nesting4.ilproj b/tests/src/Loader/classloader/nesting/coreclr/nesting4.ilproj new file mode 100644 index 0000000000..d6245f6662 --- /dev/null +++ b/tests/src/Loader/classloader/nesting/coreclr/nesting4.ilproj @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <AssemblyName>nesting4</AssemblyName> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + <ReferenceLocalMscorlib>true</ReferenceLocalMscorlib> + <OutputType>Exe</OutputType> + <CLRTestKind>BuildAndRun</CLRTestKind> + <CLRTestPriority>0</CLRTestPriority> + </PropertyGroup> + + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + + <ItemGroup> + <Compile Include="nesting4.il" /> + </ItemGroup> + + <ItemGroup> + <None Include="app.config" /> + </ItemGroup> + + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> +</Project> diff --git a/tests/src/Loader/classloader/nesting/coreclr/project.json b/tests/src/Loader/classloader/nesting/coreclr/project.json index ce79c6960b..fc8ccb4cc2 100644 --- a/tests/src/Loader/classloader/nesting/coreclr/project.json +++ b/tests/src/Loader/classloader/nesting/coreclr/project.json @@ -1,9 +1,33 @@ { "dependencies": { "Microsoft.NETCore.Platforms": "1.0.1-rc2-23816", + "System.Collections": "4.0.10", + "System.Collections.NonGeneric": "4.0.1-rc2-23816", + "System.Collections.Specialized": "4.0.1-rc2-23816", + "System.ComponentModel": "4.0.1-rc2-23816", "System.Console": "4.0.0-rc2-23816", + "System.Diagnostics.Process": "4.1.0-rc2-23816", + "System.Globalization": "4.0.10", + "System.Globalization.Calendars": "4.0.0", + "System.IO": "4.0.10", + "System.IO.FileSystem": "4.0.0", + "System.IO.FileSystem.Primitives": "4.0.0", + "System.Linq": "4.0.1-rc2-23816", + "System.Linq.Queryable": "4.0.1-rc2-23816", + "System.Reflection": "4.0.10", + "System.Reflection.Primitives": "4.0.0", "System.Runtime": "4.1.0-rc2-23816", - "System.Runtime.Extensions": "4.0.10" + "System.Runtime.Extensions": "4.0.10", + "System.Runtime.Handles": "4.0.0", + "System.Runtime.InteropServices": "4.1.0-rc2-23816", + "System.Runtime.Loader": "4.0.0-rc2-23816", + "System.Text.Encoding": "4.0.10", + "System.Threading": "4.0.10", + "System.Threading.Thread": "4.0.0-rc2-23816", + "System.Xml.ReaderWriter": "4.0.11-rc2-23816", + "System.Xml.XDocument": "4.0.11-rc2-23816", + "System.Xml.XmlDocument": "4.0.1-rc2-23816", + "System.Xml.XmlSerializer": "4.0.11-rc2-23816" }, "frameworks": { "dnxcore50": {} diff --git a/tests/src/Loader/classloader/nesting/coreclr/vsw491577.cs b/tests/src/Loader/classloader/nesting/coreclr/vsw491577.cs index 1e51142557..50cffac8d4 100644 --- a/tests/src/Loader/classloader/nesting/coreclr/vsw491577.cs +++ b/tests/src/Loader/classloader/nesting/coreclr/vsw491577.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. + // this is regression test for VSW 491577 // we have nested types (up to depth 73). // Loading the 73rd type resulted in AV |