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
{{ message }}
Repository navigation
[Xml serialization]ReflectionXmlSerializationWriter is using Array.GetValue method for primary type arrays #67221
When serializing arrays of primary type I've found a code which fallbacks to Array.GetValue in ReflectionXmlSerializationWriter .WriteArrayItems method. Code:
var arr = o as IList;
if (arr != null)
{
for (int i = 0; i < arr.Count; i++)
{
object? ai = arr[i];
WriteElements(ai, null/*choiceName + "i"*/, elements, text, choice, true, true);
}
}
This results in a lot of allocations in simple serialization loop program.
This is not a real issue found in production code - just something that popups while trying to optimize the upper allocation :
Activity
[XmlSerializer] Avoid `IList`/`Array.GetValue` path for array item se…