dotnet / dotnet/aspnetcore

ConfigureTestContainer not working with GenericHost

Open
#14,907 66 comments 51 reactions 0 assignees View on GitHub
affected-medium area-hosting area-networking bug severity-major
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 5h
Merged PRs (30d)
276

Description

### Describe the bug
When using `GenericHost`, in tests `ConfigureTestContainer` is not executed.

### To Reproduce
I've added a test in https://github.com/alefranz/AspNetCore/commit/282c153cfd343498928636780558031f0ab940b2#diff-589b0cebe9e796b47e521f0318393df2R194-R208 to reproduce

### Expected behavior
The delegate provided with `ConfigureTestContainer` should be executed

### Additional context
This happen in 3.x

I'm looking at providing a fix for this but I would probably need some hint on the right place to address this.
Could you also confirm the behavior is not intentional?

@Tratcher I've seen you have worked to add support to `ConfigureTestServices` with `GenericHost` in https://github.com/aspnet/AspNetCore/pull/6585/files#diff-48af505b9d348e7e52da534c4590aef1R36 - Do you think it would need a similar logic to address this as well?

Thank you,
Alessio

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.