Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 4 additions & 5 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<MicrosoftAspNetCoreAppPackageVersion>10.0.0-preview.6.25358.103</MicrosoftAspNetCoreAppPackageVersion>
<MicrosoftAspNetCoreAppPackageVersion>10.0.0</MicrosoftAspNetCoreAppPackageVersion>
<MicrosoftAspNetCoreApp9PackageVersion>9.0.4</MicrosoftAspNetCoreApp9PackageVersion>
<MicrosoftAspNetCoreApp8PackageVersion>8.0.15</MicrosoftAspNetCoreApp8PackageVersion>
<GrpcDotNetPackageVersion>2.70.0</GrpcDotNetPackageVersion>
<OpenTelemetryPackageVersion>1.6.0</OpenTelemetryPackageVersion>
<OpenTelemetryIntergationPackageVersion>1.8.1</OpenTelemetryIntergationPackageVersion>
<OpenTelemetryGrpcPackageVersion>1.8.0-beta.1</OpenTelemetryGrpcPackageVersion>
<MicrosoftExtensionsPackageVersion>10.0.0-preview.6.25358.103</MicrosoftExtensionsPackageVersion>
<MicrosoftExtensionsPackageVersion>10.0.0</MicrosoftExtensionsPackageVersion>
<MicrosoftExtensionsLtsPackageVersion>8.0.0</MicrosoftExtensionsLtsPackageVersion>
</PropertyGroup>
<ItemGroup>
Expand Down Expand Up @@ -65,7 +65,7 @@
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
<PackageVersion Include="Microsoft.Build.Locator" Version="1.5.5" />
<PackageVersion Include="Microsoft.Build" Version="17.3.2" />
<PackageVersion Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="10.0.0-preview.25358.103" />
<PackageVersion Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="10.0.100" />
<PackageVersion Include="Microsoft.Crank.EventSources" Version="0.2.0-alpha.25128.2" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
Expand All @@ -76,8 +76,7 @@
<PackageVersion Include="NUnit3TestAdapter" Version="5.0.0" />
<PackageVersion Include="protobuf-net.Grpc.AspNetCore" Version="1.0.140" />
<PackageVersion Include="protobuf-net.Grpc" Version="1.0.140" />
<PackageVersion Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
<PackageVersion Include="System.CommandLine.Rendering" Version="0.4.0-alpha.22272.1" />
<PackageVersion Include="System.CommandLine" Version="2.0.0" />
<PackageVersion Include="System.Diagnostics.DiagnosticSource" Version="6.0.1" />
<PackageVersion Include="System.Memory" Version="4.5.3" />
<PackageVersion Include="System.Net.Http.WinHttpHandler" Version="8.0.3" />
Expand Down
4 changes: 2 additions & 2 deletions examples/Container/Backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/sdk:10.0-preview AS build-env
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build-env
WORKDIR /app

# Copy everything
Expand All @@ -8,7 +8,7 @@ RUN dotnet restore examples/Container/Backend
RUN dotnet publish examples/Container/Backend -c Release -o out

# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:10.0-preview
FROM mcr.microsoft.com/dotnet/aspnet:10.0
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "Backend.dll"]
4 changes: 2 additions & 2 deletions examples/Container/Frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/sdk:10.0-preview AS build-env
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build-env
WORKDIR /app

# Copy everything
Expand All @@ -8,7 +8,7 @@ RUN dotnet restore examples/Container/Frontend
RUN dotnet publish examples/Container/Frontend -c Release -o out

# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:10.0-preview
FROM mcr.microsoft.com/dotnet/aspnet:10.0
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "Frontend.dll"]
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "10.0.100-preview.6.25358.103",
"version": "10.0.100",
"rollForward": "latestFeature"
}
}
115 changes: 58 additions & 57 deletions perf/benchmarkapps/GrpcClient/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,66 +62,66 @@ class Program

public static async Task<int> Main(string[] args)
{
var urlOption = new Option<Uri>(new string[] { "-u", "--url" }, "The server url to request") { IsRequired = true };
var udsFileNameOption = new Option<string>(new string[] { "--udsFileName" }, "The Unix Domain Socket file name");
var namedPipeNameOption = new Option<string>(new string[] { "--namedPipeName" }, "The Named Pipe name");
var connectionsOption = new Option<int>(new string[] { "-c", "--connections" }, () => 1, "Total number of connections to keep open");
var warmupOption = new Option<int>(new string[] { "-w", "--warmup" }, () => 5, "Duration of the warmup in seconds");
var durationOption = new Option<int>(new string[] { "-d", "--duration" }, () => 10, "Duration of the test in seconds");
var callCountOption = new Option<int?>(new string[] { "--callCount" }, "Call count of test");
var scenarioOption = new Option<string>(new string[] { "-s", "--scenario" }, "Scenario to run") { IsRequired = true };
var latencyOption = new Option<bool>(new string[] { "-l", "--latency" }, () => false, "Whether to collect detailed latency");
var protocolOption = new Option<string>(new string[] { "-p", "--protocol" }, "HTTP protocol") { IsRequired = true };
var logOption = new Option<LogLevel>(new string[] { "-log", "--logLevel" }, () => LogLevel.None, "The log level to use for Console logging");
var requestSizeOption = new Option<int>(new string[] { "--requestSize" }, "Request payload size");
var responseSizeOption = new Option<int>(new string[] { "--responseSize" }, "Response payload size");
var grpcClientTypeOption = new Option<GrpcClientType>(new string[] { "--grpcClientType" }, () => GrpcClientType.GrpcNetClient, "Whether to use Grpc.NetClient or Grpc.Core client");
var streamsOption = new Option<int>(new string[] { "--streams" }, () => 1, "Maximum concurrent streams per connection");
var enableCertAuthOption = new Option<bool>(new string[] { "--enableCertAuth" }, () => false, "Flag indicating whether client sends a client certificate");
var deadlineOption = new Option<int>(new string[] { "--deadline" }, "Duration of deadline in seconds");
var winHttpHandlerOption = new Option<bool>(new string[] { "--winhttphandler" }, () => false, "Whether to use WinHttpHandler with Grpc.Net.Client");
var urlOption = new Option<Uri>("--url", ["-u"]) { Description = "The server url to request", Required = true };
var udsFileNameOption = new Option<string>("--udsFileName") { Description = "The Unix Domain Socket file name" };
var namedPipeNameOption = new Option<string>("--namedPipeName") { Description = "The Named Pipe name" };
var connectionsOption = new Option<int>("--connections", ["-c"]) { DefaultValueFactory = (r) => 1, Description = "Total number of connections to keep open" };
var warmupOption = new Option<int>("--warmup", ["-w"]) { DefaultValueFactory = (r) => 5, Description = "Duration of the warmup in seconds" };
var durationOption = new Option<int>("--duration", ["-d"]) { DefaultValueFactory = (r) => 10, Description = "Duration of the test in seconds" };
var callCountOption = new Option<int?>("--callCount") { Description = "Call count of test" };
var scenarioOption = new Option<string>("--scenario", ["-s"]) { Description = "Scenario to run", Required = true };
var latencyOption = new Option<bool>("--latency", ["-l"]) { DefaultValueFactory = (r) => false, Description = "Whether to collect detailed latency" };
var protocolOption = new Option<string>("--protocol", ["-p"]) { Description = "HTTP protocol", Required = true };
var logOption = new Option<LogLevel>("--logLevel", ["-log"]) { DefaultValueFactory = (_) => LogLevel.None, Description = "The log level to use for Console logging" };
var requestSizeOption = new Option<int>("--requestSize") { Description = "Request payload size" };
var responseSizeOption = new Option<int>("--responseSize") { Description = "Response payload size" };
var grpcClientTypeOption = new Option<GrpcClientType>("--grpcClientType") { DefaultValueFactory = (r) => GrpcClientType.GrpcNetClient, Description = "Whether to use Grpc.NetClient or Grpc.Core client" };
var streamsOption = new Option<int>("--streams") { DefaultValueFactory = (r) => 1, Description = "Maximum concurrent streams per connection" };
var enableCertAuthOption = new Option<bool>("--enableCertAuth") { DefaultValueFactory = (r) => false, Description = "Flag indicating whether client sends a client certificate" };
var deadlineOption = new Option<int>("--deadline") { Description = "Duration of deadline in seconds" };
var winHttpHandlerOption = new Option<bool>("--winhttphandler") { DefaultValueFactory = (r) => false, Description = "Whether to use WinHttpHandler with Grpc.Net.Client" };

var rootCommand = new RootCommand();
rootCommand.AddOption(urlOption);
rootCommand.AddOption(udsFileNameOption);
rootCommand.AddOption(namedPipeNameOption);
rootCommand.AddOption(connectionsOption);
rootCommand.AddOption(warmupOption);
rootCommand.AddOption(durationOption);
rootCommand.AddOption(callCountOption);
rootCommand.AddOption(scenarioOption);
rootCommand.AddOption(latencyOption);
rootCommand.AddOption(protocolOption);
rootCommand.AddOption(logOption);
rootCommand.AddOption(requestSizeOption);
rootCommand.AddOption(responseSizeOption);
rootCommand.AddOption(grpcClientTypeOption);
rootCommand.AddOption(streamsOption);
rootCommand.AddOption(enableCertAuthOption);
rootCommand.AddOption(deadlineOption);
rootCommand.AddOption(winHttpHandlerOption);

rootCommand.SetHandler(async (InvocationContext context) =>
rootCommand.Add(urlOption);
rootCommand.Add(udsFileNameOption);
rootCommand.Add(namedPipeNameOption);
rootCommand.Add(connectionsOption);
rootCommand.Add(warmupOption);
rootCommand.Add(durationOption);
rootCommand.Add(callCountOption);
rootCommand.Add(scenarioOption);
rootCommand.Add(latencyOption);
rootCommand.Add(protocolOption);
rootCommand.Add(logOption);
rootCommand.Add(requestSizeOption);
rootCommand.Add(responseSizeOption);
rootCommand.Add(grpcClientTypeOption);
rootCommand.Add(streamsOption);
rootCommand.Add(enableCertAuthOption);
rootCommand.Add(deadlineOption);
rootCommand.Add(winHttpHandlerOption);

rootCommand.SetAction(async (ParseResult context) =>
{
_options = new ClientOptions();
_options.Url = context.ParseResult.GetValueForOption(urlOption);
_options.UdsFileName = context.ParseResult.GetValueForOption(udsFileNameOption);
_options.NamedPipeName = context.ParseResult.GetValueForOption(namedPipeNameOption);
_options.Connections = context.ParseResult.GetValueForOption(connectionsOption);
_options.Warmup = context.ParseResult.GetValueForOption(warmupOption);
_options.Duration = context.ParseResult.GetValueForOption(durationOption);
_options.CallCount = context.ParseResult.GetValueForOption(callCountOption);
_options.Scenario = context.ParseResult.GetValueForOption(scenarioOption);
_options.Latency = context.ParseResult.GetValueForOption(latencyOption);
_options.Protocol = context.ParseResult.GetValueForOption(protocolOption);
_options.LogLevel = context.ParseResult.GetValueForOption(logOption);
_options.RequestSize = context.ParseResult.GetValueForOption(requestSizeOption);
_options.ResponseSize = context.ParseResult.GetValueForOption(responseSizeOption);
_options.GrpcClientType = context.ParseResult.GetValueForOption(grpcClientTypeOption);
_options.Streams = context.ParseResult.GetValueForOption(streamsOption);
_options.EnableCertAuth = context.ParseResult.GetValueForOption(enableCertAuthOption);
_options.Deadline = context.ParseResult.GetValueForOption(deadlineOption);
_options.WinHttpHandler = context.ParseResult.GetValueForOption(winHttpHandlerOption);
_options.Url = context.GetValue(urlOption);
_options.UdsFileName = context.GetValue(udsFileNameOption);
_options.NamedPipeName = context.GetValue(namedPipeNameOption);
_options.Connections = context.GetValue(connectionsOption);
_options.Warmup = context.GetValue(warmupOption);
_options.Duration = context.GetValue(durationOption);
_options.CallCount = context.GetValue(callCountOption);
_options.Scenario = context.GetValue(scenarioOption);
_options.Latency = context.GetValue(latencyOption);
_options.Protocol = context.GetValue(protocolOption);
_options.LogLevel = context.GetValue(logOption);
_options.RequestSize = context.GetValue(requestSizeOption);
_options.ResponseSize = context.GetValue(responseSizeOption);
_options.GrpcClientType = context.GetValue(grpcClientTypeOption);
_options.Streams = context.GetValue(streamsOption);
_options.EnableCertAuth = context.GetValue(enableCertAuthOption);
_options.Deadline = context.GetValue(deadlineOption);
_options.WinHttpHandler = context.GetValue(winHttpHandlerOption);

var runtimeVersion = typeof(object).GetTypeInfo().Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion ?? "Unknown";
var isServerGC = GCSettings.IsServerGC;
Expand Down Expand Up @@ -160,7 +160,8 @@ public static async Task<int> Main(string[] args)

Log("gRPC Client");

return await rootCommand.InvokeAsync(args);
var result = rootCommand.Parse(args);
return await result.InvokeAsync();
}

#if NET9_0_OR_GREATER
Expand Down
38 changes: 19 additions & 19 deletions src/dotnet-grpc/Commands/AddFileCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#region Copyright notice and license
#region Copyright notice and license

// Copyright 2019 The gRPC Authors
//
Expand All @@ -25,7 +25,7 @@ namespace Grpc.Dotnet.Cli.Commands;

internal sealed class AddFileCommand : CommandBase
{
public AddFileCommand(IConsole console, string? projectPath, HttpClient httpClient)
public AddFileCommand(ConsoleService console, string? projectPath, HttpClient httpClient)
: base(console, projectPath, httpClient) { }

public static Command Create(HttpClient httpClient)
Expand All @@ -38,40 +38,40 @@ public static Command Create(HttpClient httpClient)
var serviceOption = CommonOptions.ServiceOption();
var additionalImportDirsOption = CommonOptions.AdditionalImportDirsOption();
var accessOption = CommonOptions.AccessOption();
var filesArgument = new Argument<string[]>
var filesArgument = new Argument<string[]>("files")
{
Name = "files",
Description = CoreStrings.AddFileCommandArgumentDescription,
Arity = ArgumentArity.OneOrMore
};

command.AddOption(projectOption);
command.AddOption(serviceOption);
command.AddOption(accessOption);
command.AddOption(additionalImportDirsOption);
command.AddArgument(filesArgument);
command.Add(projectOption);
command.Add(serviceOption);
command.Add(accessOption);
command.Add(additionalImportDirsOption);
command.Add(filesArgument);

command.SetHandler(
command.SetAction(
async (context) =>
{
var project = context.ParseResult.GetValueForOption(projectOption);
var services = context.ParseResult.GetValueForOption(serviceOption);
var access = context.ParseResult.GetValueForOption(accessOption);
var additionalImportDirs = context.ParseResult.GetValueForOption(additionalImportDirsOption);
var files = context.ParseResult.GetValueForArgument(filesArgument);
var project = context.GetValue(projectOption);
var services = context.GetValue(serviceOption);
var access = context.GetValue(accessOption);
var additionalImportDirs = context.GetValue(additionalImportDirsOption);
var files = context.GetValue(filesArgument) ?? [];

var console = new ConsoleService(context.InvocationConfiguration.Output, context.InvocationConfiguration.Error);
try
{
var command = new AddFileCommand(context.Console, project, httpClient);
var command = new AddFileCommand(console, project, httpClient);
await command.AddFileAsync(services, access, additionalImportDirs, files);

context.ExitCode = 0;
return 0;
}
catch (CLIToolException e)
{
context.Console.LogError(e);
console.LogError(e);

context.ExitCode = -1;
return -1;
}
});

Expand Down
Loading
Loading