-
-
Notifications
You must be signed in to change notification settings - Fork 734
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
[BUG] Refit + Fusillade fails with System.ObjectDisposedException #1048
Comments
This looks like a bug in Fusillade. I added a test for parallel requests and it's passing with the mock handler: https://github.com/reactiveui/refit/blob/main/Refit.Tests/RestService.cs#L1003-L1033 If Fusillade is improperly disposing things, that could be interfering.
|
Looking a little closer, Refit always disposes it's underlying HttpRequestMessage when a concrete type is returned. If Fusillade is caching things, that would break. |
Thanks for your timely reply! 👍 |
Closing as external. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Describe the bug
Actually the same as #460 witch is closed but not fixed.
Using Refit with Fusillade fails with System.ObjectDisposedException: Cannot access a disposed object. Object name: 'System.Net.Http.HttpConnectionResponseContent'.
The exception is thrown at Refit.RequestBuilderImplementation.d__15`1.MoveNext() in /_/Refit/RequestBuilderImplementation.cs:line 324
It seems that when Fusillade deduplicates requests returning val.Response.ToTask(cancellationToken), Refit fails deserializing HttpContent because it's disposed.
Steps To Reproduce
Create a Refit RestService with any Fusillade's NetCache HttpMessageHandler into the HttpClient, and send the same request at least twice at the same time.
Something dummy like:
with IReqResService:
and Models:
Well interface and models are not the point, it's just to illustrate the bug.
Note that everything succeed when using Fusillade without Refit, I mean using HttpClient directly like:
Note that everything succeed to, when using Refit without Fusillade like:
So it's only when using both of it.
Expected behavior
Should return result
Environment
The text was updated successfully, but these errors were encountered: