[dotnet-sdk-7.0.100-preview.3.22118.7] blazorboilerplate "Todo list" page load with System.InvalidOperationExceptionblazorboilerplate "Todo list" page load with System.InvalidOperationException
Junjun-zhao opened this issue · comments
When running the app "blazorboilerplate" with .NET 7.0 Preivew 3 Runtime, failed to load the ToDo list page with an error message "an unhandled exception has occurred".
Please refer to dotnet/aspnetcore#40368 for more details, there is a Breaking change document for the workaroud.
Reproduction Steps
This is .Net 5.0 app, but we are running it on 7.0, machine only have 7.0 installed, and DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX=2, so it runs on 7.0
- Restore database to local db from file
- Launch cmd window.
- Input "set ASPNETCORE_ENVIRONMENT=Development", press "Enter".
- Navigate to blazorboilerplate folder.
- Input "dotnet BlazorBoilerplate.Server.dll", press "Enter".
- Open edge with "https://localhost:5001/" or "http://localhost:5000/".
- Click "Login" button.
- Input "user" into User Name textbox.
- Input password into Password textbox.
- Click "LOGIN" button.
- Click "Todo List" item.
So if I remove constructors, the issue is gone.
@GioviQ Thanks for your update.
Here is the recommended action for this:
Recommended action
If this change severely impacts your ability to migrate your apps to .NET 7, please let us know in the associated discussion thread and we would be happy to reconsider this change. Optionally, there are changes to your application that you may consider to work around this change if it impacts your application:
-
ActivatorUtilitiesConstructorAttribute can be applied to constructor to specify an exact constructor to use.
-
Application developers may register an implementation of IComponentActivator in the DI container that reverts to the .NET 6 behavior.
This is an discussed thread for this breaking change dotnet/aspnetcore#40405. If you have any question about it, you can ask there. Thanks.
@Junjun-zhao thanks for pushing the dev on .NET 7. In my experience from converting to .NET 7 it can be very time consuming and dependences will not be ready. I do not plan on updating BlazorBoilerplate to .NET 7 till the fall when it is closer to release. If you do want to create a branch and push .NET 7 commits there, that would be awesome.