Skip to content
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

Role="TextRole.Email" cashes Validation #1030

Closed
MatejMarecek opened this issue Jun 26, 2020 · 1 comment · Fixed by #1031
Closed

Role="TextRole.Email" cashes Validation #1030

MatejMarecek opened this issue Jun 26, 2020 · 1 comment · Fixed by #1031
Labels
Type: Bug 🐞 Something isn't working

Comments

@MatejMarecek
Copy link

Code that works

<Validation Validator="@ValidationRule.IsEmail">
    <TextEdit>
        <ValidationError>Invalid email</ValidationError>
    </TextEdit>
</Validation>

Code that does NOT work

<Validation Validator="@ValidationRule.IsEmail">
    <TextEdit Role="TextRole.Email">
        <ValidationError>Invalid email</ValidationError>
    </TextEdit>
</Validation>

Stack trace

blazor.webassembly.js:1 crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
      Unhandled exception rendering component: An exception occurred executing JS interop: The JSON value could not be converted to System.Int32. Path: $ | LineNumber: 0 | BytePositionInLine: 4.. See InnerException for more details.
Microsoft.JSInterop.JSException: An exception occurred executing JS interop: The JSON value could not be converted to System.Int32. Path: $ | LineNumber: 0 | BytePositionInLine: 4.. See InnerException for more details. ---> System.Text.Json.JsonException: The JSON value could not be converted to System.Int32. Path: $ | LineNumber: 0 | BytePositionInLine: 4. ---> System.InvalidOperationException: Cannot get the value of a token type 'Null' as a number.
  at System.Text.Json.Utf8JsonReader.TryGetInt32 (System.Int32& value) <0x3673778 + 0x0001e> in <filename unknown>:0 
  at System.Text.Json.Utf8JsonReader.GetInt32 () <0x36736a0 + 0x00008> in <filename unknown>:0 
  at System.Text.Json.Serialization.Converters.JsonConverterInt32.Read (System.Text.Json.Utf8JsonReader& reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) <0x36735e8 + 0x00004> in <filename unknown>:0 
  at System.Text.Json.JsonPropertyInfoNotNullable`4[TClass,TDeclaredProperty,TRuntimeProperty,TConverter].OnRead (System.Text.Json.ReadStack& state, System.Text.Json.Utf8JsonReader& reader) <0x3713cc0 + 0x0003c> in <filename unknown>:0 
  at System.Text.Json.JsonPropertyInfo.Read (System.Text.Json.JsonTokenType tokenType, System.Text.Json.ReadStack& state, System.Text.Json.Utf8JsonReader& reader) <0x3559e78 + 0x00088> in <filename unknown>:0 
  at System.Text.Json.JsonSerializer.HandleNull (System.Text.Json.Utf8JsonReader& reader, System.Text.Json.ReadStack& state) <0x35ccf68 + 0x00100> in <filename unknown>:0 
  at System.Text.Json.JsonSerializer.ReadCore (System.Text.Json.JsonSerializerOptions options, System.Text.Json.Utf8JsonReader& reader, System.Text.Json.ReadStack& readStack) <0x35593c0 + 0x0026a> in <filename unknown>:0 
   --- End of inner exception stack trace ---
  at System.Text.Json.ThrowHelper.ReThrowWithPath (System.Text.Json.ReadStack& readStack, System.Text.Json.Utf8JsonReader& reader, System.Exception ex) <0x374ed08 + 0x00028> in <filename unknown>:0 
  at System.Text.Json.JsonSerializer.ReadCore (System.Text.Json.JsonSerializerOptions options, System.Text.Json.Utf8JsonReader& reader, System.Text.Json.ReadStack& readStack) <0x35593c0 + 0x00320> in <filename unknown>:0 
  at System.Text.Json.JsonSerializer.ReadValueCore (System.Text.Json.JsonSerializerOptions options, System.Text.Json.Utf8JsonReader& reader, System.Text.Json.ReadStack& readStack) <0x3558088 + 0x00592> in <filename unknown>:0 
  at System.Text.Json.JsonSerializer.ReadValueCore (System.Text.Json.Utf8JsonReader& reader, System.Type returnType, System.Text.Json.JsonSerializerOptions options) <0x3557708 + 0x0003e> in <filename unknown>:0 
  at System.Text.Json.JsonSerializer.Deserialize (System.Text.Json.Utf8JsonReader& reader, System.Type returnType, System.Text.Json.JsonSerializerOptions options) <0x35575a0 + 0x00024> in <filename unknown>:0 
  at Microsoft.JSInterop.JSRuntime.EndInvokeJS (System.Int64 taskId, System.Boolean succeeded, System.Text.Json.Utf8JsonReader& jsonReader) <0x3548128 + 0x00052> in <filename unknown>:0 
   --- End of inner exception stack trace ---
  at System.Threading.Tasks.ValueTask`1[TResult].get_Result () <0x3752e88 + 0x00034> in <filename unknown>:0 
  at Blazorise.BaseTextInput`1[TValue].OnInputHandler (Microsoft.AspNetCore.Components.ChangeEventArgs e) <0x370db80 + 0x00106> in <filename unknown>:0 
  at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion (System.Threading.Tasks.Task task) <0x3712930 + 0x000da> in <filename unknown>:0 
  at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask (System.Threading.Tasks.Task taskToHandle) <0x31a3000 + 0x000b6> in <filename unknown>:0 
@stsrki
Copy link
Collaborator

stsrki commented Jun 26, 2020

I found the reason for the issue. It's because of a workaround for TextEdit caret problem I introduced in the new version. It seems it works only for text input values.

I will fix it and release in the patch.

@stsrki stsrki added the Type: Bug 🐞 Something isn't working label Jun 26, 2020
@stsrki stsrki added this to the 0.9.1 milestone Jun 26, 2020
@stsrki stsrki linked a pull request Jun 26, 2020 that will close this issue
@stsrki stsrki mentioned this issue Jun 26, 2020
7 tasks
@stsrki stsrki closed this as completed Jun 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug 🐞 Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants