We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Grpc.Net.ClientFactory 2.66.0 Google.Protobuf 3.25.2
Windows
dotnet --info
.net8
If possible, provide a recipe for reproducing the error. Try being specific and include code snippets if helpful.
We have the following IServiceCollection extension methods:
IServiceCollection
AddWrappedStreamGrpcClient(IServiceCollection serviceCollection) { serviceCollection .AddGrpcClient<MyService.MyClient>() .AddCustomCallCredentials(); serviceCollection.AddTransient<IStreamRpcWrapper, StreamRpcWrapper> } ---- AddWrappedQeuryGrpcClient(IServiceCollection serviceCollection) { serviceCollection .AddGrpcClient<MyService.MyClient>() .AddCustomCallCredentials(); serviceCollection.AddTransient<IQueryRpcWrapper, QueryRpcWrapper>(); }
Where both wrappers take MyService.MyClient into their constructor.
MyService.MyClient
When doing the following:
builder.Services.AddWrappedStreamGrpcClient().AddWrappedQeuryGrpcClient()
I'd expect both of my wrapper classes to get separate instances of grpc client, as far as the classes are concerned.
Due to double-instantiation, request header is somehow doubled. And not two headers, but two values in a single header:
Authorization: Bearer ey<...>, Bearer ey<...>
.AddCustomCallCredentials() doesn't do anything outlandish, and I even tried to prevent it from adding metadata again:
.AddCustomCallCredentials()
foreach (var entry in metadata) { if (entry.Key == "Authorization") return; } var token = (await tokenHelper.GetTokens()).AccessToken.Value; if (string.IsNullOrEmpty(token)) { throw new ArgumentNullException(token); } metadata.Add("Authorization", $"Bearer {token}"); }
I suppose I could redo the interface into:
AddSystemPrerequisites(); // register client + auth here AddWrappedStreamGrpcClient(); AddWrappedQeuryGrpcClient();
but I was wondering if this behavior is intented.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
What version of gRPC and what language are you using?
Grpc.Net.ClientFactory 2.66.0
Google.Protobuf 3.25.2
What operating system (Linux, Windows,...) and version?
Windows
What runtime / compiler are you using (e.g. .NET Core SDK version
dotnet --info
).net8
What did you do?
If possible, provide a recipe for reproducing the error. Try being specific and include code snippets if helpful.
We have the following
IServiceCollection
extension methods:Where both wrappers take
MyService.MyClient
into their constructor.What did you expect to see?
When doing the following:
I'd expect both of my wrapper classes to get separate instances of grpc client, as far as the classes are concerned.
What did you see instead?
Due to double-instantiation, request header is somehow doubled. And not two headers, but two values in a single header:
Anything else we should know about your project / environment?
.AddCustomCallCredentials()
doesn't do anything outlandish, and I even tried to prevent it from adding metadata again:I suppose I could redo the interface into:
but I was wondering if this behavior is intented.
The text was updated successfully, but these errors were encountered: