mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 21:10:32 +01:00
WireMock Server does not appear to function correctly with Microsoft.Extensions v3.1 #239
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @dalmuti509 on GitHub (Dec 23, 2019).
If project nuget packages are updated to include Microsoft.Extensions v3.1 nuget libraries, the WireMock server seems to stop correctly responding to requests as all responses result in an invalid format status code 0 when responses are received from HttpClient.
Simple repro which returns 0 after an extended timeout:
This can be run on line 14 at: WireMock.Net/examples/WireMock.Net.StandAlone.Net461/Program.cs
Update the project to the latest nugets to see the failure.
@jlobec commented on GitHub (Feb 20, 2020):
Should an "await" be used instead of ."Result" when getting the HttpClient response on this snippet? AFAIK the .Result is only correct if you're absolutely sure that the task is already completed (which I'm afraid is not the case) and could cause deadlocks
Maybe not directly related with the issue topic but will save time in the future :)
@StefH commented on GitHub (Feb 20, 2020):
Could be.
Better code should be '.GetAwaiter().GetResult()' I think.
@NoahLerner commented on GitHub (Feb 22, 2020):
Looks to me like best practice is using
async awaitas apposed toGetAwaiter. Microsoft documentation indicates thatGetAwaiteris not intended to be used in application code.@StefH commented on GitHub (Apr 3, 2020):
closing..