Skip to content

Microsoft.AspNetCore.Mvc.Testing is broken in SDK 6.0.201 #40614

@philip-reed

Description

@philip-reed

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

Metadata

Metadata

Assignees

Labels

bugThis issue describes a behavior which is not expected - a bug.feature-mvc-testingMVC testing packageold-area-web-frameworks-do-not-use*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions