mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 14:20:29 +01:00
Bug: Server not listening after Start() returns (on macOS) #37
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 @benjamin-bader on GitHub (Aug 19, 2017).
Originally assigned to: @StefH on GitHub.
Hi, I just ported a project from .NET 4.5 to .NET Core 2.0 on macOS. I noticed that a unit test using FluentMockServer started failing with
System.Net.Http.CurlException : Couldn't connect to server.When I add
Thread.Sleep(100)after starting the server, the error goes away. I'm assuming that, on macOS at least, the underlying server implementation is a bit more asynchronous than that on .NET proper (or on Mono). I notice thatFluentMockServer.Start(...)callsStartAsyncon its inner HTTP server. Is there a way to wait for that async start to finish that's more reliable than putting the test thread to sleep?@StefH commented on GitHub (Aug 19, 2017):
Can you post the full code where you put the Thread.Sleep()?
@benjamin-bader commented on GitHub (Aug 19, 2017):
I can't post the actual source (proprietary, etc), but here's the essence. It's an xunit test class:
@skunkworks commented on GitHub (Sep 26, 2017):
I can confirm that I've had the same issue with WireMock.NET not starting up the server in time on MacOS.
@StefH commented on GitHub (Sep 26, 2017):
Are you running on netcore 1.x or 2.0 ?
@skunkworks commented on GitHub (Sep 26, 2017):
@StefH This is on .NET Core 2.0. Adding a 100ms thread sleep works around the issue for us.
@StefH commented on GitHub (Sep 27, 2017):
@skunkworks OK. Clear.
I was wondering if there is an environment setting to see if I'm running on Linux, Windows or MacOS... I'll investigate this.
@benjamin-bader commented on GitHub (Sep 27, 2017):
What do you think about returning a
Taskin the publicFluentMockServerAPI? The inner HTTP server already seems to, but the server doesn't do anything with it.Alternately, why not block on the task returned by the inner HTTP server?
@StefH commented on GitHub (Sep 30, 2017):
Should be fixed. Download source or use latest NuGet version
1.0.2.4-preview-02.@StefH commented on GitHub (Oct 3, 2017):
@benjamin-bader and @skunkworks : were you able to test this new source-code / NuGet ?
@skunkworks commented on GitHub (Oct 4, 2017):
We'll give it a shot and report back. Thanks for the fix!
@sdcoffey commented on GitHub (Oct 5, 2017):
@StefH looks like this update worked, thanks for the quick fix!
@StefH commented on GitHub (Oct 11, 2017):
@skunkworks : I close this issue now, if you have more troubles, create a new issue.