summaryrefslogtreecommitdiff
path: root/tests/src
diff options
context:
space:
mode:
authorAaron Robinson <arobins@microsoft.com>2019-02-12 08:33:58 -0800
committerGitHub <noreply@github.com>2019-02-12 08:33:58 -0800
commit09963dc2ee182e7e62212efbb205edd9c387961d (patch)
treed97bdbad524e0ac43bc4c13d10452cdf08d129d3 /tests/src
parent6cd9e3ab6cae4aaf2a70fe1e59173b998932601d (diff)
downloadcoreclr-09963dc2ee182e7e62212efbb205edd9c387961d.tar.gz
coreclr-09963dc2ee182e7e62212efbb205edd9c387961d.tar.bz2
coreclr-09963dc2ee182e7e62212efbb205edd9c387961d.zip
Update COM Activator class (#22317)
* Update COM Activator to use ALCs * Update tests to now supply an assembly name rather than an binary "path" since the COM activator is now using ALCs. * Add test for non-rooted assembly path. * Move the hostpolicy mock project to a Common area Move hostpolicy mock API to CoreCLR test library * Add test for COM server isolation * Move ComActivator class and logic to Internal namespace.
Diffstat (limited to 'tests/src')
-rw-r--r--tests/src/Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj5
-rw-r--r--tests/src/Common/CoreCLRTestLibrary/HostPolicyMock.cs (renamed from tests/src/Loader/AssemblyDependencyResolverTests/HostPolicyMock.cs)26
-rw-r--r--tests/src/Common/CoreCLRTestLibrary/XPlatformUtils.cs (renamed from tests/src/Loader/AssemblyDependencyResolverTests/XPlatformUtils.cs)9
-rw-r--r--tests/src/Common/hostpolicymock/CMakeLists.txt (renamed from tests/src/Loader/AssemblyDependencyResolverTests/CMakeLists.txt)0
-rw-r--r--tests/src/Common/hostpolicymock/HostpolicyMock.cpp (renamed from tests/src/Loader/AssemblyDependencyResolverTests/HostpolicyMock.cpp)12
-rw-r--r--tests/src/Interop/COM/Activator/Activator.csproj27
-rw-r--r--tests/src/Interop/COM/Activator/Program.cs94
-rw-r--r--tests/src/Interop/COM/Activator/Servers/AssemblyA.cs19
-rw-r--r--tests/src/Interop/COM/Activator/Servers/AssemblyA.csproj26
-rw-r--r--tests/src/Interop/COM/Activator/Servers/AssemblyB.cs19
-rw-r--r--tests/src/Interop/COM/Activator/Servers/AssemblyB.csproj26
-rw-r--r--tests/src/Interop/COM/Activator/Servers/AssemblyC.cs9
-rw-r--r--tests/src/Interop/COM/Activator/Servers/AssemblyC.csproj22
-rw-r--r--tests/src/Interop/COM/Activator/Servers/AssemblyContracts.cs13
-rw-r--r--tests/src/Interop/COM/Activator/Servers/AssemblyContracts.csproj22
-rw-r--r--tests/src/Interop/COM/NativeClients/Primitives.csproj3
-rw-r--r--tests/src/Interop/COM/NativeClients/Primitives/ArrayTests.cpp2
-rw-r--r--tests/src/Interop/COM/NativeClients/Primitives/ColorTests.cpp2
-rw-r--r--tests/src/Interop/COM/NativeClients/Primitives/ErrorTests.cpp2
-rw-r--r--tests/src/Interop/COM/NativeClients/Primitives/NumericTests.cpp2
-rw-r--r--tests/src/Interop/COM/NativeClients/Primitives/StringTests.cpp2
-rw-r--r--tests/src/Interop/ExecInDefAppDom/ExecInDefAppDom.csproj3
-rw-r--r--tests/src/Interop/Interop.settings.targets20
-rw-r--r--tests/src/Interop/NativeCallable/NativeCallableTest.csproj3
-rw-r--r--tests/src/Interop/PInvoke/CustomMarshalers/CustomMarshalersTest.csproj3
-rw-r--r--tests/src/Loader/AssemblyDependencyResolverTests/AssemblyDependencyResolverTests.cs29
-rw-r--r--tests/src/Loader/AssemblyDependencyResolverTests/AssemblyDependencyResolverTests.csproj9
-rw-r--r--tests/src/Loader/AssemblyDependencyResolverTests/InvalidHostingTest.cs3
-rw-r--r--tests/src/Loader/AssemblyDependencyResolverTests/NativeDependencyTests.cs5
29 files changed, 360 insertions, 57 deletions
diff --git a/tests/src/Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj b/tests/src/Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj
index 7e210d0749..ea0ee84166 100644
--- a/tests/src/Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj
+++ b/tests/src/Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj
@@ -31,9 +31,8 @@
<Compile Include="Logging.cs" />
<Compile Include="TestFramework.cs" />
<Compile Include="Utilities.cs" />
- </ItemGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ <Compile Include="HostPolicyMock.cs" />
+ <Compile Include="XPlatformUtils.cs" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>
diff --git a/tests/src/Loader/AssemblyDependencyResolverTests/HostPolicyMock.cs b/tests/src/Common/CoreCLRTestLibrary/HostPolicyMock.cs
index 37cedbc542..afa1fbcd0d 100644
--- a/tests/src/Loader/AssemblyDependencyResolverTests/HostPolicyMock.cs
+++ b/tests/src/Common/CoreCLRTestLibrary/HostPolicyMock.cs
@@ -6,15 +6,15 @@ using System.IO;
using System.Runtime.InteropServices;
using System.Runtime.Loader;
-namespace AssemblyDependencyResolverTests
+namespace TestLibrary
{
- class HostPolicyMock
+ public class HostPolicyMock
{
-#if WINDOWS
+ #if PLATFORM_WINDOWS
private const CharSet HostpolicyCharSet = CharSet.Unicode;
-#else
+ #else
private const CharSet HostpolicyCharSet = CharSet.Ansi;
-#endif
+ #endif
[DllImport("hostpolicy", CharSet = HostpolicyCharSet)]
private static extern int Set_corehost_resolve_component_dependencies_Values(
@@ -45,24 +45,32 @@ namespace AssemblyDependencyResolverTests
public static string DeleteExistingHostpolicy(string coreRoot)
{
+#if REFERENCING_SYSTEMPRIVATECORELIB
+ throw new Exception("This API is not supported when compiled referencing SPCL");
+
+#else
string hostPolicyFileName = XPlatformUtils.GetStandardNativeLibraryFileName("hostpolicy");
string destinationPath = Path.Combine(coreRoot, hostPolicyFileName);
+
if (File.Exists(destinationPath))
{
File.Delete(destinationPath);
}
return destinationPath;
+#endif
}
public static void Initialize(string testBasePath, string coreRoot)
{
+#if !REFERENCING_SYSTEMPRIVATECORELIB
string hostPolicyFileName = XPlatformUtils.GetStandardNativeLibraryFileName("hostpolicy");
string destinationPath = DeleteExistingHostpolicy(coreRoot);
File.Copy(
Path.Combine(testBasePath, hostPolicyFileName),
destinationPath);
+#endif
_assemblyDependencyResolverType = typeof(AssemblyDependencyResolver);
@@ -72,7 +80,7 @@ namespace AssemblyDependencyResolverTests
_corehost_error_writer_fnType = _assemblyDependencyResolverType.GetNestedType("corehost_error_writer_fn", System.Reflection.BindingFlags.NonPublic);
}
- public static MockValues_corehost_resolve_componet_dependencies Mock_corehost_resolve_componet_dependencies(
+ public static MockValues_corehost_resolve_component_dependencies Mock_corehost_resolve_component_dependencies(
int returnValue,
string assemblyPaths,
string nativeSearchPaths,
@@ -84,10 +92,10 @@ namespace AssemblyDependencyResolverTests
nativeSearchPaths,
resourceSearchPaths);
- return new MockValues_corehost_resolve_componet_dependencies();
+ return new MockValues_corehost_resolve_component_dependencies();
}
- internal class MockValues_corehost_resolve_componet_dependencies : IDisposable
+ public class MockValues_corehost_resolve_component_dependencies : IDisposable
{
private Callback_corehost_resolve_component_dependencies callback;
@@ -133,7 +141,7 @@ namespace AssemblyDependencyResolverTests
return new MockValues_corehost_set_error_writer();
}
- internal class MockValues_corehost_set_error_writer : IDisposable
+ public class MockValues_corehost_set_error_writer : IDisposable
{
public IntPtr LastSetErrorWriterPtr
{
diff --git a/tests/src/Loader/AssemblyDependencyResolverTests/XPlatformUtils.cs b/tests/src/Common/CoreCLRTestLibrary/XPlatformUtils.cs
index fd931f465d..e8bcca27eb 100644
--- a/tests/src/Loader/AssemblyDependencyResolverTests/XPlatformUtils.cs
+++ b/tests/src/Common/CoreCLRTestLibrary/XPlatformUtils.cs
@@ -1,16 +1,17 @@
// 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.
-namespace AssemblyDependencyResolverTests
+
+namespace TestLibrary
{
- class XPlatformUtils
+ public class XPlatformUtils
{
-#if WINDOWS
+#if PLATFORM_WINDOWS
public const string NativeLibraryPrefix = "";
public const string NativeLibrarySuffix = ".dll";
#else
public const string NativeLibraryPrefix = "lib";
-#if OSX
+#if PLATFORM_OSX
public const string NativeLibrarySuffix = ".dylib";
#else
public const string NativeLibrarySuffix = ".so";
diff --git a/tests/src/Loader/AssemblyDependencyResolverTests/CMakeLists.txt b/tests/src/Common/hostpolicymock/CMakeLists.txt
index 9e4821148b..9e4821148b 100644
--- a/tests/src/Loader/AssemblyDependencyResolverTests/CMakeLists.txt
+++ b/tests/src/Common/hostpolicymock/CMakeLists.txt
diff --git a/tests/src/Loader/AssemblyDependencyResolverTests/HostpolicyMock.cpp b/tests/src/Common/hostpolicymock/HostpolicyMock.cpp
index b1a90d2af3..cd16afa1a0 100644
--- a/tests/src/Loader/AssemblyDependencyResolverTests/HostpolicyMock.cpp
+++ b/tests/src/Common/hostpolicymock/HostpolicyMock.cpp
@@ -14,7 +14,17 @@
typedef wchar_t char_t;
typedef std::wstring string_t;
-#else //!_Win32
+// Only create undecorated exports on Windows x86
+#if defined _X86_
+
+// Define undecorated exports to ease test set up from native code
+#pragma comment(linker, "/export:Set_corehost_resolve_component_dependencies_Callback=_Set_corehost_resolve_component_dependencies_Callback@4")
+#pragma comment(linker, "/export:Set_corehost_resolve_component_dependencies_Values=_Set_corehost_resolve_component_dependencies_Values@16")
+#pragma comment(linker, "/export:Set_corehost_set_error_writer_returnValue=_Set_corehost_set_error_writer_returnValue@4")
+
+#endif
+
+#else //!_WIN32
#if __GNUC__ >= 4
#define SHARED_API extern "C" __attribute__ ((visibility ("default")))
diff --git a/tests/src/Interop/COM/Activator/Activator.csproj b/tests/src/Interop/COM/Activator/Activator.csproj
index 792b8be2fe..b656a5c1e9 100644
--- a/tests/src/Interop/COM/Activator/Activator.csproj
+++ b/tests/src/Interop/COM/Activator/Activator.csproj
@@ -1,7 +1,6 @@
<?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" />
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Interop.settings.targets))\Interop.settings.targets" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -14,6 +13,8 @@
<TestUnsupportedOutsideWindows>true</TestUnsupportedOutsideWindows>
<DisableProjectBuild Condition="'$(TargetsWindows)' != 'true'">true</DisableProjectBuild>
</PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Interop.settings.targets))\Interop.settings.targets" />
+
<!-- Default configurations to help VS understand the configurations -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
</PropertyGroup>
@@ -24,6 +25,30 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NetServer\NetServer.csproj" />
+ <ProjectReference Include="Servers\AssemblyA.csproj" />
+ <ProjectReference Include="Servers\AssemblyB.csproj" />
+ <ProjectReference Include="Servers\AssemblyC.csproj" />
+ <ProjectReference Include="Servers\AssemblyContracts.csproj" />
+ <ProjectReference Include="../../../Common/hostpolicymock/CMakeLists.txt" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+
+ <!-- Set up an isolated directory for the server assemblies -->
+ <Target Name="SetUpIsolatedDirectory"
+ AfterTargets="CopyFilesToOutputDirectory">
+
+ <PropertyGroup>
+ <ServerAssemblyDest>$(OutDir)/Servers</ServerAssemblyDest>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <ServerAssembly Include="$(OutDir)/AssemblyA.*" />
+ <ServerAssembly Include="$(OutDir)/AssemblyB.*" />
+ <ServerAssembly Include="$(OutDir)/AssemblyC.*" />
+ </ItemGroup>
+
+ <Move SourceFiles="@(ServerAssembly)"
+ DestinationFolder="$(ServerAssemblyDest)" />
+ </Target>
+
</Project>
diff --git a/tests/src/Interop/COM/Activator/Program.cs b/tests/src/Interop/COM/Activator/Program.cs
index 4316736950..451ecc7755 100644
--- a/tests/src/Interop/COM/Activator/Program.cs
+++ b/tests/src/Interop/COM/Activator/Program.cs
@@ -4,7 +4,10 @@
namespace Activator
{
+ using Internal.Runtime.InteropServices;
+
using System;
+ using System.IO;
using System.Runtime.InteropServices;
using TestLibrary;
@@ -15,6 +18,8 @@ namespace Activator
{
static void InvalidInterfaceRequest()
{
+ Console.WriteLine($"Running {nameof(InvalidInterfaceRequest)}...");
+
Assert.Throws<NotSupportedException>(
() =>
{
@@ -28,17 +33,36 @@ namespace Activator
"Non-IClassFactory request should fail");
}
+ static void NonrootedAssemblyPath()
+ {
+ Console.WriteLine($"Running {nameof(NonrootedAssemblyPath)}...");
+
+ ArgumentException e = Assert.Throws<ArgumentException>(
+ () =>
+ {
+ var cxt = new ComActivationContext()
+ {
+ InterfaceId = typeof(IClassFactory).GUID,
+ AssemblyPath = "foo.dll"
+ };
+ ComActivator.GetClassFactoryForType(cxt);
+ },
+ "Non-root assembly path should not be valid");
+ }
+
static void ClassNotRegistered()
{
+ Console.WriteLine($"Running {nameof(ClassNotRegistered)}...");
+
COMException e = Assert.Throws<COMException>(
() =>
{
var CLSID_NotRegistered = new Guid("328FF83E-3F6C-4BE9-A742-752562032925"); // Random GUID
- var IID_IClassFactory = new Guid("00000001-0000-0000-C000-000000000046");
var cxt = new ComActivationContext()
{
ClassId = CLSID_NotRegistered,
- InterfaceId = IID_IClassFactory
+ InterfaceId = typeof(IClassFactory).GUID,
+ AssemblyPath = @"C:\foo.dll"
};
ComActivator.GetClassFactoryForType(cxt);
},
@@ -48,12 +72,78 @@ namespace Activator
Assert.AreEqual(CLASS_E_CLASSNOTAVAILABLE, e.HResult, "Unexpected HRESULT");
}
+ static void ValidateAssemblyIsolation()
+ {
+ Console.WriteLine($"Running {nameof(ValidateAssemblyIsolation)}...");
+
+ string assemblySubPath = Path.Combine(Environment.CurrentDirectory, "Servers");
+ string assemblyAPath = Path.Combine(assemblySubPath, "AssemblyA.dll");
+ string assemblyBPath = Path.Combine(assemblySubPath, "AssemblyB.dll");
+ string assemblyCPath = Path.Combine(assemblySubPath, "AssemblyC.dll");
+ string assemblyPaths = $"{assemblyAPath}{Path.PathSeparator}{assemblyBPath}{Path.PathSeparator}{assemblyCPath}";
+
+ HostPolicyMock.Initialize(Environment.CurrentDirectory, null);
+
+ var CLSID_NotUsed = Guid.Empty; // During this phase of activation the GUID is not used.
+ Guid iid = typeof(IGetTypeFromC).GUID;
+ Type typeCFromAssemblyA;
+ Type typeCFromAssemblyB;
+
+ using (HostPolicyMock.Mock_corehost_resolve_component_dependencies(
+ 0,
+ assemblyPaths,
+ string.Empty,
+ string.Empty))
+ {
+ var cxt = new ComActivationContext()
+ {
+ ClassId = CLSID_NotUsed,
+ InterfaceId = typeof(IClassFactory).GUID,
+ AssemblyPath = assemblyAPath,
+ AssemblyName = "AssemblyA",
+ TypeName = "ClassFromA"
+ };
+
+ var factory = (IClassFactory)ComActivator.GetClassFactoryForType(cxt);
+
+ object svr;
+ factory.CreateInstance(null, ref iid, out svr);
+ typeCFromAssemblyA = (Type)((IGetTypeFromC)svr).GetTypeFromC();
+ }
+
+ using (HostPolicyMock.Mock_corehost_resolve_component_dependencies(
+ 0,
+ assemblyPaths,
+ string.Empty,
+ string.Empty))
+ {
+ var cxt = new ComActivationContext()
+ {
+ ClassId = CLSID_NotUsed,
+ InterfaceId = typeof(IClassFactory).GUID,
+ AssemblyPath = assemblyBPath,
+ AssemblyName = "AssemblyB",
+ TypeName = "ClassFromB"
+ };
+
+ var factory = (IClassFactory)ComActivator.GetClassFactoryForType(cxt);
+
+ object svr;
+ factory.CreateInstance(null, ref iid, out svr);
+ typeCFromAssemblyB = (Type)((IGetTypeFromC)svr).GetTypeFromC();
+ }
+
+ Assert.AreNotEqual(typeCFromAssemblyA, typeCFromAssemblyB, "Types should be from different AssemblyLoadContexts");
+ }
+
static int Main(string[] doNotUse)
{
try
{
InvalidInterfaceRequest();
ClassNotRegistered();
+ NonrootedAssemblyPath();
+ ValidateAssemblyIsolation();
}
catch (Exception e)
{
diff --git a/tests/src/Interop/COM/Activator/Servers/AssemblyA.cs b/tests/src/Interop/COM/Activator/Servers/AssemblyA.cs
new file mode 100644
index 0000000000..606f064c92
--- /dev/null
+++ b/tests/src/Interop/COM/Activator/Servers/AssemblyA.cs
@@ -0,0 +1,19 @@
+// 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 ClassFromA : IGetTypeFromC
+{
+ private readonly ClassFromC _fromC;
+ public ClassFromA()
+ {
+ this._fromC = new ClassFromC();
+ }
+
+ public object GetTypeFromC()
+ {
+ return this._fromC.GetType();
+ }
+} \ No newline at end of file
diff --git a/tests/src/Interop/COM/Activator/Servers/AssemblyA.csproj b/tests/src/Interop/COM/Activator/Servers/AssemblyA.csproj
new file mode 100644
index 0000000000..b5fbf3b4ad
--- /dev/null
+++ b/tests/src/Interop/COM/Activator/Servers/AssemblyA.csproj
@@ -0,0 +1,26 @@
+<?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" />
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Interop.settings.targets))\Interop.settings.targets" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>AssemblyA</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <OutputType>library</OutputType>
+ <ProjectTypeGuids>{4948E98A-ECFC-4988-851E-68E1ADD2DD5A};{B850CC46-E8FB-4569-A28D-423F81E8A861}</ProjectTypeGuids>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="AssemblyA.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="AssemblyC.csproj" />
+ <ProjectReference Include="AssemblyContracts.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Interop/COM/Activator/Servers/AssemblyB.cs b/tests/src/Interop/COM/Activator/Servers/AssemblyB.cs
new file mode 100644
index 0000000000..043434d033
--- /dev/null
+++ b/tests/src/Interop/COM/Activator/Servers/AssemblyB.cs
@@ -0,0 +1,19 @@
+// 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 ClassFromB : IGetTypeFromC
+{
+ private readonly ClassFromC _fromC;
+ public ClassFromB()
+ {
+ this._fromC = new ClassFromC();
+ }
+
+ public object GetTypeFromC()
+ {
+ return this._fromC.GetType();
+ }
+} \ No newline at end of file
diff --git a/tests/src/Interop/COM/Activator/Servers/AssemblyB.csproj b/tests/src/Interop/COM/Activator/Servers/AssemblyB.csproj
new file mode 100644
index 0000000000..8f0fb0af8e
--- /dev/null
+++ b/tests/src/Interop/COM/Activator/Servers/AssemblyB.csproj
@@ -0,0 +1,26 @@
+<?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" />
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Interop.settings.targets))\Interop.settings.targets" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>AssemblyB</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <OutputType>library</OutputType>
+ <ProjectTypeGuids>{4948E98A-ECFC-4988-851E-68E1ADD2DD5A};{B850CC46-E8FB-4569-A28D-423F81E8A861}</ProjectTypeGuids>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="AssemblyB.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="AssemblyC.csproj" />
+ <ProjectReference Include="AssemblyContracts.csproj" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Interop/COM/Activator/Servers/AssemblyC.cs b/tests/src/Interop/COM/Activator/Servers/AssemblyC.cs
new file mode 100644
index 0000000000..fbb79f65f4
--- /dev/null
+++ b/tests/src/Interop/COM/Activator/Servers/AssemblyC.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.
+
+using System;
+
+public class ClassFromC
+{
+} \ No newline at end of file
diff --git a/tests/src/Interop/COM/Activator/Servers/AssemblyC.csproj b/tests/src/Interop/COM/Activator/Servers/AssemblyC.csproj
new file mode 100644
index 0000000000..8c5a84ca5f
--- /dev/null
+++ b/tests/src/Interop/COM/Activator/Servers/AssemblyC.csproj
@@ -0,0 +1,22 @@
+<?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" />
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Interop.settings.targets))\Interop.settings.targets" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>AssemblyC</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <OutputType>library</OutputType>
+ <ProjectTypeGuids>{4948E98A-ECFC-4988-851E-68E1ADD2DD5A};{B850CC46-E8FB-4569-A28D-423F81E8A861}</ProjectTypeGuids>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="AssemblyC.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Interop/COM/Activator/Servers/AssemblyContracts.cs b/tests/src/Interop/COM/Activator/Servers/AssemblyContracts.cs
new file mode 100644
index 0000000000..deb7b6312b
--- /dev/null
+++ b/tests/src/Interop/COM/Activator/Servers/AssemblyContracts.cs
@@ -0,0 +1,13 @@
+// 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.IO;
+using System.Runtime.InteropServices;
+
+[Guid("6B002803-4C9B-4E4F-BDA2-46AEFFD8D559")]
+public interface IGetTypeFromC
+{
+ object GetTypeFromC();
+} \ No newline at end of file
diff --git a/tests/src/Interop/COM/Activator/Servers/AssemblyContracts.csproj b/tests/src/Interop/COM/Activator/Servers/AssemblyContracts.csproj
new file mode 100644
index 0000000000..40cd185e4d
--- /dev/null
+++ b/tests/src/Interop/COM/Activator/Servers/AssemblyContracts.csproj
@@ -0,0 +1,22 @@
+<?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" />
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Interop.settings.targets))\Interop.settings.targets" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>AssemblyContracts</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <OutputType>library</OutputType>
+ <ProjectTypeGuids>{4948E98A-ECFC-4988-851E-68E1ADD2DD5A};{B850CC46-E8FB-4569-A28D-423F81E8A861}</ProjectTypeGuids>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="AssemblyContracts.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Interop/COM/NativeClients/Primitives.csproj b/tests/src/Interop/COM/NativeClients/Primitives.csproj
index 2aa9343ffd..305f1048b3 100644
--- a/tests/src/Interop/COM/NativeClients/Primitives.csproj
+++ b/tests/src/Interop/COM/NativeClients/Primitives.csproj
@@ -14,8 +14,9 @@
<Compile Include="$(InteropCommonDir)ExeLauncherProgram.cs" />
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="Primitives/CMakeLists.txt"/>
+ <ProjectReference Include="Primitives/CMakeLists.txt" />
<ProjectReference Include="../NetServer/NetServer.csproj" />
+ <ProjectReference Include="../../../Common/hostpolicymock/CMakeLists.txt" />
<ProjectReference Include="../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
diff --git a/tests/src/Interop/COM/NativeClients/Primitives/ArrayTests.cpp b/tests/src/Interop/COM/NativeClients/Primitives/ArrayTests.cpp
index 1bbdc10ad8..2e57bb9127 100644
--- a/tests/src/Interop/COM/NativeClients/Primitives/ArrayTests.cpp
+++ b/tests/src/Interop/COM/NativeClients/Primitives/ArrayTests.cpp
@@ -299,7 +299,7 @@ void Run_ArrayTests()
{
HRESULT hr;
- CoreShimComActivation csact{ W("NETServer.dll"), W("ArrayTesting") };
+ CoreShimComActivation csact{ W("NETServer"), W("ArrayTesting") };
ComSmartPtr<IArrayTesting> arrayTesting;
THROW_IF_FAILED(::CoCreateInstance(CLSID_ArrayTesting, nullptr, CLSCTX_INPROC, IID_IArrayTesting, (void**)&arrayTesting));
diff --git a/tests/src/Interop/COM/NativeClients/Primitives/ColorTests.cpp b/tests/src/Interop/COM/NativeClients/Primitives/ColorTests.cpp
index ab95740e43..9ce8a8010c 100644
--- a/tests/src/Interop/COM/NativeClients/Primitives/ColorTests.cpp
+++ b/tests/src/Interop/COM/NativeClients/Primitives/ColorTests.cpp
@@ -34,7 +34,7 @@ void Run_ColorTests()
{
HRESULT hr;
- CoreShimComActivation csact{ W("NETServer.dll"), W("ColorTesting") };
+ CoreShimComActivation csact{ W("NETServer"), W("ColorTesting") };
ComSmartPtr<IColorTesting> color;
THROW_IF_FAILED(::CoCreateInstance(CLSID_ColorTesting, nullptr, CLSCTX_INPROC, IID_IColorTesting, (void**)&color));
diff --git a/tests/src/Interop/COM/NativeClients/Primitives/ErrorTests.cpp b/tests/src/Interop/COM/NativeClients/Primitives/ErrorTests.cpp
index 7e40716ce9..1708aca2e1 100644
--- a/tests/src/Interop/COM/NativeClients/Primitives/ErrorTests.cpp
+++ b/tests/src/Interop/COM/NativeClients/Primitives/ErrorTests.cpp
@@ -58,7 +58,7 @@ void Run_ErrorTests()
{
HRESULT hr;
- CoreShimComActivation csact{ W("NETServer.dll"), W("ErrorMarshalTesting") };
+ CoreShimComActivation csact{ W("NETServer"), W("ErrorMarshalTesting") };
ComSmartPtr<IErrorMarshalTesting> errorMarshal;
THROW_IF_FAILED(::CoCreateInstance(CLSID_ErrorMarshalTesting, nullptr, CLSCTX_INPROC, IID_IErrorMarshalTesting, (void**)&errorMarshal));
diff --git a/tests/src/Interop/COM/NativeClients/Primitives/NumericTests.cpp b/tests/src/Interop/COM/NativeClients/Primitives/NumericTests.cpp
index a9af9569de..c951c8c527 100644
--- a/tests/src/Interop/COM/NativeClients/Primitives/NumericTests.cpp
+++ b/tests/src/Interop/COM/NativeClients/Primitives/NumericTests.cpp
@@ -222,7 +222,7 @@ void Run_NumericTests()
{
HRESULT hr;
- CoreShimComActivation csact{ W("NETServer.dll"), W("NumericTesting") };
+ CoreShimComActivation csact{ W("NETServer"), W("NumericTesting") };
ComSmartPtr<INumericTesting> numericTesting;
THROW_IF_FAILED(::CoCreateInstance(CLSID_NumericTesting, nullptr, CLSCTX_INPROC, IID_INumericTesting, (void**)&numericTesting));
diff --git a/tests/src/Interop/COM/NativeClients/Primitives/StringTests.cpp b/tests/src/Interop/COM/NativeClients/Primitives/StringTests.cpp
index 96a713faff..b003130d48 100644
--- a/tests/src/Interop/COM/NativeClients/Primitives/StringTests.cpp
+++ b/tests/src/Interop/COM/NativeClients/Primitives/StringTests.cpp
@@ -412,7 +412,7 @@ void Run_StringTests()
{
HRESULT hr;
- CoreShimComActivation csact{ W("NETServer.dll"), W("StringTesting") };
+ CoreShimComActivation csact{ W("NETServer"), W("StringTesting") };
ComSmartPtr<IStringTesting> stringTesting;
THROW_IF_FAILED(::CoCreateInstance(CLSID_StringTesting, nullptr, CLSCTX_INPROC, IID_IStringTesting, (void**)&stringTesting));
diff --git a/tests/src/Interop/ExecInDefAppDom/ExecInDefAppDom.csproj b/tests/src/Interop/ExecInDefAppDom/ExecInDefAppDom.csproj
index 5f170492fb..7725f2f830 100644
--- a/tests/src/Interop/ExecInDefAppDom/ExecInDefAppDom.csproj
+++ b/tests/src/Interop/ExecInDefAppDom/ExecInDefAppDom.csproj
@@ -1,7 +1,6 @@
<?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" />
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Interop.settings.targets))\Interop.settings.targets" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -14,6 +13,8 @@
<DefineConstants>$(DefineConstants);STATIC</DefineConstants>
<ReferenceSystemPrivateCoreLib>true</ReferenceSystemPrivateCoreLib>
</PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Interop.settings.targets))\Interop.settings.targets" />
+
<!-- Default configurations to help VS understand the configurations -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"></PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"></PropertyGroup>
diff --git a/tests/src/Interop/Interop.settings.targets b/tests/src/Interop/Interop.settings.targets
index e16b1300b7..fc906f200d 100644
--- a/tests/src/Interop/Interop.settings.targets
+++ b/tests/src/Interop/Interop.settings.targets
@@ -6,16 +6,22 @@
<!-- Environment properties -->
<PropertyGroup>
+ <DefineConstants Condition="'$(ReferenceSystemPrivateCoreLib)' == 'true'">$(DefineConstants);REFERENCING_SYSTEMPRIVATECORELIB</DefineConstants>
</PropertyGroup>
- <!-- Required source files -->
- <ItemGroup>
- <ProjectReference
- Condition="('$(IgnoreCoreCLRTestLibraryDependency)' != 'true') And ('$(ReferenceSystemPrivateCoreLib)' != 'true')"
+ <!-- Add the CoreCLRTestLibrary dependency -->
+ <ItemGroup Condition="('$(IgnoreCoreCLRTestLibraryDependency)' != 'true') And ('$(ReferenceSystemPrivateCoreLib)' != 'true')">
+ <ProjectReference
Include="$(MSBuildThisFileDirectory)\..\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj" />
- <Compile
- Condition="('$(IgnoreCoreCLRTestLibraryDependency)' != 'true') And ('$(ReferenceSystemPrivateCoreLib)' == 'true')"
- Include="$(MSBuildThisFileDirectory)\..\Common\CoreCLRTestLibrary\Assertion.cs" />
+ </ItemGroup>
+
+ <!-- Add the CoreCLRTestLibrary dependency
+ If a target project references System.Private.Corelib, we are unable to reference CoreCLRTestLibrary.
+ Compile in relevant files used for testing interop. -->
+ <ItemGroup Condition="('$(IgnoreCoreCLRTestLibraryDependency)' != 'true') And ('$(ReferenceSystemPrivateCoreLib)' == 'true')">
+ <Compile Include="$(MSBuildThisFileDirectory)\..\Common\CoreCLRTestLibrary\Assertion.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)\..\Common\CoreCLRTestLibrary\HostPolicyMock.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)\..\Common\CoreCLRTestLibrary\XPlatformUtils.cs" />
</ItemGroup>
<!-- Required debug vcruntime and UCRT dlls -->
diff --git a/tests/src/Interop/NativeCallable/NativeCallableTest.csproj b/tests/src/Interop/NativeCallable/NativeCallableTest.csproj
index 689e1244f1..59cbe9dc06 100644
--- a/tests/src/Interop/NativeCallable/NativeCallableTest.csproj
+++ b/tests/src/Interop/NativeCallable/NativeCallableTest.csproj
@@ -1,7 +1,6 @@
<?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" />
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Interop.settings.targets))\Interop.settings.targets" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -15,6 +14,8 @@
<ReferenceSystemPrivateCoreLib>true</ReferenceSystemPrivateCoreLib>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Interop.settings.targets))\Interop.settings.targets" />
+
<!-- Default configurations to help VS understand the configurations -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"></PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"></PropertyGroup>
diff --git a/tests/src/Interop/PInvoke/CustomMarshalers/CustomMarshalersTest.csproj b/tests/src/Interop/PInvoke/CustomMarshalers/CustomMarshalersTest.csproj
index f92a77879f..dd3ac5e21e 100644
--- a/tests/src/Interop/PInvoke/CustomMarshalers/CustomMarshalersTest.csproj
+++ b/tests/src/Interop/PInvoke/CustomMarshalers/CustomMarshalersTest.csproj
@@ -1,7 +1,6 @@
<?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" />
- <Import Project="../../Interop.settings.targets" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -19,6 +18,8 @@
<TestUnsupportedOutsideWindows>true</TestUnsupportedOutsideWindows>
<DisableProjectBuild Condition="'$(TargetsUnix)' == 'true'">true</DisableProjectBuild>
</PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Interop.settings.targets))\Interop.settings.targets" />
+
<!-- Default configurations to help VS understand the configurations -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"></PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"></PropertyGroup>
diff --git a/tests/src/Loader/AssemblyDependencyResolverTests/AssemblyDependencyResolverTests.cs b/tests/src/Loader/AssemblyDependencyResolverTests/AssemblyDependencyResolverTests.cs
index 9499bee724..3e74a6627d 100644
--- a/tests/src/Loader/AssemblyDependencyResolverTests/AssemblyDependencyResolverTests.cs
+++ b/tests/src/Loader/AssemblyDependencyResolverTests/AssemblyDependencyResolverTests.cs
@@ -5,8 +5,11 @@ using System;
using System.IO;
using System.Reflection;
using System.Runtime.Loader;
+using TestLibrary;
using Xunit;
+using Assert = Xunit.Assert;
+
namespace AssemblyDependencyResolverTests
{
class AssemblyDependencyResolverTests : TestBase
@@ -38,8 +41,8 @@ namespace AssemblyDependencyResolverTests
using (HostPolicyMock.MockValues_corehost_set_error_writer errorWriterMock =
HostPolicyMock.Mock_corehost_set_error_writer())
{
- using (HostPolicyMock.MockValues_corehost_resolve_componet_dependencies resolverMock =
- HostPolicyMock.Mock_corehost_resolve_componet_dependencies(
+ using (HostPolicyMock.MockValues_corehost_resolve_component_dependencies resolverMock =
+ HostPolicyMock.Mock_corehost_resolve_component_dependencies(
134,
"",
"",
@@ -79,8 +82,8 @@ namespace AssemblyDependencyResolverTests
using (HostPolicyMock.MockValues_corehost_set_error_writer errorWriterMock =
HostPolicyMock.Mock_corehost_set_error_writer(previousWriter))
{
- using (HostPolicyMock.MockValues_corehost_resolve_componet_dependencies resolverMock =
- HostPolicyMock.Mock_corehost_resolve_componet_dependencies(
+ using (HostPolicyMock.MockValues_corehost_resolve_component_dependencies resolverMock =
+ HostPolicyMock.Mock_corehost_resolve_component_dependencies(
134,
"",
"",
@@ -108,7 +111,7 @@ namespace AssemblyDependencyResolverTests
using (HostPolicyMock.MockValues_corehost_set_error_writer errorWriterMock =
HostPolicyMock.Mock_corehost_set_error_writer(previousWriter))
{
- using (HostPolicyMock.Mock_corehost_resolve_componet_dependencies(
+ using (HostPolicyMock.Mock_corehost_resolve_component_dependencies(
0,
assemblyDependencyPath,
"",
@@ -131,7 +134,7 @@ namespace AssemblyDependencyResolverTests
{
// If the reqest is for assembly which is not listed in .deps.json
// the resolver should return null.
- using (HostPolicyMock.Mock_corehost_resolve_componet_dependencies(
+ using (HostPolicyMock.Mock_corehost_resolve_component_dependencies(
0,
"",
"",
@@ -148,7 +151,7 @@ namespace AssemblyDependencyResolverTests
{
// Even if the .deps.json can resolve the request, if the file is not present
// the resolution should still return null.
- using (HostPolicyMock.Mock_corehost_resolve_componet_dependencies(
+ using (HostPolicyMock.Mock_corehost_resolve_component_dependencies(
0,
Path.Combine(_componentDirectory, "NonExistingAssembly.dll"),
"",
@@ -164,7 +167,7 @@ namespace AssemblyDependencyResolverTests
public void TestSingleResource()
{
string enResourcePath = CreateMockAssembly($"en{Path.DirectorySeparatorChar}TestComponent.resources.dll");
- using (HostPolicyMock.Mock_corehost_resolve_componet_dependencies(
+ using (HostPolicyMock.Mock_corehost_resolve_component_dependencies(
0,
"",
"",
@@ -183,7 +186,7 @@ namespace AssemblyDependencyResolverTests
{
string enResourcePath = CreateMockAssembly($"en{Path.DirectorySeparatorChar}TestComponent.resources.dll");
string csResourcePath = CreateMockAssembly($"cs{Path.DirectorySeparatorChar}TestComponent.resources.dll");
- using (HostPolicyMock.Mock_corehost_resolve_componet_dependencies(
+ using (HostPolicyMock.Mock_corehost_resolve_component_dependencies(
0,
"",
"",
@@ -205,7 +208,7 @@ namespace AssemblyDependencyResolverTests
{
string enResourcePath = CreateMockAssembly($"en{Path.DirectorySeparatorChar}TestComponent.resources.dll");
string frResourcePath = CreateMockAssembly($"SubComponent{Path.DirectorySeparatorChar}fr{Path.DirectorySeparatorChar}TestComponent.resources.dll");
- using (HostPolicyMock.Mock_corehost_resolve_componet_dependencies(
+ using (HostPolicyMock.Mock_corehost_resolve_component_dependencies(
0,
"",
"",
@@ -226,7 +229,7 @@ namespace AssemblyDependencyResolverTests
public void TestAssemblyWithNeutralCulture()
{
string neutralAssemblyPath = CreateMockAssembly("NeutralAssembly.dll");
- using (HostPolicyMock.Mock_corehost_resolve_componet_dependencies(
+ using (HostPolicyMock.Mock_corehost_resolve_component_dependencies(
0,
neutralAssemblyPath,
"",
@@ -245,7 +248,7 @@ namespace AssemblyDependencyResolverTests
{
string nativeLibraryPath = CreateMockStandardNativeLibrary("native", "Single");
- using (HostPolicyMock.Mock_corehost_resolve_componet_dependencies(
+ using (HostPolicyMock.Mock_corehost_resolve_component_dependencies(
0,
"",
Path.GetDirectoryName(nativeLibraryPath),
@@ -265,7 +268,7 @@ namespace AssemblyDependencyResolverTests
string oneNativeLibraryPath = CreateMockStandardNativeLibrary($"native{Path.DirectorySeparatorChar}one", "One");
string twoNativeLibraryPath = CreateMockStandardNativeLibrary($"native{Path.DirectorySeparatorChar}two", "Two");
- using (HostPolicyMock.Mock_corehost_resolve_componet_dependencies(
+ using (HostPolicyMock.Mock_corehost_resolve_component_dependencies(
0,
"",
$"{Path.GetDirectoryName(oneNativeLibraryPath)}{Path.PathSeparator}{Path.GetDirectoryName(twoNativeLibraryPath)}",
diff --git a/tests/src/Loader/AssemblyDependencyResolverTests/AssemblyDependencyResolverTests.csproj b/tests/src/Loader/AssemblyDependencyResolverTests/AssemblyDependencyResolverTests.csproj
index c8ba654dcf..e2dd0a4df3 100644
--- a/tests/src/Loader/AssemblyDependencyResolverTests/AssemblyDependencyResolverTests.csproj
+++ b/tests/src/Loader/AssemblyDependencyResolverTests/AssemblyDependencyResolverTests.csproj
@@ -11,20 +11,15 @@
<!-- The test fails if ran twice in the same process. In one of the test cases, it expects a hostpolicy to not to be found, but it actually is found in the second pass -->
<UnloadabilityIncompatible>true</UnloadabilityIncompatible>
</PropertyGroup>
- <PropertyGroup>
- <DefineConstants Condition="$(OSGroup) == 'Windows_NT'">WINDOWS</DefineConstants>
- <DefineConstants Condition="$(OSGroup) == 'OSX'">OSX</DefineConstants>
- </PropertyGroup>
<ItemGroup>
<Compile Include="AssemblyDependencyResolverTests.cs" />
- <Compile Include="HostPolicyMock.cs" />
<Compile Include="InvalidHostingTest.cs" />
<Compile Include="NativeDependencyTests.cs" />
<Compile Include="TestBase.cs" />
- <Compile Include="XPlatformUtils.cs" />
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="CMakeLists.txt" />
+ <ProjectReference Include="../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ <ProjectReference Include="../../Common/hostpolicymock/CMakeLists.txt" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>
diff --git a/tests/src/Loader/AssemblyDependencyResolverTests/InvalidHostingTest.cs b/tests/src/Loader/AssemblyDependencyResolverTests/InvalidHostingTest.cs
index c51b055e07..d1fc56ecf4 100644
--- a/tests/src/Loader/AssemblyDependencyResolverTests/InvalidHostingTest.cs
+++ b/tests/src/Loader/AssemblyDependencyResolverTests/InvalidHostingTest.cs
@@ -4,8 +4,11 @@
using System;
using System.IO;
using System.Runtime.Loader;
+using TestLibrary;
using Xunit;
+using Assert = Xunit.Assert;
+
namespace AssemblyDependencyResolverTests
{
class InvalidHostingTest : TestBase
diff --git a/tests/src/Loader/AssemblyDependencyResolverTests/NativeDependencyTests.cs b/tests/src/Loader/AssemblyDependencyResolverTests/NativeDependencyTests.cs
index 43e721e45f..e7ac906e02 100644
--- a/tests/src/Loader/AssemblyDependencyResolverTests/NativeDependencyTests.cs
+++ b/tests/src/Loader/AssemblyDependencyResolverTests/NativeDependencyTests.cs
@@ -5,8 +5,11 @@ using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Runtime.Loader;
+using TestLibrary;
using Xunit;
+using Assert = Xunit.Assert;
+
namespace AssemblyDependencyResolverTests
{
class NativeDependencyTests : TestBase
@@ -258,7 +261,7 @@ namespace AssemblyDependencyResolverTests
string lookupName,
OS resolvesOnOSes)
{
- using (HostPolicyMock.Mock_corehost_resolve_componet_dependencies(
+ using (HostPolicyMock.Mock_corehost_resolve_component_dependencies(
0,
"",
$"{nativeLibraryPaths}",