Skip to content

Fix table diagnostic JSON reading from database header - #122

Open
dajiaohuang wants to merge 1 commit into
Cysharp:masterfrom
dajiaohuang:fix/tableinfo-payload-offset-20261015
Open

dajiaohuang wants to merge 1 commit into
Cysharp:masterfrom
dajiaohuang:fix/tableinfo-payload-offset-20261015

Conversation

@dajiaohuang

Copy link
Copy Markdown

Problem

For a valid database produced by DatabaseBuilder.Build(), MemoryDatabase.GetTableInfo(binary)[0].DumpAsJson() reads the database header instead of the table records. With the existing Sample fixture plus ItemMaster, the first table dump is {"s_a_m_p_l_e":[0,193],"item_master":[193,10]} rather than the Sample array.

The header stores table offsets relative to the payload after the header. GetTableInfo passes those offsets to TableInfo against the complete binary, so the copied bytes start too early. Normal database loading already slices past the header.

Change

Add the consumed header length when constructing diagnostic table info. No binary format or public API changes. Add a regression exercising first and subsequent tables and both DumpAsJson overloads with the maintained synthetic fixtures.

Validation

  • Added regression fails against the unmodified base, returning header JSON instead of records; passes with the fix.
  • dotnet build -c Release: passed.
  • dotnet test -c Release --no-build: 29 runtime and 7 generator tests passed.
  • dotnet pack -c Release --no-build -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg: passed.
  • Tested on Windows, SDK 10.0.100 / .NET 9 runtime. Existing dependency-advisory and net6 benchmark EOL warnings remain; no Unity/IL2CPP execution performed.

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

Successfully merging this pull request may close these issues.

1 participant