[release/9.0-preview2] #98551 - Regression in DI scope validation #99010
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport of #98661 to release/9.0-preview2
/cc @carlossanlop @christiaanderidder
Description
The automated dependency update PR from
runtime
toaspnetcore
is currently failing: dotnet/aspnetcore#54055Two tests were failing:
WebApplicationBuilder_EnablesServiceScopeValidationByDefaultInDevelopment
(https://github.com/dotnet/aspnetcore/blob/9db62024cbe3c3cb28efe372541fc1bdfcdb375e/src/DefaultBuilder/test/Microsoft.AspNetCore.Tests/WebApplicationTests.cs#L1784)Build_InDevelopment_ConfiguresWithServiceProviderWithScopeValidation
(https://github.com/dotnet/aspnetcore/blob/9db62024cbe3c3cb28efe372541fc1bdfcdb375e/src/Components/WebAssembly/WebAssembly/test/Hosting/WebAssemblyHostBuilderTest.cs#L95)In both cases the failure is of the form "expected an exception to be thrown, but no exception was thrown". Example of failing build: https://github.com/dotnet/aspnetcore/runs/21630956214
I notice that this started after #96254 was merged 2 days ago, and that PR changes the logic around service scope validation. The PR is not meant to affect the behavior (since it's only intended to add caching) but perhaps it does affect the behavior.
Reproduction Steps
Example of failing build: https://github.com/dotnet/aspnetcore/runs/21630956214
Expected behavior
Service scope validation behavior should be unchanged.
Actual behavior
It no longer throws at the same time that it did before.
Regression?
The behavior was correct in commit ad25468, which is the last one we successfully ingested to
dotnet/aspnetcore
. The change must have happened since then.Testing
Unit test included in the fix: #98661
Risk
Low (?)