-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
The static handlers here are causing any call to ClientFactory.Build() to fail after a request on a previous built client has been issued:
source-generator/stage/dotnet/dotnet-sdk/src/Client/ClientFactory.cs
Lines 20 to 26 in fcf6805
| private static readonly Lazy<List<DelegatingHandler>> s_handlers = | |
| new(() => | |
| [ | |
| new APIVersionHandler(), | |
| new UserAgentHandler(), | |
| new RateLimitHandler(), | |
| ]); |
The Kiota default handlers are created every time, so they get a new instance per client. But these 3 static handlers are re-used for every client, which results in the _operationStarted = true being set on the handler the first time any client has issued a request.
When ChainHandlersCollectionAndGetFirstLink is called, it attempts to set the InnerHandler on each handler in the chain:
This results in an exception, when trying to set the InnerHandler:
The exception is:
System.InvalidOperationException: This instance has already started one or more requests. Properties can only be modified before sending the first request.
at System.Net.Http.DelegatingHandler.CheckDisposedOrStarted()
at System.Net.Http.DelegatingHandler.set_InnerHandler(HttpMessageHandler value)
at GitHub.Octokit.Client.ClientFactory.ChainHandlersCollectionAndGetFirstLink(HttpMessageHandler finalHandler, DelegatingHandler[] handlers)
at GitHub.Octokit.Client.ClientFactory.Build()
haisum
Metadata
Metadata
Assignees
Labels
No labels


