question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JS interop exception on Avatar content.

See original GitHub issue

This error does not occur in all computers.

<AuthorizeView>
    <Authorized>
        <span class="avatar-item ant-dropdown-link" style="cursor: pointer;">
            <Badge Count="_notificationsCount">
                <Avatar Style="@($"background-color: {context.User.Claims.FirstOrDefault(c => c.Type.Equals("Color")).Value}; vertical-align: middle;")" Shape="square" Size="large">
                    @context.User.Identity.Name
                </Avatar>
            </Badge>
        </span>
    </Authorized>
</AuthorizeView>
Microsoft.JSInterop.JSException: An exception occurred executing JS interop: The JSON value could not be converted to System.Int32. Path: $.absoluteTop | LineNumber: 0 | BytePositionInLine: 229.. See InnerException for more details.
 ---> System.Text.Json.JsonException: The JSON value could not be converted to System.Int32. Path: $.absoluteTop | LineNumber: 0 | BytePositionInLine: 229.
 ---> System.FormatException: Either the JSON value is not in a supported format, or is out of bounds for an Int32.
   at System.Text.Json.Utf8JsonReader.GetInt32()
   at System.Text.Json.Serialization.Converters.Int32Converter.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
   at System.Text.Json.JsonPropertyInfo`1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   --- End of inner exception stack trace ---
   at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, Utf8JsonReader& reader, Exception ex)
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.Serialization.JsonConverter`1.ReadCoreAsObject(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.JsonSerializer.ReadCore[TValue](JsonConverter jsonConverter, Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.JsonSerializer.ReadValueCore[TValue](JsonSerializerOptions options, Utf8JsonReader& reader, ReadStack& state)
   at System.Text.Json.JsonSerializer.Deserialize(Utf8JsonReader& reader, Type returnType, JsonSerializerOptions options)
   at Microsoft.JSInterop.JSRuntime.EndInvokeJS(Int64 taskId, Boolean succeeded, Utf8JsonReader& jsonReader)
   --- End of inner exception stack trace ---
   at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args)
   at AntDesign.AntComponentBase.JsInvokeAsync[T](String code, Object[] args)

Further technical details

  • AntDesign: v0.7.4
  • Dotnet Info:
    .NET SDK (reflecting any global.json):
    Version:   5.0.201
    Commit:    a09bd5c86c
    
    Runtime Environment:
    OS Name:     Windows
    OS Version:  10.0.19042
    OS Platform: Windows
    RID:         win10-x64
    Base Path:   C:\Program Files\dotnet\sdk\5.0.201\
    
    Host (useful for support):
    Version: 5.0.4
    Commit:  f27d337295
    
    .NET SDKs installed:
    3.1.301 [C:\Program Files\dotnet\sdk]
    3.1.302 [C:\Program Files\dotnet\sdk]
    5.0.201 [C:\Program Files\dotnet\sdk]
    
    .NET runtimes installed:
    Microsoft.AspNetCore.All 2.1.26 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
    Microsoft.AspNetCore.App 2.1.26 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
    Microsoft.AspNetCore.App 3.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
    Microsoft.AspNetCore.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
    Microsoft.AspNetCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
    Microsoft.NETCore.App 2.1.26 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
    Microsoft.NETCore.App 3.1.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
    Microsoft.NETCore.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
    Microsoft.NETCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
    Microsoft.WindowsDesktop.App 3.1.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
    Microsoft.WindowsDesktop.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
    Microsoft.WindowsDesktop.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
    
  • Visual Studio 2019 16.9.3

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
anddrzejbcommented, Apr 14, 2021

Perfect. You will find me in Ant Design Blazor channel. Msg me anytime it is convinient.

0reactions
anddrzejbcommented, Apr 15, 2021

This link is also in the main repo page.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Exception while calling JS interoperability in Blazor ...
This is because the component is being statically rendered. When prerendering is enabled, JavaScript interop calls can only be performed during ...
Read more >
Identifying what is causing interop errors : r/Blazor
I started developing a Server-side blazor application in NET 5 - everything was working lovely, and no exceptions are generating during ...
Read more >
JavaScript Errors - Telerik UI for Blazor - Documentation
The telerik-blazor.js JS Interop file is missing or the URL is wrong; The defer attribute causes the script to load and execute too...
Read more >
JavaScript Interop Error in Blazor - JSException
Ran across this weird "Unexpected token '?'" error with JavaScript interop in Blazor. The solution was pretty simple, once I figured it out....
Read more >
Azure AD B2C Microsoft.JSInterop.JSException: An ...
Azure AD B2C Microsoft.JSInterop.JSException: An exception occurred executing JS interop: The JSON value could not be converted to System.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found