Skip to content

TestServer causes a deadlock #21218

Closed
Closed
@maxcherednik

Description

@maxcherednik

Describe the bug

We have a lot of tests which are written in a way described here:
https://docs.microsoft.com/en-us/aspnet/core/test/integration-tests?view=aspnetcore-3.1#basic-tests-with-the-default-webapplicationfactory

Sometimes WebApplicationFactory + TestServer cause a deadlock while running under xUnit.

This particular line causes this:

host.StartAsync().GetAwaiter().GetResult();

Proposition
Can we have an explicit Start/Stop methods both on WebApplicationFactory and TestServer which could be called from the xunit lifetime interfaces of the fixture?

To Reproduce

You need to have a lot of integration tests starting lots(more than the cores you have) of TestServers in parallel.

Further technical details

  • ASP.NET Core 2.1
  • Rider, VS

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: Attention 👋This issue needs the attention of a contributor, typically because the OP has provided an update.area-hostingIncludes Hostingarea-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions