aspnetcore: Microsoft.AspNetCore.Mvc.Testing is broken in SDK 6.0.201
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
ObjectDisposedException thrown when trying to use the WebApplicationClient targeting SDK 6.0.201.
When reverting to SDK 6.0.200, the issue goes away.
Expected Behavior
ObjectDisposedException should not be thrown.
Steps To Reproduce
Write any test that calls WebApplicationFactory.CreateClient()
Exceptions (if any)
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'ConfigurationManager'.
at Microsoft.Extensions.Configuration.ReferenceCountedProviderManager.AddProvider(IConfigurationProvider provider)
at Microsoft.Extensions.Configuration.ConfigurationManager.AddSource(IConfigurationSource source)
at Microsoft.Extensions.Configuration.ConfigurationManager.Microsoft.Extensions.Configuration.IConfigurationBuilder.Add(IConfigurationSource source)
at Microsoft.AspNetCore.Builder.WebApplicationBuilder.<>c__DisplayClass25_0.<Build>b__2(HostBuilderContext context, IServiceCollection services)
at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider()
at Microsoft.Extensions.Hosting.HostBuilder.Build()
at Microsoft.AspNetCore.Builder.WebApplicationBuilder.Build()
at Program.<Main>$(String[] args) in D:\GIT\Whds.Packing.App\src\Whds.Packing.StateMachine\Program.cs:line 53
.NET Version
6.0.201
Anything else?
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 22 (10 by maintainers)
Minimal repro without Convey:
Edit: You can likely workaround the issue by passing
builder.ConfigurationtoAddConvey()Looks like the issue isn’t related to only the WebApplicationFactory. The exception is also thrown at runtime.
Cool, thanks for your help!