Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[9.0.100-rc.1.24406.1] EasyCMS app launch failed with 'Multiple constructors accepting all given argument types have been found in type 'Microsoft.AspNetCore.CookiePolicy.CookiePolicyMiddleware' exception #21

Open
CancanTang opened this issue Oct 25, 2024 · 0 comments

Comments

@CancanTang
Copy link

We are doing Application compatibility testing with the application against the latest .NET 9 SDK. When running the application with the .NET 9.0 build (9.0.100-rc.1.24406.1), it failed launch with below exception message:
System.InvalidOperationException: 'Multiple constructors accepting all given argument types have been found in type 'Microsoft.AspNetCore.CookiePolicy.CookiePolicyMiddleware'. There should only be one applicable constructor.'

After the investigation, it is related to a .NET 9 breaking change aspnet/Announcements#514

Recommended action
If this happens and you can't upgrade to a dependency injection container that implements IServiceProviderIsService, you can add ActivatorUtilitiesConstructorAttribute to the preferred constructor of the affected middleware type.

Steps To Reproduce

  1. Open "..\EasyCMS\App\Atlass.Framework.Web.runtimeconfig.json" file .
  2. Change the "Atlass.Framework.Web.runtimeconfig.json" file to let the app run against with dotnet-sdk-9.0.100-rc.1.24406.1
"framework": {
      "name": "Microsoft.AspNetCore.App",
      "version": "9.0.0-rc.1.24405.8"
    },
  1. Launch ..\EasyCMS\App\Atlass.Framework.Web.exe.

Expected Result:
Launch successfully.

Actual Result:
Launch failed with below error in Command prompt window:

Please refer to more information from dotnet/aspnetcore#57231

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant