## Summary
`JsonPacketSerializer.SerializeEvents` throws `NotSupportedException` when given an `EntityMovedEvent` under AoT/source-generated STJ.
## Root cause
In `SerializeEventToDict`, the `EntityMovedEvent` arm is the only case that does:
```csharp
dict = JsonSerializer.Deserialize<Dictionary<string, object?>>(json1, GameServerJsonContext.Default.DictionaryStringObject) ?? dict;
```
leaving `JsonElement` values in the dictionary. Every other event arm uses `ConvertJsonToDictionary`, which unwraps to primitives.
When `SerializeEvents` then writes `List<Dictionary<string, object?>>` via `GameServerJsonContext`, AoT rejects `JsonElement`.
## Repro
Pinned characterization test: `JsonPacketSerializerSwitchCoverageTests.SerializeEvents_EntityMovedEvent_ThrowsNotSupported_DueToJsonElementLeak` on branch `test/coverage-wave-2026-07` / PR #454.
## Fix
Change the `EntityMovedEvent` arm to use `ConvertJsonToDictionary(json1)` like the sibling cases.
## Impact
JSON (browser/debug) clients cannot receive entity-moved events; MessagePack path is unaffected.
Verified 2026-08-07 against the synced default branch.
Code:spikersoft-backend@98102023 — still broken. SpikerSoft.GameServer/Network/JsonPacketSerializer.cs:170 is still the lone arm that does JsonSerializer.Deserialize<Dictionary<string, object?>>(json1, GameServerJsonContext.Default.DictionaryStringObject), leaving JsonElement values in the dictionary that :90 then hands to ListDictionaryStringObject under AoT.
Live:docker service ps spikersoft-gameserver_spikersoft-gameserver → 1/1 Running on SERVER, image redeployed 2026-08-07 12:25 UTC; JSON (browser/debug) clients still cannot receive entity-moved events. MessagePack path unaffected.
Remaining: Change the EntityMovedEvent arm at :170 to use ConvertJsonToDictionary(json1) like the sibling cases, then flip JsonPacketSerializerSwitchCoverageTests.SerializeEvents_EntityMovedEvent_ThrowsNotSupported_DueToJsonElementLeak.
Status: still broken — full detail carried over to the new issue.
Closing here. Work now lives in the repo that holds the fix, so fixes #541 in a PR will
auto-close it on merge. The umbrella tracker keeps cross-repo epics only.
— Opus 5 Agent
Migrated to **spikerj/spikersoft-backend#541** as part of the umbrella-tracker breakup.
Verified 2026-08-07 against the synced default branch.
- **Code:** `spikersoft-backend@98102023` — still broken. `SpikerSoft.GameServer/Network/JsonPacketSerializer.cs:170` is still the lone arm that does `JsonSerializer.Deserialize<Dictionary<string, object?>>(json1, GameServerJsonContext.Default.DictionaryStringObject)`, leaving `JsonElement` values in the dictionary that `:90` then hands to `ListDictionaryStringObject` under AoT.
- **Live:** `docker service ps spikersoft-gameserver_spikersoft-gameserver` → 1/1 Running on SERVER, image redeployed 2026-08-07 12:25 UTC; JSON (browser/debug) clients still cannot receive entity-moved events. MessagePack path unaffected.
- **Remaining:** Change the `EntityMovedEvent` arm at `:170` to use `ConvertJsonToDictionary(json1)` like the sibling cases, then flip `JsonPacketSerializerSwitchCoverageTests.SerializeEvents_EntityMovedEvent_ThrowsNotSupported_DueToJsonElementLeak`.
Status: still broken — full detail carried over to the new issue.
Closing here. Work now lives in the repo that holds the fix, so `fixes #541` in a PR will
auto-close it on merge. The umbrella tracker keeps cross-repo epics only.
— Opus 5 Agent
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
JsonPacketSerializer.SerializeEventsthrowsNotSupportedExceptionwhen given anEntityMovedEventunder AoT/source-generated STJ.Root cause
In
SerializeEventToDict, theEntityMovedEventarm is the only case that does:leaving
JsonElementvalues in the dictionary. Every other event arm usesConvertJsonToDictionary, which unwraps to primitives.When
SerializeEventsthen writesList<Dictionary<string, object?>>viaGameServerJsonContext, AoT rejectsJsonElement.Repro
Pinned characterization test:
JsonPacketSerializerSwitchCoverageTests.SerializeEvents_EntityMovedEvent_ThrowsNotSupported_DueToJsonElementLeakon branchtest/coverage-wave-2026-07/ PR #454.Fix
Change the
EntityMovedEventarm to useConvertJsonToDictionary(json1)like the sibling cases.Impact
JSON (browser/debug) clients cannot receive entity-moved events; MessagePack path is unaffected.
Migrated to spikerj/spikersoft-backend#541 as part of the umbrella-tracker breakup.
Verified 2026-08-07 against the synced default branch.
spikersoft-backend@98102023— still broken.SpikerSoft.GameServer/Network/JsonPacketSerializer.cs:170is still the lone arm that doesJsonSerializer.Deserialize<Dictionary<string, object?>>(json1, GameServerJsonContext.Default.DictionaryStringObject), leavingJsonElementvalues in the dictionary that:90then hands toListDictionaryStringObjectunder AoT.docker service ps spikersoft-gameserver_spikersoft-gameserver→ 1/1 Running on SERVER, image redeployed 2026-08-07 12:25 UTC; JSON (browser/debug) clients still cannot receive entity-moved events. MessagePack path unaffected.EntityMovedEventarm at:170to useConvertJsonToDictionary(json1)like the sibling cases, then flipJsonPacketSerializerSwitchCoverageTests.SerializeEvents_EntityMovedEvent_ThrowsNotSupported_DueToJsonElementLeak.Status: still broken — full detail carried over to the new issue.
Closing here. Work now lives in the repo that holds the fix, so
fixes #541in a PR willauto-close it on merge. The umbrella tracker keeps cross-repo epics only.
— Opus 5 Agent