Closed
Description
If you believe you have an issue that affects the security of the platform please do NOT create an issue and instead email your issue details to secure@microsoft.com. Your report may be eligible for our bug bounty but ONLY if it is reported through email.
Describe the bug
Firstly, a big thank you for all of the work that everyone has put into the Blazor framework.
The InputNumber
component does not support binding to properties of the long
data type.
To Reproduce
<EditForm Model="@Model">
<DataAnnotationsValidator/>
<ValidationSummary/>
<div class="form-group">
<label for="name">Name</label>
<InputText class="form-control" id="name" @bind-Value="@Model.Name"/>
<ValidationMessage For="@(() => Model.Name)"/>
</div>
<div class="form-group">
<label for="code">Code</label>
<InputNumber class="form-control" id="code" @bind-Value="@Model.Code"/>
<ValidationMessage For="@(() => Model.Code)"/>
</div>
<button class="btn btn-primary mdi mdi-content-save" type="submit">Save</button>
</EditForm>
@code
{
private Product Model { get; set; } = new Product();
public class Product
{
[Required] public string Name { get; set; }
[Required] public long Code { get; set; }
}
}
System.InvalidOperationException: The type 'System.Int64' is not a supported numeric type.
Expected behavior
Based on this comment, the InputNumber
component should support binding to the long
type.
Looking through the code, the issue appears to be caused by the checks in this if statement.
If this is the case, then I am happy to create a fork to add targetType == typeof(long)
.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
Include the output of dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 3.0.100-preview8-013656
Commit: 8bf06ffc8d
Runtime Environment:
OS Name: Windows
OS Version: 10.0.18956
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.0.100-preview8-013656\
Host (useful for support):
Version: 3.0.0-preview8-28405-07
Commit: d01b2fb7bc
.NET Core SDKs installed:
3.0.100-preview8-013656 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.0.0-preview8.19405.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.0.0-preview8-28405-07 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.0.0-preview8-28405-07 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]