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

Errors when open Click Statistics page #530

Open
workmail20 opened this issue Aug 3, 2024 · 2 comments
Open

Errors when open Click Statistics page #530

workmail20 opened this issue Aug 3, 2024 · 2 comments

Comments

@workmail20
Copy link

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

image

@AJS-au
Copy link

AJS-au commented Aug 21, 2024

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
Copy link

AJS-au commented Aug 21, 2024

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

AlexCheongIE added a commit to ie/AzUrlShortener that referenced this issue Sep 5, 2024
…n package; details below:

- The cause was the Syncfusion static web asset being used
- Additional notes:
	- The Syncfusion FE assets are intentionally out of sync with the NuGet package to fix the runtime error and prevent a licensing error occurring in later versions
	- Future update should reference the static web asset from the NuGet package instead of the CDN to couple the versions
- see: microsoft#530
	- Relevant issue: https://www.syncfusion.com/forums/179195/json-convert-error-after-upgrade-from-20-3-0-47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants