ConfigurationCollection
Count = 0;
CollectionType = AddRemoveClearnMap;
Items = {Count = 4};
_removedItemCount = 4;
我有一个ConfigurationCollection, 其中四个Element被删掉了, 然后在试图序列化的时候抛NullReferenceException.
不明白这是为什么, 把所有removed item 清掉就没有这个问题。
Stack:
System.Configuration.dll!System.Configuration.ConfigurationElement.SerializeElement(System.Xml.XmlWriter writer = null, bool serializeCollectionKey = true) + 0x348 bytes System.Configuration.dll!System.Configuration.ConfigurationElementCollection.SerializeElement(System.Xml.XmlWriter writer = null, bool serializeCollectionKey) + 0x219 bytes
System.Configuration.dll!System.Configuration.ConfigurationElement.SerializeToXmlElement(System.Xml.XmlWriter writer = {System.Xml.XmlWellFormedWriter}, string elementName = "materials") + 0x5e bytes
System.Configuration.dll!System.Configuration.ConfigurationElement.SerializeElement(System.Xml.XmlWriter writer = {System.Xml.XmlWellFormedWriter}, bool serializeCollectionKey = false) + 0x3ee bytes