-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
.NET 6.0 blazor wasm project reports an incorrect type #61007
Comments
@javiercn Do you have any info to share? This is a breaking problem that cannot be easily workarounded as it might be coming from external libraries. I am not sure if the assigned milestone means that this will be investigated until the official release of .NET 6.0 or after that, but if you provide more details if this will certainly not be part of .NET 6.0, then we can at least start thinking about some other possibilities for the scenario. Checking for a type is a rather basic functionality, so this might affect a lot of people. |
@Stamo-Gochev this seems to be a runtime issue from what I can tell. I'm moving the issue there so they can help you. |
Tagging subscribers to this area: @thaystg Issue DetailsDescribe the bugBlazor wasm .NET 6.0 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. To ReproduceA repository that reproduces the issue can be found at: 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 Steps to reproduce:
Expected behaviorThe Index.razor page is expected to print:
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.
Actual behaviorThe Index.razor page returns:
Further technical details
dotnet --info Output
|
From what I can tell, the issue seems to be around https://github.com/Stamo-Gochev/blazor-type-issue/blob/master/BlazorTypeIssue/RazorClassLibrary1/Component1.razor.cs#L35 behaving differently on Blazor wasm |
Tagging subscribers to this area: Issue DetailsDescribe the bugBlazor wasm .NET 6.0 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. To ReproduceA repository that reproduces the issue can be found at: 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 Steps to reproduce:
Expected behaviorThe Index.razor page is expected to print:
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.
Actual behaviorThe Index.razor page returns:
Further technical details
dotnet --info Output
|
cc @lambdageek |
Some more context, as I was chatting with @thaystg over IM. It seems like item.GetType() returns Nullable on wasm and Boolean on other platforms. That seems to be the delta. |
Is this a wasm/mono difference or is the type actually nullable in the browser case but not in the server case? |
@lewing the C# code is the same in both cases, so I believe this is something on the runtime, maybe with regards to boxing/unboxing, from what I can tell. |
interpreter issue. Console repro (build with using System.Collections.Generic;
class C<T> {
public IEnumerable<T>? Data {get; set;}
public C () {}
public bool Check () {
return Data.ElementAt(0).GetType() == typeof(bool);
}
}
public class P {
public static void Main () {
C<bool?> c = new ();
c.Data = new List<bool?> { true };
Console.WriteLine ($"should be True? {c.Check()}");
}
} Mono JIT prints |
Tagging subscribers to this area: @BrzVlad Issue DetailsDescribe the bugBlazor wasm .NET 6.0 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. To ReproduceA repository that reproduces the issue can be found at: 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 Steps to reproduce:
Expected behaviorThe Index.razor page is expected to print:
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.
Actual behaviorThe Index.razor page returns:
Further technical details
dotnet --info Output
|
Describe the bug
Blazor wasm .NET 6.0 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.
To Reproduce
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:
Expected behavior
The Index.razor page is expected to print:
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.
Actual behavior
The Index.razor page returns:
Further technical details
dotnet --info
:dotnet --info Output
The text was updated successfully, but these errors were encountered: