egametang/ET · error · SerializationException
Serialization_MissingValues
Error message
Serialization_MissingValues
What it means
Thrown during OnDeserialization when the stored CountName is non-zero but the ItemsName entry (the T[] payload) is missing/null. The stream is internally inconsistent: it claims elements exist but none were written. Surfaces as a SerializationException (Serialization_MissingValues).
Source
Thrown at Packages/cn.etetet.core/Scripts/Core/Share/Collection/SortedSet.cs:1723
{
return; // Somebody had a dependency on this class and fixed us up before the ObjectManager got to it.
}
if (siInfo == null)
{
throw new SerializationException(SR.Serialization_InvalidOnDeser);
}
comparer = (IComparer<T>)siInfo.GetValue(ComparerName, typeof(IComparer<T>))!;
int savedCount = siInfo.GetInt32(CountName);
if (savedCount != 0)
{
T[] items = (T[])siInfo.GetValue(ItemsName, typeof(T[]));
if (items == null)
{
throw new SerializationException(SR.Serialization_MissingValues);
}
for (int i = 0; i < items.Length; i++)
{
Add(items[i]);
}
}
version = siInfo.GetInt32(VersionName);
if (count != savedCount)
{
throw new SerializationException(SR.Serialization_MismatchedCount);
}
siInfo = null;
}
#endregionView on GitHub (pinned to 5cab01f7a8)
Solutions
- Re-serialize the source data with the current code so both Count and Items are written.
- Audit any custom GetObjectData/serialization surrogate to confirm it writes ItemsName when count > 0.
- If migrating formats, write a converter that replays elements via Add rather than trusting the raw stream.
Defensive patterns
Strategy: validation
Validate before calling
// Before trusting a serialized set, verify the payload has both count and items in your own writer. // info.AddValue(CountName, set.Count); info.AddValue(ItemsName, set.ToArray());
Try / catch
try { /* deserialize */ } catch (SerializationException ex) when (ex.Message.Contains("Serialization_MissingValues")) { /* mark stream invalid, regenerate */ } Prevention
- Write all three keys (Comparer, Count, Items) together in custom surrogates.
- Regenerate persisted data after schema/format changes.
- Round-trip test serialization of non-empty sets in CI.
When it happens
Trigger: Deserializing a SortedSet whose serialized payload was truncated; a surrogate/selectors that wrote Count but skipped Items; version skew between the serializing and deserializing code that changed the ItemsName key; corrupted stream.
Common situations: Cross-version persistence (old data written before ItemsName existed); hand-edited or partially copied binary blobs; a custom ISerializable wrapper that forwards Count but drops the items array.
Related errors
- Serialization_InvalidOnDeser
- Serialization_MismatchedCount
- 不支持导出 UnityEngine.Object 类型: {runtimeType.FullName}
- {runtimeType.FullName} 缺少可用于导出的公共构造函数。必须通过构造函数提供的成员: {names}
- 无法为类型 {type.FullName} 生成稳定排序键
AI-assisted analysis of egametang/ET@5cab01f7a8 (2026-08-13).
Data as JSON: /api/errors/4d7b67f22a4430ec.
Report an issue: GitHub.