ArangoDB-Community / arangodb-net-standard

A consistent, comprehensive, minimal interface to enable .NET applications to use the complete range of features exposed by the ArangoDB REST API.
Apache License 2.0
77 stars 30 forks source link

Allow controlling the disposal of provided transport and HTTP client instances #481

Closed DiscoPYF closed 11 months ago

DiscoPYF commented 1 year ago

From discussion on #457

We propose to add a boolean parameter to ArangoDBClient/HttpApiTransport constructors that controls whether the provided instances of transport/HTTP client are disposed when the holding instance is disposed.

The default value of the new boolean parameter must preserve the current behavior (dispose instances) to avoid a breaking change for consumers.

DiscoPYF commented 11 months ago

I added the parameter on HttpApiTransport and created a unit test to make sure the parameter works as expected.

I am encountering a weird behavior with XUnit. As soon as I add a new test method, the Dispose() method of ApiClientTestFixtureBase is called in the middle of the test run before all tests in HttpApiTransportTest finished running.

Can anyone reproduce this? FYI @rossmills99

For example, on latest master, I add a new test method MyNewTest. See screenshots below:

DiscoPYF commented 11 months ago

I tried updating the XUnit package to latest version, same issue.

rossmills99 commented 11 months ago

I can reproduce your results. The issue goes away if I make the signature of the new method async Task instead of void.

DiscoPYF commented 11 months ago

Thanks @rossmills99 !

I still get the issue on my machine even when all tests methods are async Task. 🤔 I opened a pull request and the CI builds work fine, so it should be good?