Microsoft.AspNetCore.Mvc.Testing is broken in SDK 6.0.201
See original GitHub issueIs 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
Issue Analytics
- State:
- Created 2 years ago
- Comments:22 (10 by maintainers)
Top Results From Across the Web
CS2015 ~\6.0.201\Sdks\Microsoft.NET.Sdk.Web\analyzers ...
When i try to compile my asp.net core 5.0 application i am getting this error -Error CS2015 'C:\Program Files\dotnet\sdk\6.0.201\Sdks\Microsoft.
Read more >Why I couldn't use Microsoft.AspNetCore.Mvc; in my unit ...
AspNetCore.Mvc in unit testing project because unit testing project is a separate project and it does not contain library Microsoft.AspNetCore.
Read more >NETSDK1045: The current .NET SDK does not support ...
This error occurs when the build tools can't find the version of the .NET SDK that's needed to build a project. This is...
Read more >NET 6 MVC enabling razor runtime compilation breaks ...
I followed the simple steps at https://learn.microsoft.com/en-us/aspnet/core/mvc/views/view-compilation?view=aspnetcore-6.0&tabs=visual-studio ...
Read more >Microsoft.AspNetCore.Mvc.Testing 7.0.10
Version Downloads Last updated
8.0.0‑preview.7.23375.9 3,329 12 days ago
8.0.0‑preview.6.23329.11 7,333 a month ago
8.0.0‑preview.5.23302.2 5,236 2 months ago
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Minimal repro without Convey:
Edit: You can likely workaround the issue by passing
builder.Configuration
toAddConvey()
Looks like the issue isn’t related to only the WebApplicationFactory. The exception is also thrown at runtime.