ExecInDefAppDom add InjectCode test
authorSteve MacLean <Steve.MacLean@microsoft.com>
Tue, 23 Oct 2018 19:35:36 +0000 (15:35 -0400)
committerSteve MacLean <stmaclea@microsoft.com>
Thu, 25 Oct 2018 17:21:48 +0000 (13:21 -0400)
tests/src/Interop/ExecInDefAppDom/ExecInDefAppDom.cs
tests/src/Interop/ExecInDefAppDom/ExecInDefAppDom.csproj
tests/src/Interop/ExecInDefAppDom/InjectedCode/InjectedCode.cs [new file with mode: 0644]
tests/src/Interop/ExecInDefAppDom/InjectedCode/InjectedCode.csproj [new file with mode: 0644]

index fe094fb..23bdbf5 100644 (file)
@@ -62,6 +62,7 @@ public class Program
     {
         int result = 100;
         String myPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
+        String injectedPath = System.IO.Path.GetDirectoryName(myPath) + "/InjectedCode.dll";
         String bogusPath = myPath + "random";
 
         const int S_OK = unchecked((int)0);
@@ -83,6 +84,7 @@ public class Program
         result += TestExecuteInAppDomain(myPath, "FakeInjectedCode", "ParseArgument", "0", S_OK, 0);
         result += TestExecuteInAppDomain(myPath, "FakeInjectedCode", "ParseArgument", "200", S_OK, 200);
         result += TestExecuteInAppDomain(myPath, "FakeInjectedCode", "ParseArgument", "None", COR_E_FORMAT, 0);
+        result += TestExecuteInAppDomain(injectedPath, "InjectedCode", "ParseArgument", "300", S_OK, 300);
 
         return result;
     }
index edbf53d..5f17049 100644 (file)
     <Compile Include="ExecInDefAppDom.cs" />
   </ItemGroup>
   <ItemGroup>
+    <ProjectReference Include="InjectedCode\InjectedCode.csproj">
+      <Project>{FD322A4C-EBCD-4322-90B7-35333EF2FE92}</Project>
+      <Name>InjectedCode</Name>
+    </ProjectReference>
     <!-- This is needed to make sure native binary gets installed in the right location -->
     <ProjectReference Include="CMakeLists.txt" />
   </ItemGroup>
diff --git a/tests/src/Interop/ExecInDefAppDom/InjectedCode/InjectedCode.cs b/tests/src/Interop/ExecInDefAppDom/InjectedCode/InjectedCode.cs
new file mode 100644 (file)
index 0000000..3870985
--- /dev/null
@@ -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 InjectedCode
+{
+    static int ParseArgument(String argument) { return int.Parse(argument);}
+}
\ No newline at end of file
diff --git a/tests/src/Interop/ExecInDefAppDom/InjectedCode/InjectedCode.csproj b/tests/src/Interop/ExecInDefAppDom/InjectedCode/InjectedCode.csproj
new file mode 100644 (file)
index 0000000..22e9498
--- /dev/null
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <AssemblyName>InjectedCode</AssemblyName>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{FD322A4C-EBCD-4322-90B7-35333EF2FE92}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+    <CLRTestKind>BuildOnly</CLRTestKind>
+    <DefineConstants>$(DefineConstants);$([System.String]::Copy('$(BuildArch)').ToUpper())</DefineConstants>
+    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+    <GenerateRunScript>false</GenerateRunScript>
+  </PropertyGroup>
+  <!-- Default configurations to help VS understand the configurations -->
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
+  </PropertyGroup>
+  <ItemGroup>
+    <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+      <Visible>False</Visible>
+    </CodeAnalysisDependentAssemblyPaths>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="InjectedCode.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+  </ItemGroup>
+  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>