AzUrlShortener icon indicating copy to clipboard operation
AzUrlShortener copied to clipboard

Errors when open Click Statistics page

Open workmail20 opened this issue 1 year ago • 2 comments

I have broken Click Statistics page. Can you help me?

image

workmail20 avatar Aug 03 '24 22:08 workmail20

On the very bottom of the stacktrace you can see it's pointing to the Syncfusion package. I have a slightly different stacktrace but I think it's coming from the same origin.

Also I noticed it's only occurring on the first page load. When you click on another page and back to /statistics, it loads correctly.

Stacktrace
crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
      Unhandled exception rendering component: The JSON value could not be converted to System.String. Path: $[0] | LineNumber: 0 | BytePositionInLine: 2.
System.Text.Json.JsonException: The JSON value could not be converted to System.String. Path: $[0] | LineNumber: 0 | BytePositionInLine: 2.
 ---> System.InvalidOperationException: Cannot get the value of a token type 'StartObject' as a string.
   at System.Text.Json.ThrowHelper.ThrowInvalidOperationException_ExpectedString(JsonTokenType tokenType)
   at System.Text.Json.Utf8JsonReader.GetString()
   at System.Text.Json.Serialization.Converters.StringConverter.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
   at System.Text.Json.Serialization.JsonCollectionConverter`2[[System.String[], System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, String[]& value)
   at System.Text.Json.Serialization.JsonConverter`1[[System.String[], System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, String[]& value, Boolean& isPopulatedValue)
   at System.Text.Json.Serialization.JsonConverter`1[[System.String[], System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].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[[System.String[], System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1[[System.String[], System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Deserialize(Utf8JsonReader& reader, ReadStack& state)
   at System.Text.Json.JsonSerializer.ReadFromSpan[String[]](ReadOnlySpan`1 utf8Json, JsonTypeInfo`1 jsonTypeInfo, Nullable`1 actualByteCount)
   at System.Text.Json.JsonSerializer.ReadFromSpan[String[]](ReadOnlySpan`1 json, JsonTypeInfo`1 jsonTypeInfo)
   at System.Text.Json.JsonSerializer.Deserialize[String[]](String json, JsonSerializerOptions options)
   at Syncfusion.Blazor.Charts.SfChart.GetCharSizeList(List`1 fontKeys)
   at Syncfusion.Blazor.Charts.SfChart.SetCharSize()
   at Syncfusion.Blazor.Charts.SfChart.OnAfterRenderAsync(Boolean firstRender)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)

I also found this relevant link by searching a few keywords from the stacktrace - https://www.syncfusion.com/forums/179195/json-convert-error-after-upgrade-from-20-3-0-47

Then I read about how Syncfusion stylesheet and script resources are included as part of a Blazor WASM App - noticed that the NuGet version and the web assets were out of sync.

<!-- Cloud5mins.ShortenerTools.TinyBlazorAdmin.csproj -->
<PackageReference Include="Syncfusion.Blazor.Charts" Version="25.1.40" />

<!-- wwwroot/index.html -->
<script src="https://cdn.syncfusion.com/blazor/20.1.51/syncfusion-blazor.min.js" type="text/javascript"></script>

Syncfusion Blazor Themes are available in the CDN. Make sure that the version in the URLs matches the version of the Syncfusion Blazor Package you are using. https://blazor.syncfusion.com/documentation/appearance/themes#cdn-reference

Files:


I wanted to try out referencing the static web asset from the NuGet packages so that the package reference and web asset versions would be coupled:

<link href="_content/Syncfusion.Blazor.Themes/bootstrap5.css" rel="stylesheet" />
<script src="_content/Syncfusion.Blazor.Core/scripts/syncfusion-blazor.min.js" type="text/javascript"></script>

This fixed the original error but then I ran into another error that the Syncfusion (community) license key was invalid. I tried using the CDN link to the specified version 20.3.0.59 from the Syncfusion forums and that also revealed the same error.

image

I'm not sure if they are related but that's where I'm at so far with this. I might try and push a PR up this weekend if it's an unrelated issue since the versions should be coupled.

AJS-au avatar Aug 21 '24 02:08 AJS-au

This fixed the original error but then I ran into another error that the Syncfusion (community) license key was invalid. I tried using the CDN link to the specified version 20.3.0.59 from the Syncfusion forums and that also revealed the same error.

This is a bit silly but I just retried that version 20.3.59 from the CDN and it worked - not sure why it was failing before that. You can use the CDN version up until 20.3.61 that doesn't throw both the original error and the invalid license key error. The invalid license key error only occurs on versions >=20.4.*.

Then comes the issue of version incompatibility and inconsistent packages. The Syncfusion library still works on newer versions, it'll just show the invalid license key error at the top and trigger a popup.

https://blazor.syncfusion.com/documentation/common/how-to/version-compatibility

I also don't know the details surrounding the original issuing of the Syncfusion community license and whether it still applies today. Has there been any communication about revoking it and that's why it's now considered invalid? Was the license only applicable to certain versions of the package or did they introduce license validation in versions >=20.4.*?

I'm reading other people's experiences with this and they had their license revoked after their open source package had more than 5 contributors to it.

https://support.syncfusion.com/kb/article/9795/how-to-get-community-license-and-install-it

AJS-au avatar Aug 21 '24 05:08 AJS-au

@AJS-au in v4 SyncFusion components have been replaced with BlazorBootstrap no more license required.

closing this issue.

fboucher avatar Mar 20 '25 15:03 fboucher