You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When adding data to the magicdb the token endarray is unexpected. To demonstrate i have minimized my application into a demo. in here adding to the player database does work, but not for the event and game tables. The demo code can be found at https://github.com/Ard2025/MagicIssue-endarray-token. The following error does appear.
crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: Unexpected JSON token: EndArray when deserializing JsonElement.
System.Text.Json.JsonException: Unexpected JSON token: EndArray when deserializing JsonElement.
at Magic.IndexedDb.Models.MagicContractResolver`1[[System.Text.Json.JsonElement, System.Text.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51]].Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
at System.Text.Json.Serialization.JsonConverter`1[[System.Text.Json.JsonElement, System.Text.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51]].TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, JsonElement& value, Boolean& isPopulatedValue)
at System.Text.Json.Serialization.JsonConverter`1[[System.Text.Json.JsonElement, System.Text.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51]].ReadCore(Utf8JsonReader& reader, JsonElement& value, JsonSerializerOptions options, ReadStack& state)
at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1[[System.Text.Json.JsonElement, System.Text.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51]].Deserialize(Utf8JsonReader& reader, ReadStack& state)
at System.Text.Json.JsonSerializer.ReadFromSpan[JsonElement](ReadOnlySpan`1 utf8Json, JsonTypeInfo`1 jsonTypeInfo, Nullable`1 actualByteCount)
at System.Text.Json.JsonSerializer.ReadFromSpan[JsonElement](ReadOnlySpan`1 json, JsonTypeInfo`1 jsonTypeInfo)
at System.Text.Json.JsonSerializer.Deserialize[JsonElement](String json, JsonSerializerOptions options)
at Magic.IndexedDb.Helpers.MagicSerializationHelper.DeserializeObject[JsonElement](String json, MagicJsonSerializationSettings settings)
at Magic.IndexedDb.Extensions.MagicJsInvoke.<TrueMagicStreamJsAsync>d__10`1[[System.Text.Json.JsonElement, System.Text.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51]].MoveNext()
at Magic.IndexedDb.Extensions.MagicJsInvoke.<TrueMagicStreamJsAsync>d__10`1[[System.Text.Json.JsonElement, System.Text.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51]].MoveNext()
at Magic.IndexedDb.Extensions.MagicJsInvoke.<MagicStreamJsAsync>d__9`1[[System.Text.Json.JsonElement, System.Text.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51]].MoveNext()
at Magic.IndexedDb.Extensions.MagicJsInvoke.<CallJsAsync>d__3`1[[System.Text.Json.JsonElement, System.Text.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51]].MoveNext()
at Magic.IndexedDb.IndexedDbManager.<AddAsync>d__7`2[[Application.Models.Game, Application, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[System.Text.Json.JsonElement, System.Text.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51]].MoveNext()
at Magic.IndexedDb.MagicQuery`1.<AddAsync>d__49[[Application.Models.Game, Application, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()
at Application.Pages.Home.TestGame() in C:\Users\ardva\source\repos\Ard2025\magicIssue\Application\Pages\Home.razor.cs:line 53
at Application.Pages.Home.<BuildRenderTree>b__4_3() in C:\Users\ardva\source\repos\Ard2025\magicIssue\Application\Pages\Home.razor:line 24
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
The text was updated successfully, but these errors were encountered:
@Ard2025 Before I got off for the night, I was just taking a quick glance. I didn't see any dynamic objects so I don't think this is the issue, but was just verifying it's not related too: #84
Though I did also see that in "Game" there's "Result" which looks like an enum and/or a record I believe. I wonder if that's causing an issue. I will look into it this weekend as this should be a minor problem to resolve.
#89 Should solve this issue. I am not sure why this works tho. I saw in other projects where a custom resolver was used that an break statement was used when an endarray token was encountered. This attempt seems to work. I have put it into a seperate statement because combining it with the top statement wasn't working for some reason, maybe that was just om my laptop.
When adding data to the magicdb the token endarray is unexpected. To demonstrate i have minimized my application into a demo. in here adding to the player database does work, but not for the event and game tables. The demo code can be found at https://github.com/Ard2025/MagicIssue-endarray-token. The following error does appear.
The text was updated successfully, but these errors were encountered: