Closed witoldlitwin closed 4 years ago
@witoldlitwin thanks for contacting us.
This seems to be a bug. On submit the current exception is thrown
warn: Microsoft.AspNetCore.Components.Server.Circuits.RemoteRenderer[100]
Unhandled exception rendering component: Microsoft.AspNetCore.Components.Forms.InputSelect`1[System.Nullable`1[BlazorServerIndividualSqlLite.Pages.Index+Unit]] does not support the type 'System.Nullable`1[BlazorServerIndividualSqlLite.Pages.Index+Unit]'.
System.InvalidOperationException: Microsoft.AspNetCore.Components.Forms.InputSelect`1[System.Nullable`1[BlazorServerIndividualSqlLite.Pages.Index+Unit]] does not support the type 'System.Nullable`1[BlazorServerIndividualSqlLite.Pages.Index+Unit]'.
at Microsoft.AspNetCore.Components.Forms.InputSelect`1.TryParseValueFromString(String value, TValue& result, String& validationErrorMessage)
at Microsoft.AspNetCore.Components.Forms.InputBase`1.set_CurrentValueAsString(String value)
at Microsoft.AspNetCore.Components.Forms.InputSelect`1.<BuildRenderTree>b__4_0(String __value)
at Microsoft.AspNetCore.Components.EventCallbackFactoryBinderExtensions.<>c__DisplayClass22_0`1.<CreateBinderCore>b__0(ChangeEventArgs e)
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)
fail: Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost[111]
Unhandled exception in circuit 'Zt7CuYHeXPRxUhRSZEELfB9ujO3ZWDVM90UD_prDExM'.
System.InvalidOperationException: Microsoft.AspNetCore.Components.Forms.InputSelect`1[System.Nullable`1[BlazorServerIndividualSqlLite.Pages.Index+Unit]] does not support the type 'System.Nullable`1[BlazorServerIndividualSqlLite.Pages.Index+Unit]'.
at Microsoft.AspNetCore.Components.Forms.InputSelect`1.TryParseValueFromString(String value, TValue& result, String& validationErrorMessage)
at Microsoft.AspNetCore.Components.Forms.InputBase`1.set_CurrentValueAsString(String value)
at Microsoft.AspNetCore.Components.Forms.InputSelect`1.<BuildRenderTree>b__4_0(String __value)
at Microsoft.AspNetCore.Components.EventCallbackFactoryBinderExtensions.<>c__DisplayClass22_0`1.<CreateBinderCore>b__0(ChangeEventArgs e)
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Components.Forms.InputSelect`1.TryParseValueFromString(String value, TValue& result, String& validationErrorMessage)
at Microsoft.AspNetCore.Components.Forms.InputBase`1.set_CurrentValueAsString(String value)
The fix likely involves a fix in InputBase.TryParseValueFromString to correctly parse enum values.
This is a dupe of #13624
When Blazor's InputSelect is bound to a nullable Enum it prevents the form from being submitted.
There are two console errors:
Steps to reproduce:
Add a form and backend code:
@code { protected Data.TestTask taskModel = new Data.TestTask();
}