Related to https://github.com/dotnet/aspnetcore/issues/37871
Blazor wasm project reports an incorrect variable type. The type is correctly reported for blazor server (.NET 5.0 and .NET 6.0) as well as blazor wasm .NET 5.0 apps, but not for blazor wasm .NET 6.0 project.
A repository that reproduces the issue can be found at: https://github.com/Stamo-Gochev/blazor-type-issue
It contains a component in a razor class library that is used by all project types to compare the output.
The component uses a generic argument for its Data
parameter and checks if the type of it is contained in a list of predefined types and renders the result.
Steps to reproduce:
- Clone the repo
- Run the BlazorWasmAppNet60 project
- Open the Index.razor page and observe its output.
Note: The repo also contains tests projects for blazor server .NET 5.0 and .NET 6.0 apps as well as a blazor wasm .NET 5.0 app. You can use them to compare the output by looking at their
/Pages/Index.razor
file.
The Index.razor page is expected to print:
BlazorWasmAppNet60 item has predefined type: True
This is also the output for all other project types - blazor server .NET 5.0, blazor server .NET 6.0 and blazor wasm .NET 5.0.
BlazorServerAppNet50 item has predefined type: True
BlazorServerAppNet60 item has predefined type: True
BlazorWasmAppNet50 item has predefined type: True
The Index.razor page returns:
BlazorWasmAppNet60 item has predefined type: False <- this should be True as in all other projects
- ASP.NET Core version - .NET 6.0 RC 2
- Visual Studio 2022 Preview 7
- Include the output of
dotnet --info
: