From b0385fd92ab4ce84d34f173f931ad8a09af4fcc7 Mon Sep 17 00:00:00 2001 From: Mateo Torres Ruiz Date: Thu, 8 Jul 2021 14:26:12 -0700 Subject: [PATCH 1/5] Add property HOSTFXR_PATH --- .../TestProjects/RuntimeProperties/Program.cs | 7 ++++ .../HostActivation.Tests/RuntimeProperties.cs | 32 ++++++++++++------- src/native/corehost/hostpolicy/coreclr.cpp | 3 +- src/native/corehost/hostpolicy/coreclr.h | 1 + .../hostpolicy/hostpolicy_context.cpp | 10 ++++++ 5 files changed, 40 insertions(+), 13 deletions(-) diff --git a/src/installer/tests/Assets/TestProjects/RuntimeProperties/Program.cs b/src/installer/tests/Assets/TestProjects/RuntimeProperties/Program.cs index d22677aa617d8..cd180a4c9ec76 100644 --- a/src/installer/tests/Assets/TestProjects/RuntimeProperties/Program.cs +++ b/src/installer/tests/Assets/TestProjects/RuntimeProperties/Program.cs @@ -14,6 +14,13 @@ public static void Main(string[] args) foreach (string propertyName in args) { + var propertyValue = (string)System.AppContext.GetData(propertyName); + if (string.IsNullOrEmpty(propertyValue)) + { + Console.WriteLine($"Property '{propertyName}' was not found."); + continue; + } + Console.WriteLine($"AppContext.GetData({propertyName}) = {System.AppContext.GetData(propertyName)}"); } } diff --git a/src/installer/tests/HostActivation.Tests/RuntimeProperties.cs b/src/installer/tests/HostActivation.Tests/RuntimeProperties.cs index 6d8949c4132a5..6a42478a2ce0e 100644 --- a/src/installer/tests/HostActivation.Tests/RuntimeProperties.cs +++ b/src/installer/tests/HostActivation.Tests/RuntimeProperties.cs @@ -25,9 +25,7 @@ public void AppConfigProperty_AppCanGetData() var dotnet = fixture.BuiltDotnet; var appDll = fixture.TestProject.AppDll; dotnet.Exec(appDll, sharedState.AppTestPropertyName) - .EnvironmentVariable("COREHOST_TRACE", "1") - .CaptureStdErr() - .CaptureStdOut() + .EnableTracingAndCaptureOutputs() .Execute() .Should().Pass() .And.HaveStdErrContaining($"Property {sharedState.AppTestPropertyName} = {sharedState.AppTestPropertyValue}") @@ -43,9 +41,7 @@ public void FrameworkConfigProperty_AppCanGetData() var dotnet = fixture.BuiltDotnet; var appDll = fixture.TestProject.AppDll; dotnet.Exec(appDll, sharedState.FrameworkTestPropertyName) - .EnvironmentVariable("COREHOST_TRACE", "1") - .CaptureStdErr() - .CaptureStdOut() + .EnableTracingAndCaptureOutputs() .Execute() .Should().Pass() .And.HaveStdErrContaining($"Property {sharedState.FrameworkTestPropertyName} = {sharedState.FrameworkTestPropertyValue}") @@ -65,15 +61,28 @@ public void DuplicateConfigProperty_AppConfigValueUsed() var dotnet = fixture.BuiltDotnet; var appDll = fixture.TestProject.AppDll; dotnet.Exec(appDll, sharedState.FrameworkTestPropertyName) - .EnvironmentVariable("COREHOST_TRACE", "1") - .CaptureStdErr() - .CaptureStdOut() + .EnableTracingAndCaptureOutputs() .Execute() .Should().Pass() .And.HaveStdErrContaining($"Property {sharedState.FrameworkTestPropertyName} = {sharedState.AppTestPropertyValue}") .And.HaveStdOutContaining($"AppContext.GetData({sharedState.FrameworkTestPropertyName}) = {sharedState.AppTestPropertyValue}"); } + [Fact] + public void HostFxrPathProperty_NotVisibleFromApp() + { + var fixture = sharedState.RuntimePropertiesFixture + .Copy(); + + var dotnet = fixture.BuiltDotnet; + var appDll = fixture.TestProject.AppDll; + dotnet.Exec(appDll, sharedState.HostFxrPathPropertyName) + .EnableTracingAndCaptureOutputs() + .Execute() + .Should().Pass() + .And.HaveStdOutContaining($"Property '{sharedState.HostFxrPathPropertyName}' was not found."); + } + [Fact] public void DuplicateCommonProperty_Fails() { @@ -88,9 +97,7 @@ public void DuplicateCommonProperty_Fails() var dotnet = fixture.BuiltDotnet; var appDll = fixture.TestProject.AppDll; dotnet.Exec(appDll) - .EnvironmentVariable("COREHOST_TRACE", "1") - .CaptureStdErr() - .CaptureStdOut() + .EnableTracingAndCaptureOutputs() .Execute() .Should().Fail() .And.HaveStdErrContaining($"Duplicate runtime property found: {name}"); @@ -105,6 +112,7 @@ public class SharedTestState : IDisposable public string AppTestPropertyValue => "VALUE_FROM_APP"; public string FrameworkTestPropertyName => "FRAMEWORK_TEST_PROPERTY"; public string FrameworkTestPropertyValue => "VALUE_FROM_FRAMEWORK"; + public string HostFxrPathPropertyName => "HOSTFXR_PATH"; private readonly string copiedDotnet; diff --git a/src/native/corehost/hostpolicy/coreclr.cpp b/src/native/corehost/hostpolicy/coreclr.cpp index 0046d66d474f7..2a5c321535bb4 100644 --- a/src/native/corehost/hostpolicy/coreclr.cpp +++ b/src/native/corehost/hostpolicy/coreclr.cpp @@ -149,7 +149,8 @@ namespace _X("RUNTIME_IDENTIFIER"), _X("BUNDLE_PROBE"), _X("HOSTPOLICY_EMBEDDED"), - _X("PINVOKE_OVERRIDE") + _X("PINVOKE_OVERRIDE"), + _X("HOSTFXR_PATH") }; static_assert((sizeof(PropertyNameMapping) / sizeof(*PropertyNameMapping)) == static_cast(common_property::Last), "Invalid property count"); diff --git a/src/native/corehost/hostpolicy/coreclr.h b/src/native/corehost/hostpolicy/coreclr.h index 72b6742956a40..7980ebf39030d 100644 --- a/src/native/corehost/hostpolicy/coreclr.h +++ b/src/native/corehost/hostpolicy/coreclr.h @@ -68,6 +68,7 @@ enum class common_property BundleProbe, HostPolicyEmbedded, PInvokeOverride, + HostFxrPath, // Sentinel value - new values should be defined above Last }; diff --git a/src/native/corehost/hostpolicy/hostpolicy_context.cpp b/src/native/corehost/hostpolicy/hostpolicy_context.cpp index 2b9a953e28d53..ef608f96e1a83 100644 --- a/src/native/corehost/hostpolicy/hostpolicy_context.cpp +++ b/src/native/corehost/hostpolicy/hostpolicy_context.cpp @@ -290,6 +290,16 @@ int hostpolicy_context_t::initialize(hostpolicy_init_t &hostpolicy_init, const a } } + // We pass the loaded hostfxr path to the SDK so that it can dynamically pinvoke its APIs. + if (host_mode == host_mode_t::muxer && + (pal::strcmp(get_filename(application).c_str(), _X("dotnet.dll")) == 0)) + { + pal::dll_t fxr; + pal::string_t fxr_path; + pal::get_loaded_library(LIBFXR_NAME, "hostfxr_main", &fxr, &fxr_path); + coreclr_properties.add(common_property::HostFxrPath, fxr_path.c_str()); + } + #if defined(NATIVE_LIBS_EMBEDDED) // PInvoke Override if (bundle::info_t::is_single_file_bundle()) From 0aa39633d9c48c6a656d10423b6a9425edd7fe5f Mon Sep 17 00:00:00 2001 From: Mateo Torres Ruiz Date: Thu, 8 Jul 2021 14:42:26 -0700 Subject: [PATCH 2/5] Comment --- src/native/corehost/hostpolicy/hostpolicy_context.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/native/corehost/hostpolicy/hostpolicy_context.cpp b/src/native/corehost/hostpolicy/hostpolicy_context.cpp index ef608f96e1a83..77db24cf78b36 100644 --- a/src/native/corehost/hostpolicy/hostpolicy_context.cpp +++ b/src/native/corehost/hostpolicy/hostpolicy_context.cpp @@ -290,7 +290,7 @@ int hostpolicy_context_t::initialize(hostpolicy_init_t &hostpolicy_init, const a } } - // We pass the loaded hostfxr path to the SDK so that it can dynamically pinvoke its APIs. + // We pass the loaded hostfxr path to the SDK can load it without relying on dlopen/LoadLibrary to find it. if (host_mode == host_mode_t::muxer && (pal::strcmp(get_filename(application).c_str(), _X("dotnet.dll")) == 0)) { From fe17786981d9c652617f15d5217e31284523b110 Mon Sep 17 00:00:00 2001 From: Mateo Torres Ruiz Date: Fri, 9 Jul 2021 16:25:33 -0700 Subject: [PATCH 3/5] PR feedback --- .../TestProjects/RuntimeProperties/Program.cs | 2 +- .../HostActivation.Tests/DotNetBuilder.cs | 16 ++++++++++++ .../HostActivation.Tests/RuntimeProperties.cs | 26 +++++++++++++++++++ src/native/corehost/fxr/corehost_init.cpp | 9 ++++++- src/native/corehost/fxr/corehost_init.h | 3 ++- src/native/corehost/fxr/fx_muxer.cpp | 24 +++++++++++++++-- src/native/corehost/fxr/fx_muxer.h | 1 + src/native/corehost/hostpolicy/coreclr.cpp | 3 +-- src/native/corehost/hostpolicy/coreclr.h | 1 - .../hostpolicy/hostpolicy_context.cpp | 10 ------- 10 files changed, 77 insertions(+), 18 deletions(-) diff --git a/src/installer/tests/Assets/TestProjects/RuntimeProperties/Program.cs b/src/installer/tests/Assets/TestProjects/RuntimeProperties/Program.cs index cd180a4c9ec76..96fa3b2adbad2 100644 --- a/src/installer/tests/Assets/TestProjects/RuntimeProperties/Program.cs +++ b/src/installer/tests/Assets/TestProjects/RuntimeProperties/Program.cs @@ -21,7 +21,7 @@ public static void Main(string[] args) continue; } - Console.WriteLine($"AppContext.GetData({propertyName}) = {System.AppContext.GetData(propertyName)}"); + Console.WriteLine($"AppContext.GetData({propertyName}) = {propertyValue}"); } } } diff --git a/src/installer/tests/HostActivation.Tests/DotNetBuilder.cs b/src/installer/tests/HostActivation.Tests/DotNetBuilder.cs index 2a99ab5681f75..dbd4f8b209ec9 100644 --- a/src/installer/tests/HostActivation.Tests/DotNetBuilder.cs +++ b/src/installer/tests/HostActivation.Tests/DotNetBuilder.cs @@ -174,6 +174,22 @@ public DotNetBuilder AddMicrosoftNETCoreAppFrameworkMockCoreClr(string version, return this; } + public DotNetBuilder AddMockSDK( + string version, + string MNAVersion) + { + string path = Path.Combine(_path, "sdk", version); + Directory.CreateDirectory(path); + + File.Create(Path.Combine(path, "dotnet.dll")); + + RuntimeConfig dotnetRuntimeConfig = new RuntimeConfig(Path.Combine(path, "dotnet.runtimeconfig.json")); + dotnetRuntimeConfig.WithFramework(new RuntimeConfig.Framework("Microsoft.NETCore.App", MNAVersion)); + dotnetRuntimeConfig.Save(); + + return this; + } + public DotNetCli Build() { return new DotNetCli(_path); diff --git a/src/installer/tests/HostActivation.Tests/RuntimeProperties.cs b/src/installer/tests/HostActivation.Tests/RuntimeProperties.cs index 6a42478a2ce0e..01b5b415ecd26 100644 --- a/src/installer/tests/HostActivation.Tests/RuntimeProperties.cs +++ b/src/installer/tests/HostActivation.Tests/RuntimeProperties.cs @@ -3,6 +3,7 @@ using System; using System.IO; +using Microsoft.DotNet.Cli.Build; using Xunit; namespace Microsoft.DotNet.CoreSetup.Test.HostActivation @@ -68,6 +69,17 @@ public void DuplicateConfigProperty_AppConfigValueUsed() .And.HaveStdOutContaining($"AppContext.GetData({sharedState.FrameworkTestPropertyName}) = {sharedState.AppTestPropertyValue}"); } + [Fact] + public void HostFxrPathProperty_SetWhenRunningSDKCommand() + { + var dotnet = sharedState.MockSDK; + dotnet.Exec("--info") + .EnableTracingAndCaptureOutputs() + .Execute() + .Should().Pass() + .And.HaveStdErrContaining($"Property {sharedState.HostFxrPathPropertyName} = {dotnet.GreatestVersionHostFxrFilePath}"); + } + [Fact] public void HostFxrPathProperty_NotVisibleFromApp() { @@ -107,6 +119,7 @@ public class SharedTestState : IDisposable { public TestProjectFixture RuntimePropertiesFixture { get; } public RepoDirectoriesProvider RepoDirectories { get; } + public DotNetCli MockSDK { get; } public string AppTestPropertyName => "APP_TEST_PROPERTY"; public string AppTestPropertyValue => "VALUE_FROM_APP"; @@ -121,6 +134,19 @@ public SharedTestState() copiedDotnet = Path.Combine(TestArtifact.TestArtifactsPath, "runtimeProperties"); SharedFramework.CopyDirectory(Path.Combine(TestArtifact.TestArtifactsPath, "sharedFrameworkPublish"), copiedDotnet); + MockSDK = new DotNetBuilder(copiedDotnet, Path.Combine(TestArtifact.TestArtifactsPath, "sharedFrameworkPublish"), "exe") + .AddMicrosoftNETCoreAppFrameworkMockCoreClr("9999.0.0") + .AddMockSDK("9999.0.0-dev", "9999.0.0") + .Build(); + + File.WriteAllText(Path.Combine(MockSDK.BinPath, "global.json"), + @" +{ + ""sdk"": { + ""version"": ""9999.0.0-dev"" + } +}"); + RepoDirectories = new RepoDirectoriesProvider(builtDotnet: copiedDotnet); RuntimePropertiesFixture = new TestProjectFixture("RuntimeProperties", RepoDirectories) diff --git a/src/native/corehost/fxr/corehost_init.cpp b/src/native/corehost/fxr/corehost_init.cpp index eea9b768f5f90..2d169348fa635 100644 --- a/src/native/corehost/fxr/corehost_init.cpp +++ b/src/native/corehost/fxr/corehost_init.cpp @@ -20,7 +20,8 @@ corehost_init_t::corehost_init_t( const pal::string_t& additional_deps_serialized, const std::vector& probe_paths, const host_mode_t mode, - const fx_definition_vector_t& fx_definitions) + const fx_definition_vector_t& fx_definitions, + const std::vector>& additional_properties) : m_tfm(get_app(fx_definitions).get_runtime_config().get_tfm()) , m_deps_file(deps_file) , m_additional_deps_serialized(additional_deps_serialized) @@ -35,6 +36,12 @@ corehost_init_t::corehost_init_t( { make_cstr_arr(m_probe_paths, &m_probe_paths_cstr); + for (const auto& additional_property : additional_properties) + { + m_clr_keys.push_back(additional_property.first); + m_clr_values.push_back(additional_property.second); + } + size_t fx_count = fx_definitions.size(); m_fx_names.reserve(fx_count); m_fx_dirs.reserve(fx_count); diff --git a/src/native/corehost/fxr/corehost_init.h b/src/native/corehost/fxr/corehost_init.h index 70ea7be46fbf0..6c3148b627496 100644 --- a/src/native/corehost/fxr/corehost_init.h +++ b/src/native/corehost/fxr/corehost_init.h @@ -45,7 +45,8 @@ class corehost_init_t const pal::string_t& additional_deps_serialized, const std::vector& probe_paths, const host_mode_t mode, - const fx_definition_vector_t& fx_definitions); + const fx_definition_vector_t& fx_definitions, + const std::vector>& additional_properties); const host_interface_t& get_host_init_data(); diff --git a/src/native/corehost/fxr/fx_muxer.cpp b/src/native/corehost/fxr/fx_muxer.cpp index 6a20206e2cadb..a5ffedbde1f86 100644 --- a/src/native/corehost/fxr/fx_muxer.cpp +++ b/src/native/corehost/fxr/fx_muxer.cpp @@ -370,6 +370,7 @@ namespace const pal::string_t &app_candidate, const opt_map_t &opts, host_mode_t mode, + const bool is_sdk_command, /*out*/ pal::string_t &hostpolicy_dir, /*out*/ std::unique_ptr &init) { @@ -473,6 +474,17 @@ namespace } } + std::vector> additional_properties; + if (is_sdk_command) + { + pal::dll_t fxr; + pal::string_t fxr_path; + pal::get_loaded_library(LIBFXR_NAME, "hostfxr_main", &fxr, &fxr_path); + + // We pass the loaded hostfxr path to the SDK can load it without relying on dlopen/LoadLibrary to find it. + additional_properties.push_back(std::make_pair(_X("HOSTFXR_PATH"), fxr_path)); + } + const known_options opts_probe_path = known_options::additional_probing_path; std::vector spec_probe_paths = opts.count(opts_probe_path) ? opts.find(opts_probe_path)->second : std::vector(); std::vector probe_realpaths = get_probe_realpaths(fx_definitions, spec_probe_paths); @@ -485,7 +497,7 @@ namespace return StatusCode::CoreHostLibMissingFailure; } - init.reset(new corehost_init_t(host_command, host_info, deps_file, additional_deps_serialized, probe_realpaths, mode, fx_definitions)); + init.reset(new corehost_init_t(host_command, host_info, deps_file, additional_deps_serialized, probe_realpaths, mode, fx_definitions, additional_properties)); return StatusCode::Success; } @@ -498,6 +510,7 @@ namespace int new_argc, const pal::char_t** new_argv, host_mode_t mode, + const bool is_sdk_command, pal::char_t out_buffer[], int32_t buffer_size, int32_t* required_buffer_size) @@ -510,6 +523,7 @@ namespace app_candidate, opts, mode, + is_sdk_command, hostpolicy_dir, init); if (rc != StatusCode::Success) @@ -572,6 +586,7 @@ int fx_muxer_t::execute( argv, new_argoff, mode, + false, result_buffer, buffer_size, required_buffer_size); @@ -621,7 +636,8 @@ namespace } const pal::string_t additional_deps_serialized; - init.reset(new corehost_init_t(pal::string_t{}, host_info, deps_file, additional_deps_serialized, probe_realpaths, mode, fx_definitions)); + const std::vector> additional_properties; + init.reset(new corehost_init_t(pal::string_t{}, host_info, deps_file, additional_deps_serialized, probe_realpaths, mode, fx_definitions, additional_properties)); return StatusCode::Success; } @@ -725,6 +741,7 @@ int fx_muxer_t::initialize_for_app( host_info.app_path, opts, mode, + false, hostpolicy_dir, init); if (rc != StatusCode::Success) @@ -978,6 +995,7 @@ int fx_muxer_t::handle_exec_host_command( const pal::char_t* argv[], int argoff, host_mode_t mode, + const bool is_sdk_command, pal::char_t result_buffer[], int32_t buffer_size, int32_t* required_buffer_size) @@ -1006,6 +1024,7 @@ int fx_muxer_t::handle_exec_host_command( new_argc, new_argv, mode, + is_sdk_command, result_buffer, buffer_size, required_buffer_size); @@ -1096,6 +1115,7 @@ int fx_muxer_t::handle_cli( new_argv.data(), new_argoff, host_mode_t::muxer, + true, nullptr /*result_buffer*/, 0 /*buffer_size*/, nullptr/*required_buffer_size*/); diff --git a/src/native/corehost/fxr/fx_muxer.h b/src/native/corehost/fxr/fx_muxer.h index 6794e2a1c8254..b3a0e0004700a 100644 --- a/src/native/corehost/fxr/fx_muxer.h +++ b/src/native/corehost/fxr/fx_muxer.h @@ -47,6 +47,7 @@ class fx_muxer_t const pal::char_t* argv[], int argoff, host_mode_t mode, + const bool is_sdk_command, pal::char_t result_buffer[], int32_t buffer_size, int32_t* required_buffer_size); diff --git a/src/native/corehost/hostpolicy/coreclr.cpp b/src/native/corehost/hostpolicy/coreclr.cpp index 2a5c321535bb4..0046d66d474f7 100644 --- a/src/native/corehost/hostpolicy/coreclr.cpp +++ b/src/native/corehost/hostpolicy/coreclr.cpp @@ -149,8 +149,7 @@ namespace _X("RUNTIME_IDENTIFIER"), _X("BUNDLE_PROBE"), _X("HOSTPOLICY_EMBEDDED"), - _X("PINVOKE_OVERRIDE"), - _X("HOSTFXR_PATH") + _X("PINVOKE_OVERRIDE") }; static_assert((sizeof(PropertyNameMapping) / sizeof(*PropertyNameMapping)) == static_cast(common_property::Last), "Invalid property count"); diff --git a/src/native/corehost/hostpolicy/coreclr.h b/src/native/corehost/hostpolicy/coreclr.h index 7980ebf39030d..72b6742956a40 100644 --- a/src/native/corehost/hostpolicy/coreclr.h +++ b/src/native/corehost/hostpolicy/coreclr.h @@ -68,7 +68,6 @@ enum class common_property BundleProbe, HostPolicyEmbedded, PInvokeOverride, - HostFxrPath, // Sentinel value - new values should be defined above Last }; diff --git a/src/native/corehost/hostpolicy/hostpolicy_context.cpp b/src/native/corehost/hostpolicy/hostpolicy_context.cpp index 77db24cf78b36..2b9a953e28d53 100644 --- a/src/native/corehost/hostpolicy/hostpolicy_context.cpp +++ b/src/native/corehost/hostpolicy/hostpolicy_context.cpp @@ -290,16 +290,6 @@ int hostpolicy_context_t::initialize(hostpolicy_init_t &hostpolicy_init, const a } } - // We pass the loaded hostfxr path to the SDK can load it without relying on dlopen/LoadLibrary to find it. - if (host_mode == host_mode_t::muxer && - (pal::strcmp(get_filename(application).c_str(), _X("dotnet.dll")) == 0)) - { - pal::dll_t fxr; - pal::string_t fxr_path; - pal::get_loaded_library(LIBFXR_NAME, "hostfxr_main", &fxr, &fxr_path); - coreclr_properties.add(common_property::HostFxrPath, fxr_path.c_str()); - } - #if defined(NATIVE_LIBS_EMBEDDED) // PInvoke Override if (bundle::info_t::is_single_file_bundle()) From 68c01c37986e5035c16c055aed70bd2e14844f14 Mon Sep 17 00:00:00 2001 From: Mateo Torres Ruiz Date: Fri, 9 Jul 2021 17:49:38 -0700 Subject: [PATCH 4/5] Use get_own_module_path since we are on hostfxr --- src/native/corehost/fxr/fx_muxer.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/native/corehost/fxr/fx_muxer.cpp b/src/native/corehost/fxr/fx_muxer.cpp index a5ffedbde1f86..08912feff37da 100644 --- a/src/native/corehost/fxr/fx_muxer.cpp +++ b/src/native/corehost/fxr/fx_muxer.cpp @@ -477,9 +477,8 @@ namespace std::vector> additional_properties; if (is_sdk_command) { - pal::dll_t fxr; pal::string_t fxr_path; - pal::get_loaded_library(LIBFXR_NAME, "hostfxr_main", &fxr, &fxr_path); + pal::get_own_module_path(&fxr_path); // We pass the loaded hostfxr path to the SDK can load it without relying on dlopen/LoadLibrary to find it. additional_properties.push_back(std::make_pair(_X("HOSTFXR_PATH"), fxr_path)); From 5757193f6c67b05423e9cdbb7992c797c5840867 Mon Sep 17 00:00:00 2001 From: Mateo Torres Ruiz Date: Mon, 12 Jul 2021 11:31:42 -0700 Subject: [PATCH 5/5] Dispose FileStream --- src/installer/tests/HostActivation.Tests/DotNetBuilder.cs | 2 +- src/native/corehost/fxr/fx_muxer.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/installer/tests/HostActivation.Tests/DotNetBuilder.cs b/src/installer/tests/HostActivation.Tests/DotNetBuilder.cs index dbd4f8b209ec9..0a8d54559e227 100644 --- a/src/installer/tests/HostActivation.Tests/DotNetBuilder.cs +++ b/src/installer/tests/HostActivation.Tests/DotNetBuilder.cs @@ -181,7 +181,7 @@ public DotNetBuilder AddMicrosoftNETCoreAppFrameworkMockCoreClr(string version, string path = Path.Combine(_path, "sdk", version); Directory.CreateDirectory(path); - File.Create(Path.Combine(path, "dotnet.dll")); + using var _ = File.Create(Path.Combine(path, "dotnet.dll")); RuntimeConfig dotnetRuntimeConfig = new RuntimeConfig(Path.Combine(path, "dotnet.runtimeconfig.json")); dotnetRuntimeConfig.WithFramework(new RuntimeConfig.Framework("Microsoft.NETCore.App", MNAVersion)); diff --git a/src/native/corehost/fxr/fx_muxer.cpp b/src/native/corehost/fxr/fx_muxer.cpp index 08912feff37da..8647130c18dc1 100644 --- a/src/native/corehost/fxr/fx_muxer.cpp +++ b/src/native/corehost/fxr/fx_muxer.cpp @@ -585,7 +585,7 @@ int fx_muxer_t::execute( argv, new_argoff, mode, - false, + false /*is_sdk_command*/, result_buffer, buffer_size, required_buffer_size); @@ -740,7 +740,7 @@ int fx_muxer_t::initialize_for_app( host_info.app_path, opts, mode, - false, + false /*is_sdk_command*/, hostpolicy_dir, init); if (rc != StatusCode::Success) @@ -1114,7 +1114,7 @@ int fx_muxer_t::handle_cli( new_argv.data(), new_argoff, host_mode_t::muxer, - true, + true /*is_sdk_command*/, nullptr /*result_buffer*/, 0 /*buffer_size*/, nullptr/*required_buffer_size*/);