Skip to content

The synchronous method is not supported by 'Microsoft.AspNetCore.TestHost.ClientHandler' #44464

@code-jar

Description

@code-jar

In dotnet 6.0, HttpMessageHandler provides the synchronous sending method HttpResponseMessage Send(HttpRequestMessage request, CancellationToken cancellationToken)

Microsoft.AspNetCore.TestHost.ClientHandler inherit HttpMessageHandler Not implemented synchronous sending method Send

Failing Test(s)

image

Stacktrace

System.NotSupportedException: The synchronous method is not supported by 'Microsoft.AspNetCore.TestHost.ClientHandler'.
 If you're using a custom 'HttpMessageHandler' and wish to use synchronous HTTP methods, you must override its 'Send' virtual method.
   at System.Net.Http.HttpMessageHandler.Send(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.DelegatingHandler.Send(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.DelegatingHandler.Send(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.DelegatingHandler.Send(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpMessageInvoker.Send(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.Send(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.Send(HttpRequestMessage request)

Metadata

Metadata

Assignees

Labels

area-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionshelp wantedUp for grabs. We would accept a PR to help resolve this issue

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions