enkodellc / blazorboilerplate

Blazor Boilerplate / Starter Template with MudBlazor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[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

  1. Restore database to local db from file
  2. Launch cmd window.
  3. Input "set ASPNETCORE_ENVIRONMENT=Development", press "Enter".
  4. Navigate to blazorboilerplate folder.
  5. Input "dotnet BlazorBoilerplate.Server.dll", press "Enter".
  6. Open edge with "https://localhost:5001/" or "http://localhost:5000/".
  7. Click "Login" button.
  8. Input "user" into User Name textbox.
  9. Input password into Password textbox.
  10. Click "LOGIN" button.
  11. 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.

commented

@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.