From e72155965e2ae584153a3e426e17b8b790724bea Mon Sep 17 00:00:00 2001 From: Peter Shrosbree Date: Fri, 23 Oct 2026 22:33:05 -0700 Subject: [PATCH] Fix rid lists when the target table has 0xFFFF rows With 0xFFFF rows the list column is normally 2 bytes wide, so the end-of-table value 0x10000 is stored as 0 in every row after the last owner with items. GetRidList handled that 0 only when the next row was the source table's last row. With two or more trailing empty owners, the last owner with items got an empty list, so its params, fields or PDB local variables were silently dropped. Treat a 0 in the next row as the end of the table whenever the target table has 0xFFFF rows. ENCMetadata.GetRidList already treats any 0 as the end. --- src/DotNet/MD/CompressedMetadata.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DotNet/MD/CompressedMetadata.cs b/src/DotNet/MD/CompressedMetadata.cs index 680620558..7b6ce8b7c 100644 --- a/src/DotNet/MD/CompressedMetadata.cs +++ b/src/DotNet/MD/CompressedMetadata.cs @@ -148,7 +148,7 @@ RidList GetRidList(MDTable tableSource, uint tableSourceRid, int colIndex, MDTab uint lastRid = tableDest.Rows + 1; if (startRid == 0 || startRid >= lastRid) return RidList.Empty; - uint endRid = !hasNext || (nextListRid == 0 && tableSourceRid + 1 == tableSource.Rows && tableDest.Rows == 0xFFFF) ? lastRid : nextListRid; + uint endRid = !hasNext || (nextListRid == 0 && tableDest.Rows == 0xFFFF) ? lastRid : nextListRid; if (endRid < startRid) endRid = startRid; if (endRid > lastRid)