序列化ConfigurationCollection失败

xiehuanxie 2010-01-28 02:38:34

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

...全文
51 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
freewind0521 2010-02-01
  • 打赏
  • 举报
回复
没做过,up
w_l_h_ 2010-01-28
  • 打赏
  • 举报
回复
小弟不会。给楼主顶顶,增加人气。

110,535

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧