Dictionary inside list serialization error
See original GitHub issueI have following code structure:
And when serializing it this error occurs: System.ArgumentNullException: 'Value cannot be null. Parameter name: key'
Stack:
at System.Collections.Generic.Dictionary`2.FindEntry(TKey key) at ExtendedXmlSerializer.ExtensionModel.Xml.XmlWriter.CreatePrefix(String identifier) at ExtendedXmlSerializer.ExtensionModel.Xml.XmlWriter.Get(TypeParts parameter) at ExtendedXmlSerializer.ExtensionModel.Xml.XmlWriter.GetType(TypeInfo parameter) at ExtendedXmlSerializer.ExtensionModel.Xml.XmlWriter.Get(MemberInfo parameter) at ExtendedXmlSerializer.ExtensionModel.Xml.OptimizedNamespaceXmlWriter.Get(MemberInfo parameter) at ExtendedXmlSerializer.ContentModel.Format.FormattedContent`1.Get(IFormatWriter writer, T instance) at ExtendedXmlSerializer.ContentModel.Format.ContextualWriter`1.Write(IFormatWriter writer, T instance) at ExtendedXmlSerializer.ContentModel.DecoratedWriter`1.Write(IFormatWriter writer, T instance) at ExtendedXmlSerializer.ContentModel.Serializer`1.Write(IFormatWriter writer, T instance) at ExtendedXmlSerializer.ContentModel.Properties.Property`1.Write(IFormatWriter writer, T instance) at ExtendedXmlSerializer.ContentModel.Collections.ArrayIdentity.Write(IFormatWriter writer, Array instance) at ExtendedXmlSerializer.ContentModel.GenericWriterAdapter`1.Write(IFormatWriter writer, Object instance) at ExtendedXmlSerializer.ContentModel.Content.Enclosure`1.Write(IFormatWriter writer, T instance) at ExtendedXmlSerializer.ContentModel.SerializerAdapter`1.Write(IFormatWriter writer, T instance) at ExtendedXmlSerializer.ExtensionModel.RootInstanceExtension.Serializer.Write(IFormatWriter writer, Object instance) at ExtendedXmlSerializer.ExtensionModel.Xml.Write.Execute(Writing parameter) at ExtendedXmlSerializer.ExtensionModel.Xml.Serializer.Serialize(XmlWriter writer, Object instance) at ExtendedXmlSerializer.ExtensionModel.Xml.ExtendedXmlSerializer.Serialize(XmlWriter writer, Object instance) at ExtendedXmlSerializer.ExtensionModel.Xml.InstanceFormatter.Get(Object parameter) at ExtendedXmlSerializer.ExtensionMethodsForSerialization.Serialize(IExtendedXmlSerializer this, XmlWriterSettings settings, Object instance)
If this object is serialized by itself (and not inside the list) everything works fine.
Issue Analytics
- State:
- Created 3 years ago
- Comments:14 (9 by maintainers)
Top GitHub Comments
Alright, good news @maxkoshevoi I managed to figure out a fix: https://github.com/ExtendedXmlSerializer/home/pull/424#issuecomment-672267042
That’s the good news. The bad news is that the fix is in the core
XmlWriter
component which is used by everything. All our tests pass but even at 1200+ passing tests, it makes me nervous to publish and possibly break someone else out there. Oh well, such is the life of software development/deployment. 😁Anyways, let me know if that build treats you better. I release every Tuesday, but since this one might be impacting I will let it sit until next Tuesday and see if I can think of a better solution. Please feel free to use the preview build until then (and let me know of any further issues you encounter).
This has been deployed to NuGet:
https://www.nuget.org/packages/ExtendedXmlSerializer/
Please do let me know of any problems you find and I will investigate. Thank you for improving the quality of ExtendedXmlSerializer! Closing this issue for now.