Skip to content
New issue

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

System.ArgumentOutOfRangeException when using test server in combination with Yarp #1720

Closed
Erwinvandervalk opened this issue May 16, 2022 · 3 comments
Labels
Type: Bug Something isn't working

Comments

@Erwinvandervalk
Copy link

Erwinvandervalk commented May 16, 2022

Describe the bug

I'm creating a test server for my application and another testserver for the reverse proxy. When I call the proxy, it should forward the call to the application, but instead, I get the following exception:

System.ArgumentOutOfRangeException

To Reproduce

I've included a test project that gives the error for me.
yarp.zip

Yarp.ReverseProxy.Forwarder.HttpForwarder[48]
      ResponseBodyDestination: The destination reported an error when copying the response body.
      System.ArgumentOutOfRangeException:  (Parameter 'count')
      Actual value was 0.
         at Microsoft.AspNetCore.TestHost.ResponseBodyReaderStream.VerifyBuffer(Byte[] buffer, Int32 offset, Int32 count)
         at Microsoft.AspNetCore.TestHost.ResponseBodyReaderStream.ReadAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken)
         at Yarp.ReverseProxy.Forwarder.StreamCopier.CopyAsync(Stream input, Stream output, Int64 promisedContentLength, StreamCopierTelemetry telemetry, ActivityCancellationTokenSource activityToken, CancellationToken cancellation)

Further technical details

Yarp 1.1.0
testhost 6.0.5

@MihaZupan
Copy link
Member

Hey, this looks like a the same kind of issue as #1665 and #1657. It's a bug that manifests when using Yarp 1.1.0 with some stream implementations.
I've filed an issue in AspNetCore to track fixing the TestHost.

@Erwinvandervalk
Copy link
Author

Thanks Miha. Fingers crossed it can / will be fixed :)

@karelz
Copy link
Member

karelz commented May 17, 2022

Triage: Closing as external -- tracked by dotnet/aspnetcore#41692

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants