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

Discussion in 'ASP .Net' started by Paul, Jul 21, 2006.

  1. Paul

    Paul Guest

    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
     
    Paul, Jul 21, 2006
    #1
    1. Advertising

  2. Paul

    sctosh

    Joined:
    Oct 21, 2009
    Messages:
    1
    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
     
    sctosh, Oct 21, 2009
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. PJ
    Replies:
    1
    Views:
    1,814
    Ramzey
    Jun 25, 2003
  2. =?Utf-8?B?U3RldmUgQnVnZGVu?=

    Problem deserializing file from asp.net

    =?Utf-8?B?U3RldmUgQnVnZGVu?=, Aug 20, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    489
    =?Utf-8?B?U3RldmUgQnVnZGVu?=
    Aug 21, 2005
  3. Goofball
    Replies:
    1
    Views:
    969
    Tom Hawtin
    Jun 11, 2007
  4. Replies:
    0
    Views:
    655
  5. Replies:
    5
    Views:
    615
    RYoung
    Dec 15, 2006
Loading...

Share This Page