in src/ServiceProfiler.EventPipe.Otel/Azure.Monitor.OpenTelemetry.Profiler.Core/TraceUploaderProxy.cs [128:153]
private Task<int> CallUploadAsync(string exePath, string args, CancellationToken cancellationToken)
{
return Task.Run(() =>
{
const string executableName = "dotnet";
try
{
IOutOfProcCaller uploaderCaller = _uploaderCallerFactory.Create(executableName, exePath + ' ' + args);
// Assuming dotnet core SDK will always be installed.
int exitCode = uploaderCaller.ExecuteAndWait(ProcessPriorityClass.BelowNormal);
_logger.LogInformation("Call upload trace finished. Exit code: {exitCode}", exitCode);
return exitCode;
}
catch (Exception ex) when (
ex is InvalidOperationException ||
ex is Win32Exception ||
ex is ObjectDisposedException ||
ex is PlatformNotSupportedException)
{
_logger.LogError(ex, "Failed to start uploader process. Make sure the application can access the executable of {executable} by having its directory on PATH environment variable. Check the message for details.", executableName);
return int.MinValue;
}
}, cancellationToken);
}