1

Closed

Deserialization reliance on GetHashCode

description

Deserialization makes use of GetHashCode. However, some GetHashCode implementations (wrongly) expect that various references are not null (for example string fields). This leads to null exceptions, which is a serious issue.

It would be nice to have a workaround, maybe a setting to control what happens? For example, presume such instances are unique (I emulated this by substituting Guid.NewGuid().GetHashCode()). On the other hand, GetHashCode cannot guarantee uniqueness since it is limited to an int result. So there may be a more fundamental issue in play.

Any ideas?
Closed Jul 15, 2016 at 11:02 AM by MGholam

comments

MGholam wrote Oct 23, 2014 at 7:05 PM

Since deserialize is limited to what it has created then GetHashCode() should not have any problems, I you have come across a sample please send me it so I can work on it.