MyTested.AspNetCore.Mvc icon indicating copy to clipboard operation
MyTested.AspNetCore.Mvc copied to clipboard

Add .NET 6 Support

Open jayharris opened this issue 2 years ago • 3 comments

Revised all projects to build with .NET 6 and use AspNetCore v6 / EF Core v6 packages. Addressed issues within the codebase so that all unit tests pass.

About 100 unit tests were broken, including most within Options, EFCore, Samples, and Razor Compiler Services.

Compiler Services and all Samples were resolved by adding a NullFileProvider to the ContentRootFileProvider property within the host environment. Several of these tests were failing because DefaultActionDescriptorCollectionProvider was throwing a NullReferenceException when trying to access its own FileProvider, which defaults to the ContentRootFileProvider (which wasn't getting set).

EFCore tests were breaking on double-registered DbContextImplementation, resolved by changing to TryAddScope instead of AddScope. TryAddScope is a no-op if already registered.

Options was failing on the OptionsTestPlugin service selector; the implementation for IOptions<> changed from OptionsManager<> to the new UnnamedOptionsManager<> in AspNetCore 6. However, UnnamedOptionsManager is an internal class, so the plugin's service selector is doing a comparison on Type.FullName, rather than a strongly-typed comparison to Type.

Note: One project, MyTested.AspNetCore.Mvc.Versioning, remains at Microsoft.AspNetCore.Mvc.Versioning v5, since there is v6 release of Microsoft.AspNetCore.Mvc.Versioning.

jayharris avatar Jan 29 '22 09:01 jayharris

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Jan 29 '22 09:01 CLAassistant

This PR does not support the new startup style that unifies Program.cs with Startup.cs and eliminates the Configure and ConfigureServices methods (https://docs.microsoft.com/en-us/aspnet/core/fundamentals/startup?view=aspnetcore-6.0). This PR focuses on existing applications that have been upgraded to .NET 6, rather than new applications that were created from a .NET 6 template.

jayharris avatar Jan 30 '22 18:01 jayharris

Is this PR going to be merged soon, what is the plan?

botrot avatar Jun 16 '22 06:06 botrot

i think this project is dead TBH the OC stated in an issue that he is barely touching this now

clmcgrath avatar Feb 08 '23 23:02 clmcgrath

Resolved #405

kalintsenkov avatar Nov 20 '23 07:11 kalintsenkov