Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core Tools OOP Host #3802

Merged
merged 70 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from 60 commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
704ac4e
this doesn't work
aishwaryabh Aug 27, 2024
3c2d57e
this finally works now
aishwaryabh Aug 27, 2024
8e1a8b8
default should be oop host
aishwaryabh Aug 28, 2024
dba7366
added edge cases
aishwaryabh Aug 28, 2024
e10e828
fixing formatting
aishwaryabh Aug 28, 2024
8cace5c
using determineTargetFramework
aishwaryabh Sep 4, 2024
b3edb40
Merge branch 'v4.x' of https://github.com/Azure/azure-functions-core-…
aishwaryabh Sep 4, 2024
e8513a6
saving tests
aishwaryabh Sep 5, 2024
58cec33
adding copy step for OOP
aishwaryabh Sep 5, 2024
bda722f
fixing the webhost reference
aishwaryabh Sep 5, 2024
8cb1b78
removing test
aishwaryabh Sep 5, 2024
cef04a0
setting host version in ps script
aishwaryabh Sep 6, 2024
fa7d681
update to validate worker versions script
aishwaryabh Sep 7, 2024
0a85400
update versions for worker packages
aishwaryabh Sep 9, 2024
654e34b
adding ToString
aishwaryabh Sep 9, 2024
ba31c33
validating worker version
aishwaryabh Sep 9, 2024
e420bee
validate worker versions
aishwaryabh Sep 9, 2024
9689ef4
updating csproj to compile
aishwaryabh Sep 9, 2024
f705868
addressing pr feedback
aishwaryabh Sep 9, 2024
c175762
updating build steps
aishwaryabh Sep 9, 2024
83c0a23
Merge branch 'v4.x' of https://github.com/Azure/azure-functions-core-…
aishwaryabh Sep 9, 2024
d018052
adding build step
aishwaryabh Sep 9, 2024
9e65428
fixing build step
aishwaryabh Sep 9, 2024
26d67e5
trying to get this working
aishwaryabh Sep 10, 2024
91aae46
reverrting target runtimes
aishwaryabh Sep 10, 2024
8468773
updating tests
aishwaryabh Sep 10, 2024
8f51faa
adding dotnet info step
aishwaryabh Sep 10, 2024
eb07a1f
adding changes
aishwaryabh Sep 11, 2024
06b6bd7
removing extra test
aishwaryabh Sep 11, 2024
525aa6b
trying to specify architecture
aishwaryabh Sep 11, 2024
38b3920
modifying tests to see if they work
aishwaryabh Sep 11, 2024
553cc71
narrowing down to tests that are failing
aishwaryabh Sep 11, 2024
836d939
trying to see if it works with nobuild flag
aishwaryabh Sep 12, 2024
b0d8e5c
addressing pr feedback
aishwaryabh Sep 12, 2024
68800d6
updating tests with latest logging
aishwaryabh Sep 12, 2024
d544912
addressing comments and marking flaky tests
aishwaryabh Sep 12, 2024
16dfee4
updating so that we are only using net8 framework
aishwaryabh Sep 16, 2024
55f42ad
pushing change for branch build
aishwaryabh Sep 16, 2024
ec55012
adding single quotes
aishwaryabh Sep 16, 2024
125f0be
reverting quotes
aishwaryabh Sep 16, 2024
6a5e6e0
adding code mirror fiile
aishwaryabh Sep 16, 2024
622c3fb
updating build step
aishwaryabh Sep 16, 2024
d1da564
updatinng build steps
aishwaryabh Sep 16, 2024
bfdaff0
updating build step
aishwaryabh Sep 16, 2024
2c29257
Merge branch 'v4.x' of https://github.com/Azure/azure-functions-core-…
aishwaryabh Sep 17, 2024
b832675
adding step for dotnet publish
aishwaryabh Sep 17, 2024
6726456
set inprochost compilation system to diff value and skip flaky test
aishwaryabh Sep 17, 2024
f7e520b
updating public build pipeline to trigger
aishwaryabh Sep 17, 2024
bf47a3c
adding extra changes for pipeline
aishwaryabh Sep 17, 2024
09dec2b
public build yml
aishwaryabh Sep 17, 2024
5ac6edf
updating official build
aishwaryabh Sep 17, 2024
52e9289
readd net8 build artifact step
aishwaryabh Sep 17, 2024
c2813c5
readding space back
aishwaryabh Sep 17, 2024
c9844d1
addressing initial comments
aishwaryabh Sep 18, 2024
b13a532
adding explicit openTelemetry dlls
aishwaryabh Sep 18, 2024
697847d
simplifying logic of startHostAction
aishwaryabh Sep 18, 2024
4d9681f
addressing PR feedback
aishwaryabh Sep 18, 2024
ba7caec
start tests
aishwaryabh Sep 18, 2024
4821e73
changing some of the tests back
aishwaryabh Sep 18, 2024
b656fa1
reverting test back to normal
aishwaryabh Sep 19, 2024
7545285
fixing spacing for csproj
aishwaryabh Sep 19, 2024
e21065e
addressing PR feedback
aishwaryabh Sep 19, 2024
490eaf9
adding extra variable
aishwaryabh Sep 19, 2024
456aaa7
adding logic for edge case scenarios
aishwaryabh Sep 19, 2024
da89da0
added edge cases tests
aishwaryabh Sep 19, 2024
1bbca61
Merge branch 'feature/oop-host' of https://github.com/Azure/azure-fun…
aishwaryabh Sep 19, 2024
2cdbfe8
removing extra line in node
aishwaryabh Sep 19, 2024
cc01008
addressing comments
aishwaryabh Sep 20, 2024
72af8da
moving validate host runtime to its own method
aishwaryabh Sep 20, 2024
8b31c8e
forgot to add return statement
aishwaryabh Sep 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ if ($env:IntegrationBuildNumber)
throw $errorMessage
}

$buildCommand = { dotnet run --integrationTests }
$buildCommand = { dotnet run --integrationTests --skipArtifactGeneration}
}
else
{
$buildCommand = { dotnet run --ci }
$buildCommand = { dotnet run --ci --skipArtifactGeneration}
aishwaryabh marked this conversation as resolved.
Show resolved Hide resolved
}

Write-Host "Running $buildCommand"
Expand Down
11 changes: 5 additions & 6 deletions build/BuildSteps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public static void DotnetPack()
Shell.Run("dotnet", $"pack {Settings.SrcProjectPath} " +
$"/p:BuildNumber=\"{Settings.BuildNumber}\" " +
$"/p:NoWorkers=\"true\" " +
$"/p:TargetFramework=net6.0 " + // without TargetFramework, the generated nuspec has incorrect path for the copy files operation.
$"/p:TargetFramework=net8.0 " + // without TargetFramework, the generated nuspec has incorrect path for the copy files operation.
$"/p:CommitHash=\"{Settings.CommitId}\" " +
(string.IsNullOrEmpty(Settings.IntegrationBuildNumber) ? string.Empty : $"/p:IntegrationBuildNumber=\"{Settings.IntegrationBuildNumber}\" ") +
$"-o {outputPath} -c Release --no-build");
Expand All @@ -116,8 +116,7 @@ public static void DotnetPublishForZips()
var outputPath = Path.Combine(Settings.OutputDir, runtime);
var rid = GetRuntimeId(runtime);

ExecuteDotnetPublish(outputPath, rid, "net6.0", skipLaunchingNet8ChildProcess: isMinVersion);

ExecuteDotnetPublish(outputPath, rid, "net8.0", skipLaunchingNet8ChildProcess: isMinVersion);
if (isMinVersion)
{
RemoveLanguageWorkers(outputPath);
Expand Down Expand Up @@ -342,7 +341,7 @@ public static void Test()

Environment.SetEnvironmentVariable("DURABLE_FUNCTION_PATH", Settings.DurableFolder);

Shell.Run("dotnet", $"test {Settings.TestProjectFile} -f net6.0 --logger trx");
Shell.Run("dotnet", $"test {Settings.TestProjectFile} -f net8.0 --logger trx");
}

public static void CopyBinariesToSign()
Expand Down Expand Up @@ -643,10 +642,10 @@ public static void DotnetPublishForNupkg()
Shell.Run("dotnet", $"publish {Settings.ProjectFile} " +
$"/p:BuildNumber=\"{Settings.BuildNumber}\" " +
$"/p:NoWorkers=\"true\" " +
$"/p:TargetFramework=net6.0 " +
$"/p:TargetFramework=net8.0 " +
$"/p:CommitHash=\"{Settings.CommitId}\" " +
(string.IsNullOrEmpty(Settings.IntegrationBuildNumber) ? string.Empty : $"/p:IntegrationBuildNumber=\"{Settings.IntegrationBuildNumber}\" ") +
$"-c Release -f net6.0");
$"-c Release -f net8.0");
}

public static void GenerateSBOMManifestForNupkg()
Expand Down
4 changes: 2 additions & 2 deletions build/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ static void Main(string[] args)
.Then(TestPreSignedArtifacts, skip: !args.Contains("--ci"))
.Then(CopyBinariesToSign, skip: !args.Contains("--ci"))
.Then(Test)
.Then(Zip)
.Then(Zip, skip: args.Contains("--skipArtifactGeneration"))
.Then(DotnetPublishForNupkg)
.Then(DotnetPack)
.Then(CreateIntegrationTestsBuildManifest, skip: !args.Contains("--integrationTests"))
.Then(UploadToStorage, skip: !args.Contains("--ci"))
.Then(UploadToStorage, skip: !args.Contains("--ci") || args.Contains("--skipArtifactGeneration"))
.Run();
}
}
Expand Down
10 changes: 10 additions & 0 deletions build/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,16 @@ public class SignInfo
"Microsoft.OData.Edm.dll",
"Microsoft.Spatial.dll",
"Mono.Posix.NETStandard.dll",
"OpenTelemetry.Api.dll",
"OpenTelemetry.Api.ProviderBuilderExtensions.dll",
"OpenTelemetry.dll",
"OpenTelemetry.Exporter.Console.dll",
"OpenTelemetry.Exporter.OpenTelemetryProtocol.dll",
"OpenTelemetry.Extensions.Hosting.dll",
"OpenTelemetry.Instrumentation.AspNetCore.dll",
"OpenTelemetry.Instrumentation.Http.dll",
"OpenTelemetry.PersistentStorage.Abstractions.dll",
"OpenTelemetry.PersistentStorage.FileSystem.dll",
Path.Combine("tools", "python", "packapp", "distlib")
};
}
Expand Down
1 change: 1 addition & 0 deletions code-mirror.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ trigger:
- release_4.0
- release_3.0
- release_4.0_hotfix
- feature/*

resources:
repositories:
Expand Down
1 change: 1 addition & 0 deletions eng/ci/official-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ trigger:
include:
- v4.x
- release_4.0
- feature/*

resources:
repositories:
Expand Down
2 changes: 2 additions & 0 deletions eng/ci/public-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ pr:
include:
- v4.x
- release_4.0
- feature/*

trigger:
aishwaryabh marked this conversation as resolved.
Show resolved Hide resolved
batch: true
branches:
include:
- v4.x
- release_4.0
- feature/*

resources:
repositories:
Expand Down
2 changes: 1 addition & 1 deletion pipelineUtilities.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ function Install-DotnetVersion($Version,$Channel) {
if ($IsWindows) {
& .\$installScript -InstallDir "$env:ProgramFiles/dotnet" -Channel $Channel -Version $Version
# Installing .NET into x86 directory since the E2E App runs the tests on x86 and looks for the specified framework there
& .\$installScript -InstallDir "$env:ProgramFiles (x86)/dotnet" -Channel $Channel -Version $Version
& .\$installScript -InstallDir "$env:ProgramFiles (x86)/dotnet" -Channel $Channel -Version $Version -Architecture x86
fabiocav marked this conversation as resolved.
Show resolved Hide resolved
} else {
bash ./$installScript --install-dir /usr/share/dotnet -c $Channel -v $Version
}
Expand Down
170 changes: 143 additions & 27 deletions src/Azure.Functions.Cli/Actions/HostActions/StartHostAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using System.Net;
using System.Runtime.InteropServices;
using System.Security.Cryptography.X509Certificates;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Azure.Functions.Cli.Common;
using Azure.Functions.Cli.Diagnostics;
Expand Down Expand Up @@ -40,10 +39,6 @@ internal class StartHostAction : BaseAction
{
private const int DefaultPort = 7071;
private const int DefaultTimeout = 20;
private const string Net6FrameworkDescriptionPrefix = ".NET 6.0";
private const string WindowsExecutableName = "func.exe";
private const string LinuxExecutableName = "func";
private const string InProc8DirectoryName = "in-proc8";
private readonly ISecretsManager _secretsManager;
private readonly IProcessManager _processManager;
private IConfigurationRoot _hostJsonConfig;
Expand Down Expand Up @@ -81,6 +76,8 @@ internal class StartHostAction : BaseAction

public string JsonOutputFile { get; set; }

public string? HostRuntime { get; set; }
aishwaryabh marked this conversation as resolved.
Show resolved Hide resolved

public StartHostAction(ISecretsManager secretsManager, IProcessManager processManager)
{
_secretsManager = secretsManager;
Expand Down Expand Up @@ -176,6 +173,11 @@ public override ICommandLineParserResult ParseArgs(string[] args)
.WithDescription("If provided, a path to the file that will be used to write the output when using --enable-json-output.")
.Callback(jsonOutputFile => JsonOutputFile = jsonOutputFile);

Parser
.Setup<string>("runtime")
aishwaryabh marked this conversation as resolved.
Show resolved Hide resolved
.WithDescription($"If provided, determines which version of the host to start. Allowed values are '{DotnetConstants.InProc6HostRuntime}', '{DotnetConstants.InProc8HostRuntime}', and 'default' (which runs the out-of-process host).")
.Callback(startHostFromRuntime => HostRuntime = startHostFromRuntime);

var parserResult = base.ParseArgs(args);
bool verboseLoggingArgExists = parserResult.UnMatchedOptions.Any(o => o.LongName.Equals("verbose", StringComparison.OrdinalIgnoreCase));
// Input args do not contain --verbose flag
Expand Down Expand Up @@ -418,15 +420,34 @@ private async Task<JObject> GetLocalSettingsJsonAsJObjectAsync()
public override async Task RunAsync()
{
await PreRunConditions();
var isVerbose = VerboseLogging.HasValue && VerboseLogging.Value;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move this logic that is specific to .NET to a different method and out of RunAsync? That will help declutter this method and make the code easier to navigate.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will also enable you to reduce the variables as you'll be able to drive the logic without needing to have an additional flag for OOP.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved this logic into: ShouldExitAfterDeterminingHostRuntime to clean up RunAsync


var isCurrentProcessNet6Build = RuntimeInformation.FrameworkDescription.Contains(Net6FrameworkDescriptionPrefix);
if (isCurrentProcessNet6Build && ShouldLaunchInProcNet8AsChildProcess() && await IsInProcNet8Enabled())
// If --runtime param is set, handle runtime param logic; otherwise we infer the host to launch on startup
if (HostRuntime is not null)
aishwaryabh marked this conversation as resolved.
Show resolved Hide resolved
{
// Check if we should start child process from user specified host runtime and return
var shouldStartChildProcess = await ShouldStartChildProcessFromHostRuntime(isVerbose);

if (shouldStartChildProcess)
{
var isNet8InProcSpecified = string.Equals(HostRuntime, DotnetConstants.InProc8HostRuntime, StringComparison.OrdinalIgnoreCase);
await StartHostAsChildProcessAsync(isNet8InProcSpecified);
return;
aishwaryabh marked this conversation as resolved.
Show resolved Hide resolved
}
}
else
{
await StartInProc8AsChildProcessAsync();
return;
// Infer host runtime and check if we should launch child process
var shouldNet8InProcBeLaunched = await ShouldNet8InProcBeLaunched();
var shouldStartChildProcess = ShouldLaunchChildProcessAfterInferringHostRuntimeAsync(shouldNet8InProcBeLaunched, isVerbose);

if (shouldStartChildProcess)
{
await StartHostAsChildProcessAsync(shouldNet8InProcBeLaunched);
return;
}
}

var isVerbose = VerboseLogging.HasValue && VerboseLogging.Value;
if (isVerbose || EnvironmentHelper.GetEnvironmentVariableAsBool(Constants.DisplayLogo))
{
Utilities.PrintLogo();
Expand Down Expand Up @@ -480,31 +501,128 @@ public override async Task RunAsync()
await runTask;
}

private async Task<bool> ShouldStartChildProcessFromHostRuntime(bool isVerbose)
{
if (string.Equals(HostRuntime, "default", StringComparison.OrdinalIgnoreCase))
{
if (isVerbose)
aishwaryabh marked this conversation as resolved.
Show resolved Hide resolved
{
PrintVerboseForHostSelection(isVerbose, "out-of-process");
}
return false;
}
else if (string.Equals(HostRuntime, DotnetConstants.InProc8HostRuntime, StringComparison.OrdinalIgnoreCase))
{
if (await ShouldNet8InProcBeLaunched())
{
if (isVerbose)
{
PrintVerboseForHostSelection(isVerbose, DotnetConstants.InProc8HostRuntime);
}
return true;
}
else
{
aishwaryabh marked this conversation as resolved.
Show resolved Hide resolved
throw new CliException($"Invalid config for running {DotnetConstants.InProc8HostRuntime} host.");
aishwaryabh marked this conversation as resolved.
Show resolved Hide resolved
}
}
else if (string.Equals(HostRuntime, DotnetConstants.InProc6HostRuntime, StringComparison.OrdinalIgnoreCase))
{
if (isVerbose)
aishwaryabh marked this conversation as resolved.
Show resolved Hide resolved
{
PrintVerboseForHostSelection(isVerbose, DotnetConstants.InProc6HostRuntime);
}
return true;
aishwaryabh marked this conversation as resolved.
Show resolved Hide resolved
}
else
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Remove the else { and just keep the throw. (reduces some nesting and improve readability)

{
throw new CliException($"Invalid host runtime '{HostRuntime}'. Valid values are 'default', '{DotnetConstants.InProc8HostRuntime}', '{DotnetConstants.InProc6HostRuntime}'.");
}
}

private void PrintVerboseForHostSelection(bool isVerbose, string hostRuntime)
{
if (isVerbose)
{
ColoredConsole.WriteLine(VerboseColor($"Selected {hostRuntime} host"));
aishwaryabh marked this conversation as resolved.
Show resolved Hide resolved
}
}

private async Task<bool> ShouldNet8InProcBeLaunched()
{
// Start .NET 8 child process if InProc8 is enabled
if (ShouldLaunchInProcNet8AsChildProcess() && await IsInProcNet8Enabled())
aishwaryabh marked this conversation as resolved.
Show resolved Hide resolved
{
return true;
}
return false;
}

private bool ShouldLaunchChildProcessAfterInferringHostRuntimeAsync(bool shouldLaunchNet8, bool isVerbose)
{
// We should try to infer if we run inproc6 host, inproc8 host, or OOP host (default)
var isOutOfProc = GlobalCoreToolsSettings.CurrentWorkerRuntime == WorkerRuntime.dotnet ? false : true;

// Check if the app is in-proc
if (!isOutOfProc)
aishwaryabh marked this conversation as resolved.
Show resolved Hide resolved
{
if (isVerbose)
{
// Start .NET 8 child process if InProc8 is enabled and if TFM of function app is .NET 8
if (shouldLaunchNet8)
{
ColoredConsole.WriteLine(VerboseColor($"Selected {DotnetConstants.InProc8HostRuntime} host"));
}
// Otherwise start .NET 6 child process since we are running an inproc app
else
{
ColoredConsole.WriteLine(VerboseColor($"Selected {DotnetConstants.InProc6HostRuntime} host"));
}
}
return true;
}
// If the above conditions fail, the default should be OOP host
if (isVerbose)
{
ColoredConsole.WriteLine(VerboseColor("Selected out-of-process host"));
}
return false;

}

private static string GetInProcNet8ExecutablePath()
{
var funcExecutableDirectory = Path.GetDirectoryName(typeof(StartHostAction).Assembly.Location)!;
var executableName = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? WindowsExecutableName : LinuxExecutableName;
var executableName = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? DotnetConstants.WindowsExecutableName : DotnetConstants.LinuxExecutableName;
aishwaryabh marked this conversation as resolved.
Show resolved Hide resolved

return Path.Combine(funcExecutableDirectory, DotnetConstants.InProc8DirectoryName, executableName);
}

private static string GetInProcNet6ExecutablePath()
{
var funcExecutableDirectory = Path.GetDirectoryName(typeof(StartHostAction).Assembly.Location)!;
var executableName = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? DotnetConstants.WindowsExecutableName : DotnetConstants.LinuxExecutableName;

return Path.Combine(funcExecutableDirectory, InProc8DirectoryName, executableName);
return Path.Combine(funcExecutableDirectory, DotnetConstants.InProc6DirectoryName, executableName);
}

private Task StartInProc8AsChildProcessAsync()
private async Task StartHostAsChildProcessAsync(bool shouldStartNet8ChildProcess)
aishwaryabh marked this conversation as resolved.
Show resolved Hide resolved
{
if (VerboseLogging == true)
{
ColoredConsole.WriteLine(VerboseColor($"Starting child process for in-process model host."));
ColoredConsole.WriteLine(VerboseColor($"Starting child process for {(shouldStartNet8ChildProcess ? DotnetConstants.InProc8HostRuntime : DotnetConstants.InProc6HostRuntime)} model host."));
}

var commandLineArguments = string.Join(" ", Environment.GetCommandLineArgs().Skip(1));
var tcs = new TaskCompletionSource();

var inProc8FuncExecutablePath = GetInProcNet8ExecutablePath();
var funcExecutablePath = shouldStartNet8ChildProcess ? GetInProcNet8ExecutablePath() : GetInProcNet6ExecutablePath();

EnsureNet8FuncExecutablePresent(inProc8FuncExecutablePath);
EnsureFuncExecutablePresent(funcExecutablePath, shouldStartNet8ChildProcess);

var inprocNet8ChildProcessInfo = new ProcessStartInfo
var childProcessInfo = new ProcessStartInfo
{
FileName = inProc8FuncExecutablePath,
FileName = funcExecutablePath,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do we use the --no-build argument?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use it in line 626?

Arguments = $"{commandLineArguments} --no-build",
WorkingDirectory = Environment.CurrentDirectory,
UseShellExecute = false,
Expand All @@ -515,7 +633,7 @@ private Task StartInProc8AsChildProcessAsync()

try
{
var childProcess = Process.Start(inprocNet8ChildProcessInfo);
var childProcess = Process.Start(childProcessInfo);
if (VerboseLogging == true)
{
ColoredConsole.WriteLine(VerboseColor($"Started child process with ID: {childProcess.Id}"));
Expand Down Expand Up @@ -546,23 +664,21 @@ private Task StartInProc8AsChildProcessAsync()
}
catch (Exception ex)
{
throw new CliException($"Failed to start the in-process model host. {ex.Message}");
throw new CliException($"Failed to start the {(shouldStartNet8ChildProcess ? DotnetConstants.InProc8HostRuntime : DotnetConstants.InProc6HostRuntime)} model host. {ex.Message}");
}

return tcs.Task;
}

private void EnsureNet8FuncExecutablePresent(string inProc8FuncExecutablePath)
private void EnsureFuncExecutablePresent(string funcExecutablePath, bool isInProcNet8)
{
bool net8ExeExist = File.Exists(inProc8FuncExecutablePath);
bool funcExeExist = File.Exists(funcExecutablePath);
if (VerboseLogging == true)
{
ColoredConsole.WriteLine(VerboseColor($"{inProc8FuncExecutablePath} {(net8ExeExist ? "present" : "not present")} "));
ColoredConsole.WriteLine(VerboseColor($"{funcExecutablePath} {(funcExeExist ? "present" : "not present")} "));
}

if (!net8ExeExist)
if (!funcExeExist)
{
throw new CliException($"Failed to locate the in-process model host at {inProc8FuncExecutablePath}");
throw new CliException($"Failed to locate the {(isInProcNet8 ? DotnetConstants.InProc8HostRuntime : DotnetConstants.InProc6HostRuntime)} model host at {funcExecutablePath}");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
using Azure.Functions.Cli.Interfaces;
using Colors.Net;
using Fclp;
using ImTools;
using Microsoft.Azure.AppService.Proxy.Common.Context;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.Azure.WebJobs.Script;
Expand Down
Loading