Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConfigureTestContainer not being invoked #51381

Closed
1 task done
paulomorgado opened this issue Oct 14, 2023 · 2 comments
Closed
1 task done

ConfigureTestContainer not being invoked #51381

paulomorgado opened this issue Oct 14, 2023 · 2 comments
Labels
area-hosting Includes Hosting ✔️ Resolution: Duplicate Resolved as a duplicate of another issue Status: Resolved
Milestone

Comments

@paulomorgado
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

When a ConfigureTestContainer action is register through WebHostBuilder.ConfigureTestContainer, the action is not invoked.

Expected Behavior

The action should be invoked.

Steps To Reproduce

I've adapted the test ServicesCanBeOverridenForTestingAsync to:

var builder = new WebHostBuilder()
    .UseStartup<ThirdPartyContainerStartup>()
    .ConfigureTestServices(services =>
    {
        Console.WriteLine("WebHostBuilder.ConfigureTestServices");
    })
    .ConfigureTestContainer<ThirdPartyContainer>(container =>
    {
        Console.WriteLine("WebHostBuilder.ConfigureTestContainer");
    })
    ;

var host = new TestServer(builder);

public class ThirdPartyContainerStartup
{
    public void ConfigureServices(IServiceCollection services)
    {
        Console.WriteLine("ThirdPartyContainerStartup.ConfigureServices");
    }
    public void ConfigureContainer(IServiceCollection services)
    {
        Console.WriteLine("ThirdPartyContainerStartup.ConfigureContainer");
    }
    public void Configure(IApplicationBuilder app)
    {
        Console.WriteLine("ThirdPartyContainerStartup.Configure");
    }
}
public class ThirdPartyContainer
{
    public IServiceCollection Services { get; set; }
}
public class ThirdPartyContainerServiceProviderFactory : IServiceProviderFactory<ThirdPartyContainer>
{
    public ThirdPartyContainer CreateBuilder(IServiceCollection services) => new ThirdPartyContainer { Services = services };
    public IServiceProvider CreateServiceProvider(ThirdPartyContainer containerBuilder) => containerBuilder.Services.BuildServiceProvider();
}

And the output is:

ThirdPartyContainerStartup.ConfigureServices
WebHostBuilder.ConfigureTestServices
ThirdPartyContainerStartup.ConfigureContainer
ThirdPartyContainerStartup.Configure

Exceptions (if any)

No response

.NET Version

.NET SDK 8.0.100-rc.2.23502.2

Anything else?

No response

@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label Used by the dotnet-issue-labeler to label those issues which couldn't be triaged automatically label Oct 14, 2023
@gfoidl gfoidl added area-hosting Includes Hosting and removed needs-area-label Used by the dotnet-issue-labeler to label those issues which couldn't be triaged automatically labels Oct 14, 2023
@surayya-MS surayya-MS added this to the Backlog milestone Nov 1, 2023
@ghost
Copy link

ghost commented Nov 1, 2023

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@halter73 halter73 added ✔️ Resolution: Duplicate Resolved as a duplicate of another issue and removed investigate labels Nov 1, 2023
@ghost ghost added the Status: Resolved label Nov 1, 2023
@halter73
Copy link
Member

halter73 commented Nov 1, 2023

Given that WebApplicationBuilder uses the generic host internally, I think this is a dupe of #14907.

@halter73 halter73 closed this as completed Nov 1, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Dec 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-hosting Includes Hosting ✔️ Resolution: Duplicate Resolved as a duplicate of another issue Status: Resolved
Projects
None yet
Development

No branches or pull requests

4 participants