Open patrykgz opened 3 years ago
The DonutConfig Statistic variable is broken due to OneOf.
Go to https://antblazor.com/en-US/charts/pie Scroll down to Donut Click Example 2 or 3
crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100] Unhandled exception rendering component: Cannot return as T1 as result is T0 System.InvalidOperationException: Cannot return as T1 as result is T0 at OneOf.OneOf2[[System.String, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[AntDesign.Charts.DonutStatisticContent, AntDesign.Charts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].get_AsT1() at System.Text.Json.JsonPropertyInfo1[[AntDesign.Charts.DonutStatisticContent, AntDesign.Charts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].GetMemberAndWriteJson(Object obj, WriteStack& state, Utf8JsonWriter writer) at System.Text.Json.Serialization.Converters.ObjectDefaultConverter1[[OneOf.OneOf2[[System.String, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[AntDesign.Charts.DonutStatisticContent, AntDesign.Charts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], OneOf, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].OnTryWrite(Utf8JsonWriter writer, OneOf2 value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.JsonConverter1[[OneOf.OneOf2[[System.String, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[AntDesign.Charts.DonutStatisticContent, AntDesign.Charts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], OneOf, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].TryWrite(Utf8JsonWriter writer, OneOf2& value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.JsonPropertyInfo1[[OneOf.OneOf2[[System.String, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[AntDesign.Charts.DonutStatisticContent, AntDesign.Charts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], OneOf, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].GetMemberAndWriteJson(Object obj, WriteStack& state, Utf8JsonWriter writer) at System.Text.Json.Serialization.Converters.ObjectDefaultConverter1[[AntDesign.Charts.DonutViewConfigStatistic, AntDesign.Charts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].OnTryWrite(Utf8JsonWriter writer, DonutViewConfigStatistic value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.JsonConverter1[[AntDesign.Charts.DonutViewConfigStatistic, AntDesign.Charts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].TryWrite(Utf8JsonWriter writer, DonutViewConfigStatistic& value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.JsonPropertyInfo1[[AntDesign.Charts.DonutViewConfigStatistic, AntDesign.Charts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].GetMemberAndWriteJson(Object obj, WriteStack& state, Utf8JsonWriter writer) at System.Text.Json.Serialization.Converters.ObjectDefaultConverter1[[AntDesign.Charts.DonutConfig, AntDesign.Charts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].OnTryWrite(Utf8JsonWriter writer, DonutConfig value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.JsonConverter1[[AntDesign.Charts.DonutConfig, AntDesign.Charts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].TryWrite(Utf8JsonWriter writer, DonutConfig& value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.JsonConverter1[[AntDesign.Charts.DonutConfig, AntDesign.Charts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].TryWriteAsObject(Utf8JsonWriter writer, Object value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.JsonConverter1[[System.Object, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].TryWrite(Utf8JsonWriter writer, Object& value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.Converters.ArrayConverter2[[System.Object[], System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Object, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].OnWriteResume(Utf8JsonWriter writer, Object[] value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.Converters.IEnumerableDefaultConverter2[[System.Object[], System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Object, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].OnTryWrite(Utf8JsonWriter writer, Object[] value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.JsonConverter1[[System.Object[], System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].TryWrite(Utf8JsonWriter writer, Object[]& value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.JsonConverter1[[System.Object[], System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].WriteCore(Utf8JsonWriter writer, Object[]& value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.JsonSerializer.WriteCore[Object[]](JsonConverter jsonConverter, Utf8JsonWriter writer, Object[]& value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.JsonSerializer.WriteCore[Object[]](Utf8JsonWriter writer, Object[]& value, Type inputType, JsonSerializerOptions options) at System.Text.Json.JsonSerializer.Serialize[Object[]](Object[]& value, Type inputType, JsonSerializerOptions options) at System.Text.Json.JsonSerializer.Serialize[Object[]](Object[] value, JsonSerializerOptions options) at Microsoft.JSInterop.JSRuntime.InvokeAsync[Object](Int64 targetInstanceId, String identifier, CancellationToken cancellationToken, Object[] args) at Microsoft.JSInterop.JSRuntime.<InvokeAsync>d__151[[System.Object, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext() at Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync(IJSRuntime jsRuntime, String identifier, Object[] args) at AntDesign.Charts.ChartComponentBase2.<Create>d__46[[System.Collections.Generic.IEnumerable1[[System.Object, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[AntDesign.Charts.DonutConfig, AntDesign.Charts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext() at AntDesign.Charts.ChartComponentBase2.<OnAfterRenderAsync>d__43[[System.Collections.Generic.IEnumerable1[[System.Object, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[AntDesign.Charts.DonutConfig, AntDesign.Charts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()
2[[System.String, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[AntDesign.Charts.DonutStatisticContent, AntDesign.Charts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].get_AsT1() at System.Text.Json.JsonPropertyInfo
1[[OneOf.OneOf
2 value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.JsonConverter
2[[System.String, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[AntDesign.Charts.DonutStatisticContent, AntDesign.Charts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], OneOf, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].TryWrite(Utf8JsonWriter writer, OneOf
1[[AntDesign.Charts.DonutViewConfigStatistic, AntDesign.Charts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].OnTryWrite(Utf8JsonWriter writer, DonutViewConfigStatistic value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.JsonConverter
1[[AntDesign.Charts.DonutViewConfigStatistic, AntDesign.Charts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].GetMemberAndWriteJson(Object obj, WriteStack& state, Utf8JsonWriter writer) at System.Text.Json.Serialization.Converters.ObjectDefaultConverter
1[[AntDesign.Charts.DonutConfig, AntDesign.Charts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].TryWrite(Utf8JsonWriter writer, DonutConfig& value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.JsonConverter
1[[System.Object, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].TryWrite(Utf8JsonWriter writer, Object& value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.Converters.ArrayConverter
2[[System.Object[], System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Object, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].OnTryWrite(Utf8JsonWriter writer, Object[] value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.JsonConverter
1[[System.Object[], System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].WriteCore(Utf8JsonWriter writer, Object[]& value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.JsonSerializer.WriteCore[Object[]](JsonConverter jsonConverter, Utf8JsonWriter writer, Object[]& value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.JsonSerializer.WriteCore[Object[]](Utf8JsonWriter writer, Object[]& value, Type inputType, JsonSerializerOptions options) at System.Text.Json.JsonSerializer.Serialize[Object[]](Object[]& value, Type inputType, JsonSerializerOptions options) at System.Text.Json.JsonSerializer.Serialize[Object[]](Object[] value, JsonSerializerOptions options) at Microsoft.JSInterop.JSRuntime.InvokeAsync[Object](Int64 targetInstanceId, String identifier, CancellationToken cancellationToken, Object[] args) at Microsoft.JSInterop.JSRuntime.<InvokeAsync>d__15
2.<Create>d__46[[System.Collections.Generic.IEnumerable
2.<OnAfterRenderAsync>d__43[[System.Collections.Generic.IEnumerable
dotnet --info
Is it possible JsonSeralizer doesn't understand One of?
Any updates on this issue? Modifying G2Plot.js is not an ideal solution
Describe the bug
The DonutConfig Statistic variable is broken due to OneOf.
Steps to reproduce (please include code)
Go to https://antblazor.com/en-US/charts/pie Scroll down to Donut Click Example 2 or 3
Exceptions (if any)
crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100] Unhandled exception rendering component: Cannot return as T1 as result is T0 System.InvalidOperationException: Cannot return as T1 as result is T0 at OneOf.OneOf
2[[System.String, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[AntDesign.Charts.DonutStatisticContent, AntDesign.Charts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].get_AsT1() at System.Text.Json.JsonPropertyInfo
1[[AntDesign.Charts.DonutStatisticContent, AntDesign.Charts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].GetMemberAndWriteJson(Object obj, WriteStack& state, Utf8JsonWriter writer) at System.Text.Json.Serialization.Converters.ObjectDefaultConverter1[[OneOf.OneOf
2[[System.String, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[AntDesign.Charts.DonutStatisticContent, AntDesign.Charts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], OneOf, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].OnTryWrite(Utf8JsonWriter writer, OneOf2 value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.JsonConverter
1[[OneOf.OneOf2[[System.String, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[AntDesign.Charts.DonutStatisticContent, AntDesign.Charts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], OneOf, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].TryWrite(Utf8JsonWriter writer, OneOf
2& value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.JsonPropertyInfo1[[OneOf.OneOf
2[[System.String, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[AntDesign.Charts.DonutStatisticContent, AntDesign.Charts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], OneOf, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].GetMemberAndWriteJson(Object obj, WriteStack& state, Utf8JsonWriter writer) at System.Text.Json.Serialization.Converters.ObjectDefaultConverter1[[AntDesign.Charts.DonutViewConfigStatistic, AntDesign.Charts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].OnTryWrite(Utf8JsonWriter writer, DonutViewConfigStatistic value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.JsonConverter
1[[AntDesign.Charts.DonutViewConfigStatistic, AntDesign.Charts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].TryWrite(Utf8JsonWriter writer, DonutViewConfigStatistic& value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.JsonPropertyInfo1[[AntDesign.Charts.DonutViewConfigStatistic, AntDesign.Charts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].GetMemberAndWriteJson(Object obj, WriteStack& state, Utf8JsonWriter writer) at System.Text.Json.Serialization.Converters.ObjectDefaultConverter
1[[AntDesign.Charts.DonutConfig, AntDesign.Charts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].OnTryWrite(Utf8JsonWriter writer, DonutConfig value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.JsonConverter1[[AntDesign.Charts.DonutConfig, AntDesign.Charts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].TryWrite(Utf8JsonWriter writer, DonutConfig& value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.JsonConverter
1[[AntDesign.Charts.DonutConfig, AntDesign.Charts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].TryWriteAsObject(Utf8JsonWriter writer, Object value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.JsonConverter1[[System.Object, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].TryWrite(Utf8JsonWriter writer, Object& value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.Converters.ArrayConverter
2[[System.Object[], System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Object, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].OnWriteResume(Utf8JsonWriter writer, Object[] value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.Converters.IEnumerableDefaultConverter2[[System.Object[], System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Object, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].OnTryWrite(Utf8JsonWriter writer, Object[] value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.JsonConverter
1[[System.Object[], System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].TryWrite(Utf8JsonWriter writer, Object[]& value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.JsonConverter1[[System.Object[], System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].WriteCore(Utf8JsonWriter writer, Object[]& value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.JsonSerializer.WriteCore[Object[]](JsonConverter jsonConverter, Utf8JsonWriter writer, Object[]& value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.JsonSerializer.WriteCore[Object[]](Utf8JsonWriter writer, Object[]& value, Type inputType, JsonSerializerOptions options) at System.Text.Json.JsonSerializer.Serialize[Object[]](Object[]& value, Type inputType, JsonSerializerOptions options) at System.Text.Json.JsonSerializer.Serialize[Object[]](Object[] value, JsonSerializerOptions options) at Microsoft.JSInterop.JSRuntime.InvokeAsync[Object](Int64 targetInstanceId, String identifier, CancellationToken cancellationToken, Object[] args) at Microsoft.JSInterop.JSRuntime.<InvokeAsync>d__15
1[[System.Object, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext() at Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync(IJSRuntime jsRuntime, String identifier, Object[] args) at AntDesign.Charts.ChartComponentBase2.<Create>d__46[[System.Collections.Generic.IEnumerable
1[[System.Object, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[AntDesign.Charts.DonutConfig, AntDesign.Charts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext() at AntDesign.Charts.ChartComponentBase2.<OnAfterRenderAsync>d__43[[System.Collections.Generic.IEnumerable
1[[System.Object, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[AntDesign.Charts.DonutConfig, AntDesign.Charts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()Further technical details
dotnet --info