Hi,
I am having this issue where the disposing of the client fails because of the mentioned exception. The simplest way to repro is the following class. I am using the latest versions of Flurl and Flurl.Http:
The actual code:
public sealed class TestServerFixture : IDisposable
{
private readonly TestServer _server;
private HttpClient _client;
public IFlurlClient Client { get; }
public TestServerFixture()
{
_server = new TestServer(
Program.BuildWebHost());
_client = _server
.CreateClient();
Client = new FlurlClient(_client);
}
public void Dispose()
{
_client.Dispose();
Client.Dispose();
_server.Dispose();
}
}
This show where it fails:

As you can see from the coverage on the left hand side, the client disposing itself does not fail, but the FlurlClient does fail. I looked at the code and it looks like we do not check that the value in the Lazy is not null, but I don't know if that is the reason of the bug.
Confirmed. Thanks for reporting. Will fix this for the next maintenance release.
This fix has been released: https://www.nuget.org/packages/Flurl.Http/2.3.2
Most helpful comment
Confirmed. Thanks for reporting. Will fix this for the next maintenance release.