Strange behaviour of .NET binary serialization on Dictionary

前端 未结 3 1400
北恋
北恋 2020-12-25 08:29

I encountered a, at least to my expectations, strange behavior in the binary serialization of .NET.

All items of a Dictionary that are loaded are added

3条回答
  •  被撕碎了的回忆
    2020-12-25 08:45

    I can reproduce the problem. Had a look around Google and found this: http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=94265 although I'm not sure it's the exact same problem, it seems pretty similar.

    EDIT:

    I think that adding this code may have fixed the problem?

        public void OnDeserialization(object sender)
        {
                this.Dictionary.OnDeserialization(sender);
        }
    

    No time to exhaustively test, and I want to beat Marc to the answer ;-)

提交回复
热议问题