From f532ff66c002eda55d22f0a1e0cf4a376be8e32a Mon Sep 17 00:00:00 2001 From: Elinor Fung Date: Thu, 25 Jan 2024 10:09:03 -0800 Subject: [PATCH] Move AppWithCustomEntryPoints ond ComponentWithNoDependencies to pre-built test assets (#97477) --- .../AppWithCustomEntryPoints.csproj | 3 - .../AppWithCustomEntryPoints/Program.cs | 0 .../Component}/Component.cs | 0 .../Component/Component.csproj} | 1 - .../NativeHosting/GetFunctionPointer.cs | 90 +++++++++---------- .../NativeHosting/LoadAssembly.cs | 27 ++---- .../LoadAssemblyAndGetFunctionPointer.cs | 83 ++++++++--------- 7 files changed, 87 insertions(+), 117 deletions(-) rename src/installer/tests/Assets/{TestProjects => Projects}/AppWithCustomEntryPoints/AppWithCustomEntryPoints.csproj (51%) rename src/installer/tests/Assets/{TestProjects => Projects}/AppWithCustomEntryPoints/Program.cs (100%) rename src/installer/tests/Assets/{TestProjects/ComponentWithNoDependencies => Projects/Component}/Component.cs (100%) rename src/installer/tests/Assets/{TestProjects/ComponentWithNoDependencies/ComponentWithNoDependencies.csproj => Projects/Component/Component.csproj} (74%) diff --git a/src/installer/tests/Assets/TestProjects/AppWithCustomEntryPoints/AppWithCustomEntryPoints.csproj b/src/installer/tests/Assets/Projects/AppWithCustomEntryPoints/AppWithCustomEntryPoints.csproj similarity index 51% rename from src/installer/tests/Assets/TestProjects/AppWithCustomEntryPoints/AppWithCustomEntryPoints.csproj rename to src/installer/tests/Assets/Projects/AppWithCustomEntryPoints/AppWithCustomEntryPoints.csproj index eb74b5d558056..e71444bd29bbf 100644 --- a/src/installer/tests/Assets/TestProjects/AppWithCustomEntryPoints/AppWithCustomEntryPoints.csproj +++ b/src/installer/tests/Assets/Projects/AppWithCustomEntryPoints/AppWithCustomEntryPoints.csproj @@ -3,9 +3,6 @@ $(NetCoreAppCurrent) Exe - $(TestTargetRid) - $(MNAVersion) - true diff --git a/src/installer/tests/Assets/TestProjects/AppWithCustomEntryPoints/Program.cs b/src/installer/tests/Assets/Projects/AppWithCustomEntryPoints/Program.cs similarity index 100% rename from src/installer/tests/Assets/TestProjects/AppWithCustomEntryPoints/Program.cs rename to src/installer/tests/Assets/Projects/AppWithCustomEntryPoints/Program.cs diff --git a/src/installer/tests/Assets/TestProjects/ComponentWithNoDependencies/Component.cs b/src/installer/tests/Assets/Projects/Component/Component.cs similarity index 100% rename from src/installer/tests/Assets/TestProjects/ComponentWithNoDependencies/Component.cs rename to src/installer/tests/Assets/Projects/Component/Component.cs diff --git a/src/installer/tests/Assets/TestProjects/ComponentWithNoDependencies/ComponentWithNoDependencies.csproj b/src/installer/tests/Assets/Projects/Component/Component.csproj similarity index 74% rename from src/installer/tests/Assets/TestProjects/ComponentWithNoDependencies/ComponentWithNoDependencies.csproj rename to src/installer/tests/Assets/Projects/Component/Component.csproj index 3359763582dc9..f5256336d2053 100644 --- a/src/installer/tests/Assets/TestProjects/ComponentWithNoDependencies/ComponentWithNoDependencies.csproj +++ b/src/installer/tests/Assets/Projects/Component/Component.csproj @@ -2,7 +2,6 @@ $(NetCoreAppCurrent) - $(MNAVersion) true diff --git a/src/installer/tests/HostActivation.Tests/NativeHosting/GetFunctionPointer.cs b/src/installer/tests/HostActivation.Tests/NativeHosting/GetFunctionPointer.cs index 06a03e5d7e812..4c99262a548f2 100644 --- a/src/installer/tests/HostActivation.Tests/NativeHosting/GetFunctionPointer.cs +++ b/src/installer/tests/HostActivation.Tests/NativeHosting/GetFunctionPointer.cs @@ -1,12 +1,10 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using Microsoft.DotNet.Cli.Build.Framework; -using System; using System.Collections.Generic; -using System.IO; using System.Linq; -using System.Runtime.InteropServices; + +using Microsoft.DotNet.Cli.Build.Framework; using Xunit; namespace Microsoft.DotNet.CoreSetup.Test.HostActivation.NativeHosting @@ -29,26 +27,26 @@ public GetFunctionPointer(SharedTestState sharedTestState) [InlineData(true, false)] public void CallDelegateOnApplicationContext(bool validType, bool validMethod) { - var appProject = sharedState.ApplicationFixture.TestProject; + var app = sharedState.App; string[] args = { AppGetFunctionPointerArg, sharedState.HostFxrPath, - appProject.AppDll, - validType ? sharedState.FunctionPointerTypeName : $"Component.BadType, {appProject.AssemblyName}", + app.AppDll, + validType ? sharedState.FunctionPointerTypeName : $"Component.BadType, {app.AssemblyName}", validMethod ? sharedState.FunctionPointerEntryPoint1 : "BadMethod", }; CommandResult result = sharedState.CreateNativeHostCommand(args, sharedState.DotNetRoot) .Execute(); result.Should() - .InitializeContextForApp(appProject.AppDll); + .InitializeContextForApp(app.AppDll); if (validType && validMethod) { result.Should().Pass() .And.ExecuteFunctionPointer(sharedState.FunctionPointerEntryPoint1, 1, 1) - .And.ExecuteInDefaultContext(appProject.AssemblyName); + .And.ExecuteInDefaultContext(app.AssemblyName); } else { @@ -62,20 +60,20 @@ public void CallDelegateOnApplicationContext(bool validType, bool validMethod) [InlineData(true, false)] public void CallDelegateOnComponentContext(bool validType, bool validMethod) { - var componentProject = sharedState.ComponentWithNoDependenciesFixture.TestProject; + var component = sharedState.Component; string[] args = { ComponentGetFunctionPointerArg, sharedState.HostFxrPath, - componentProject.RuntimeConfigJson, - validType ? sharedState.ComponentTypeName : $"Component.BadType, {componentProject.AssemblyName}", + component.RuntimeConfigJson, + validType ? sharedState.ComponentTypeName : $"Component.BadType, {component.AssemblyName}", validMethod ? sharedState.ComponentEntryPoint1 : "BadMethod", }; CommandResult result = sharedState.CreateNativeHostCommand(args, sharedState.DotNetRoot) .Execute(); result.Should() - .InitializeContextForConfig(componentProject.RuntimeConfigJson); + .InitializeContextForConfig(component.RuntimeConfigJson); // This should fail even with the valid type and valid method, // because the type is not resolvable from the default AssemblyLoadContext. @@ -85,12 +83,12 @@ public void CallDelegateOnComponentContext(bool validType, bool validMethod) [Fact] public void CallDelegateOnSelfContainedApplicationContext() { - var appProject = sharedState.SelfContainedApplicationFixture.TestProject; + var app = sharedState.SelfContainedApp; string[] args = { AppGetFunctionPointerArg, - appProject.HostFxrDll, - appProject.AppDll, + app.HostFxrDll, + app.AppDll, sharedState.FunctionPointerTypeName, sharedState.FunctionPointerEntryPoint1, }; @@ -98,9 +96,9 @@ public void CallDelegateOnSelfContainedApplicationContext() .Execute(); result.Should().Pass() - .And.InitializeContextForApp(appProject.AppDll) + .And.InitializeContextForApp(app.AppDll) .And.ExecuteFunctionPointer(sharedState.FunctionPointerEntryPoint1, 1, 1) - .And.ExecuteInDefaultContext(appProject.AssemblyName); + .And.ExecuteInDefaultContext(app.AssemblyName); } [Theory] @@ -110,12 +108,12 @@ public void CallDelegateOnSelfContainedApplicationContext() [InlineData(10, true)] public void CallDelegateOnApplicationContext_MultipleEntryPoints(int callCount, bool callUnmanaged) { - var appProject = sharedState.ApplicationFixture.TestProject; + var app = sharedState.App; string[] baseArgs = { AppGetFunctionPointerArg, sharedState.HostFxrPath, - appProject.AppDll, + app.AppDll, }; string functionPointer1Name = callUnmanaged ? sharedState.UnmanagedFunctionPointerEntryPoint1 : sharedState.FunctionPointerEntryPoint1; @@ -139,8 +137,8 @@ public void CallDelegateOnApplicationContext_MultipleEntryPoints(int callCount, .Execute(); result.Should().Pass() - .And.InitializeContextForApp(appProject.AppDll) - .And.ExecuteInDefaultContext(appProject.AssemblyName); + .And.InitializeContextForApp(app.AppDll) + .And.ExecuteInDefaultContext(app.AssemblyName); for (int i = 1; i <= callCount; ++i) { @@ -155,12 +153,12 @@ public void CallDelegateOnApplicationContext_MultipleEntryPoints(int callCount, [InlineData(10)] public void CallDelegateOnApplicationContext_MultipleFunctionPointers(int callCount) { - var appProject = sharedState.ApplicationFixture.TestProject; + var app = sharedState.App; string[] baseArgs = { AppGetFunctionPointerArg, sharedState.HostFxrPath, - appProject.AppDll, + app.AppDll, }; string[] componentInfo = { @@ -181,8 +179,8 @@ public void CallDelegateOnApplicationContext_MultipleFunctionPointers(int callCo .Execute(); result.Should().Pass() - .And.InitializeContextForApp(appProject.AppDll) - .And.ExecuteInDefaultContext(appProject.AssemblyName); + .And.InitializeContextForApp(app.AppDll) + .And.ExecuteInDefaultContext(app.AssemblyName); for (int i = 1; i <= callCount; ++i) { @@ -196,12 +194,12 @@ public void CallDelegateOnApplicationContext_MultipleFunctionPointers(int callCo public void CallDelegateOnApplicationContext_UnhandledException() { string entryPoint = "ThrowException"; - var appProject = sharedState.ApplicationFixture.TestProject; + var app = sharedState.App; string[] args = { AppGetFunctionPointerArg, sharedState.HostFxrPath, - appProject.AppDll, + app.AppDll, sharedState.FunctionPointerTypeName, entryPoint, }; @@ -209,7 +207,7 @@ public void CallDelegateOnApplicationContext_UnhandledException() sharedState.CreateNativeHostCommand(args, sharedState.DotNetRoot) .Execute(expectedToFail: true) .Should().Fail() - .And.InitializeContextForApp(appProject.AppDll) + .And.InitializeContextForApp(app.AppDll) .And.ExecuteFunctionPointerWithException(entryPoint, 1); } @@ -218,9 +216,10 @@ public class SharedTestState : SharedTestStateBase public string HostFxrPath { get; } public string DotNetRoot { get; } - public TestProjectFixture ApplicationFixture { get; } - public TestProjectFixture ComponentWithNoDependenciesFixture { get; } - public TestProjectFixture SelfContainedApplicationFixture { get; } + public TestApp App { get; } + public TestApp Component { get; } + public TestApp SelfContainedApp { get; } + public string ComponentTypeName { get; } public string ComponentEntryPoint1 => "ComponentEntryPoint1"; public string FunctionPointerTypeName { get; } @@ -233,27 +232,20 @@ public SharedTestState() DotNetRoot = TestContext.BuiltDotNet.BinPath; HostFxrPath = TestContext.BuiltDotNet.GreatestVersionHostFxrFilePath; - ApplicationFixture = new TestProjectFixture("AppWithCustomEntryPoints", RepoDirectories) - .EnsureRestored() - .PublishProject(selfContained: false); - ComponentWithNoDependenciesFixture = new TestProjectFixture("ComponentWithNoDependencies", RepoDirectories) - .EnsureRestored() - .PublishProject(); - SelfContainedApplicationFixture = new TestProjectFixture("AppWithCustomEntryPoints", RepoDirectories) - .EnsureRestored() - .PublishProject(selfContained: true); - ComponentTypeName = $"Component.Component, {ComponentWithNoDependenciesFixture.TestProject.AssemblyName}"; - FunctionPointerTypeName = $"AppWithCustomEntryPoints.Program, {ApplicationFixture.TestProject.AssemblyName}"; + App = TestApp.CreateFromBuiltAssets("AppWithCustomEntryPoints"); + Component = TestApp.CreateFromBuiltAssets("Component"); + SelfContainedApp = TestApp.CreateFromBuiltAssets("AppWithCustomEntryPoints"); + SelfContainedApp.PopulateSelfContained(TestApp.MockedComponent.None); + + ComponentTypeName = $"Component.Component, {Component.AssemblyName}"; + FunctionPointerTypeName = $"AppWithCustomEntryPoints.Program, {App.AssemblyName}"; } protected override void Dispose(bool disposing) { - if (ApplicationFixture != null) - ApplicationFixture.Dispose(); - if (ComponentWithNoDependenciesFixture != null) - ComponentWithNoDependenciesFixture.Dispose(); - if (SelfContainedApplicationFixture != null) - SelfContainedApplicationFixture.Dispose(); + App?.Dispose(); + Component?.Dispose(); + SelfContainedApp?.Dispose(); base.Dispose(disposing); } diff --git a/src/installer/tests/HostActivation.Tests/NativeHosting/LoadAssembly.cs b/src/installer/tests/HostActivation.Tests/NativeHosting/LoadAssembly.cs index e3df507f4dbf7..ec221d3f95203 100644 --- a/src/installer/tests/HostActivation.Tests/NativeHosting/LoadAssembly.cs +++ b/src/installer/tests/HostActivation.Tests/NativeHosting/LoadAssembly.cs @@ -1,12 +1,11 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using Microsoft.DotNet.Cli.Build.Framework; -using System; using System.Collections.Generic; using System.IO; using System.Linq; -using System.Runtime.InteropServices; + +using Microsoft.DotNet.Cli.Build.Framework; using Xunit; namespace Microsoft.DotNet.CoreSetup.Test.HostActivation.NativeHosting @@ -139,11 +138,9 @@ public class SharedTestState : SharedTestStateBase public string DotNetRoot { get; } public TestApp Application { get; } + public TestApp Component { get; } public TestApp SelfContainedApplication { get; } - public TestProjectFixture ComponentWithNoDependenciesFixture { get; } - public TestApp Component => ComponentWithNoDependenciesFixture.TestProject.BuiltApp; - public string ComponentTypeName { get; } public string ComponentEntryPoint1 => "ComponentEntryPoint1"; @@ -158,11 +155,8 @@ public SharedTestState() SelfContainedApplication = TestApp.CreateEmpty("SelfContainedApp"); SelfContainedApplication.PopulateSelfContained(TestApp.MockedComponent.None); - ComponentWithNoDependenciesFixture = new TestProjectFixture("ComponentWithNoDependencies", RepoDirectories) - .EnsureRestored() - .PublishProject(); - - ComponentTypeName = $"Component.Component, {ComponentWithNoDependenciesFixture.TestProject.AssemblyName}"; + Component = TestApp.CreateFromBuiltAssets("Component"); + ComponentTypeName = $"Component.Component, {Component.AssemblyName}"; } internal IEnumerable GetComponentLoadArgs(bool loadAssemblyBytes, bool loadSymbolBytes) @@ -178,14 +172,9 @@ internal IEnumerable GetComponentLoadArgs(bool loadAssemblyBytes, bool l protected override void Dispose(bool disposing) { - if (Application != null) - Application.Dispose(); - - if (SelfContainedApplication != null) - SelfContainedApplication.Dispose(); - - if (ComponentWithNoDependenciesFixture != null) - ComponentWithNoDependenciesFixture.Dispose(); + Application?.Dispose(); + Component?.Dispose(); + SelfContainedApplication?.Dispose(); base.Dispose(disposing); } diff --git a/src/installer/tests/HostActivation.Tests/NativeHosting/LoadAssemblyAndGetFunctionPointer.cs b/src/installer/tests/HostActivation.Tests/NativeHosting/LoadAssemblyAndGetFunctionPointer.cs index 5d4217ef587bc..39cdc5edb4ca3 100644 --- a/src/installer/tests/HostActivation.Tests/NativeHosting/LoadAssemblyAndGetFunctionPointer.cs +++ b/src/installer/tests/HostActivation.Tests/NativeHosting/LoadAssemblyAndGetFunctionPointer.cs @@ -1,12 +1,10 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using Microsoft.DotNet.Cli.Build.Framework; -using System; using System.Collections.Generic; -using System.IO; using System.Linq; -using System.Runtime.InteropServices; + +using Microsoft.DotNet.Cli.Build.Framework; using Xunit; namespace Microsoft.DotNet.CoreSetup.Test.HostActivation.NativeHosting @@ -30,27 +28,27 @@ public LoadAssemblyAndGetFunctionPointer(SharedTestState sharedTestState) [InlineData(true, true, false)] public void CallDelegateOnComponentContext(bool validPath, bool validType, bool validMethod) { - var componentProject = sharedState.ComponentWithNoDependenciesFixture.TestProject; + var component = sharedState.Component; string[] args = { ComponentLoadAssemblyAndGetFunctionPointerArg, sharedState.HostFxrPath, - componentProject.RuntimeConfigJson, - validPath ? componentProject.AppDll : "BadPath...", - validType ? sharedState.ComponentTypeName : $"Component.BadType, {componentProject.AssemblyName}", + component.RuntimeConfigJson, + validPath ? component.AppDll : "BadPath...", + validType ? sharedState.ComponentTypeName : $"Component.BadType, {component.AssemblyName}", validMethod ? sharedState.ComponentEntryPoint1 : "BadMethod", }; CommandResult result = sharedState.CreateNativeHostCommand(args, sharedState.DotNetRoot) .Execute(); result.Should() - .InitializeContextForConfig(componentProject.RuntimeConfigJson); + .InitializeContextForConfig(component.RuntimeConfigJson); if (validPath && validType && validMethod) { result.Should().Pass() .And.ExecuteFunctionPointer(sharedState.ComponentEntryPoint1, 1, 1) - .And.ExecuteInIsolatedContext(componentProject.AssemblyName); + .And.ExecuteInIsolatedContext(component.AssemblyName); } else { @@ -66,14 +64,14 @@ public void CallDelegateOnComponentContext(bool validPath, bool validType, bool public void CallDelegateOnApplicationContext(bool validPath, bool validType, bool validMethod) { var app = sharedState.FrameworkDependentApp; - var componentProject = sharedState.ComponentWithNoDependenciesFixture.TestProject; + var component = sharedState.Component; string[] args = { AppLoadAssemblyAndGetFunctionPointerArg, sharedState.HostFxrPath, app.AppDll, - validPath ? componentProject.AppDll : "BadPath...", - validType ? sharedState.ComponentTypeName : $"Component.BadType, {componentProject.AssemblyName}", + validPath ? component.AppDll : "BadPath...", + validType ? sharedState.ComponentTypeName : $"Component.BadType, {component.AssemblyName}", validMethod ? sharedState.ComponentEntryPoint1 : "BadMethod", }; CommandResult result = sharedState.CreateNativeHostCommand(args, sharedState.DotNetRoot) @@ -86,7 +84,7 @@ public void CallDelegateOnApplicationContext(bool validPath, bool validType, boo { result.Should().Pass() .And.ExecuteFunctionPointer(sharedState.ComponentEntryPoint1, 1, 1) - .And.ExecuteInIsolatedContext(componentProject.AssemblyName); + .And.ExecuteInIsolatedContext(component.AssemblyName); } else { @@ -98,24 +96,23 @@ public void CallDelegateOnApplicationContext(bool validPath, bool validType, boo public void CallDelegateOnSelfContainedApplicationContext() { var app = sharedState.SelfContainedApp; - var componentProject = sharedState.ComponentWithNoDependenciesFixture.TestProject; + var component = sharedState.Component; string[] args = { AppLoadAssemblyAndGetFunctionPointerArg, app.HostFxrDll, app.AppDll, - componentProject.AppDll, + component.AppDll, sharedState.ComponentTypeName, sharedState.ComponentEntryPoint1, }; CommandResult result = sharedState.CreateNativeHostCommand(args, sharedState.DotNetRoot) .Execute(); - result.Should() - .InitializeContextForApp(app.AppDll) - .And.Pass() + result.Should().Pass() + .And.InitializeContextForApp(app.AppDll) .And.ExecuteFunctionPointer(sharedState.ComponentEntryPoint1, 1, 1) - .And.ExecuteInIsolatedContext(componentProject.AssemblyName); + .And.ExecuteInIsolatedContext(component.AssemblyName); } [Theory] @@ -125,23 +122,23 @@ public void CallDelegateOnSelfContainedApplicationContext() [InlineData(10, true)] public void CallDelegateOnComponentContext_MultipleEntryPoints(int callCount, bool callUnmanaged) { - var componentProject = sharedState.ComponentWithNoDependenciesFixture.TestProject; + var component = sharedState.Component; string[] baseArgs = { ComponentLoadAssemblyAndGetFunctionPointerArg, sharedState.HostFxrPath, - componentProject.RuntimeConfigJson, + component.RuntimeConfigJson, }; string comp1Name = callUnmanaged ? sharedState.UnmanagedComponentEntryPoint1 : sharedState.ComponentEntryPoint1; string[] componentInfo = { // [Unmanaged]ComponentEntryPoint1 - componentProject.AppDll, + component.AppDll, sharedState.ComponentTypeName, comp1Name, // ComponentEntryPoint2 - componentProject.AppDll, + component.AppDll, sharedState.ComponentTypeName, sharedState.ComponentEntryPoint2, }; @@ -156,8 +153,8 @@ public void CallDelegateOnComponentContext_MultipleEntryPoints(int callCount, bo .Execute(); result.Should().Pass() - .And.InitializeContextForConfig(componentProject.RuntimeConfigJson) - .And.ExecuteInIsolatedContext(componentProject.AssemblyName); + .And.InitializeContextForConfig(component.RuntimeConfigJson) + .And.ExecuteInIsolatedContext(component.AssemblyName); for (int i = 1; i <= callCount; ++i) { @@ -172,22 +169,22 @@ public void CallDelegateOnComponentContext_MultipleEntryPoints(int callCount, bo [InlineData(10)] public void CallDelegateOnComponentContext_MultipleComponents(int callCount) { - var componentProject = sharedState.ComponentWithNoDependenciesFixture.TestProject; - var componentProjectCopy = componentProject.Copy(); + var component = sharedState.Component; + var componentCopy = component.Copy(); string[] baseArgs = { ComponentLoadAssemblyAndGetFunctionPointerArg, sharedState.HostFxrPath, - componentProject.RuntimeConfigJson, + component.RuntimeConfigJson, }; string[] componentInfo = { // Component - componentProject.AppDll, + component.AppDll, sharedState.ComponentTypeName, sharedState.ComponentEntryPoint1, // Component copy - componentProjectCopy.AppDll, + componentCopy.AppDll, sharedState.ComponentTypeName, sharedState.ComponentEntryPoint2, }; @@ -201,8 +198,8 @@ public void CallDelegateOnComponentContext_MultipleComponents(int callCount) .Execute(); result.Should().Pass() - .And.InitializeContextForConfig(componentProject.RuntimeConfigJson) - .And.ExecuteInIsolatedContext(componentProject.AssemblyName); + .And.InitializeContextForConfig(component.RuntimeConfigJson) + .And.ExecuteInIsolatedContext(component.AssemblyName); for (int i = 1; i <= callCount; ++i) { @@ -216,13 +213,13 @@ public void CallDelegateOnComponentContext_MultipleComponents(int callCount) public void CallDelegateOnComponentContext_UnhandledException() { string entryPoint = "ThrowException"; - var componentProject = sharedState.ComponentWithNoDependenciesFixture.TestProject; + var component = sharedState.Component; string[] args = { ComponentLoadAssemblyAndGetFunctionPointerArg, sharedState.HostFxrPath, - componentProject.RuntimeConfigJson, - componentProject.AppDll, + component.RuntimeConfigJson, + component.AppDll, sharedState.ComponentTypeName, entryPoint, }; @@ -230,7 +227,7 @@ public void CallDelegateOnComponentContext_UnhandledException() sharedState.CreateNativeHostCommand(args, sharedState.DotNetRoot) .Execute(expectedToFail: true) .Should().Fail() - .And.InitializeContextForConfig(componentProject.RuntimeConfigJson) + .And.InitializeContextForConfig(component.RuntimeConfigJson) .And.ExecuteFunctionPointerWithException(entryPoint, 1); } @@ -239,7 +236,7 @@ public class SharedTestState : SharedTestStateBase public string HostFxrPath { get; } public string DotNetRoot { get; } - public TestProjectFixture ComponentWithNoDependenciesFixture { get; } + public TestApp Component { get; } public TestApp FrameworkDependentApp { get; } public TestApp SelfContainedApp { get; } @@ -253,23 +250,19 @@ public SharedTestState() DotNetRoot = TestContext.BuiltDotNet.BinPath; HostFxrPath = TestContext.BuiltDotNet.GreatestVersionHostFxrFilePath; - ComponentWithNoDependenciesFixture = new TestProjectFixture("ComponentWithNoDependencies", RepoDirectories) - .EnsureRestored() - .PublishProject(); + Component = TestApp.CreateFromBuiltAssets("Component"); FrameworkDependentApp = TestApp.CreateFromBuiltAssets("HelloWorld"); SelfContainedApp = TestApp.CreateFromBuiltAssets("HelloWorld"); SelfContainedApp.PopulateSelfContained(TestApp.MockedComponent.None); - ComponentTypeName = $"Component.Component, {ComponentWithNoDependenciesFixture.TestProject.AssemblyName}"; + ComponentTypeName = $"Component.Component, {Component.AssemblyName}"; } protected override void Dispose(bool disposing) { - if (ComponentWithNoDependenciesFixture != null) - ComponentWithNoDependenciesFixture.Dispose(); - + Component?.Dispose(); FrameworkDependentApp?.Dispose(); SelfContainedApp?.Dispose();