Problem deserializing a custom class "'One of the serialized keys is null."

P

Paul

Hi All.

We have a custom class which we serialize. This class is regularly updated, and the old requests do not have a problem opening, apart from a couple!!! When it try's to deserialize the class I receive "One of the serialized keys is null". I tried to change the constructor "below" to check if the object is null to change is to a new object and set the value but still have the same error. Any ideas? as we need to keep backward compatibly.



Private Sub New(ByVal Info As SerializationInfo, ByVal Context As StreamingContext)

On Error Resume Next

Dim fieldValue As Object = Nothing

Dim i As Int32

Dim thisType As Type = Me.GetType()

Dim mi As MemberInfo() = FormatterServices.GetSerializableMembers(thisType, Context)

For i = 0 To mi.Length - 1

Dim fi As FieldInfo = mi(i)

fieldValue = Nothing

fieldValue = Info.GetValue(fi.Name, fi.FieldType)

If (Not fieldValue Is Nothing) Then fi.SetValue(Me, fieldValue)

Next
 
Joined
Oct 21, 2009
Messages
1
Reaction score
0
Hello,

i know how old this thread is. But i have now the same problem as you. On the internet i cant find any details about this problem.

What was your solution to solve this Problem?


Greets
Sebastian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top