I have an application that includes several serializable classes that are all
output using the SOAP formatter. Over the years, I've added several
OptionalFieldAttributes to various members of the classes.
Now, on one particular class I'm trying to add an additional
OptionalFieldAttribute, but when I deserialize the objects I get an
ArgumentNullException with a message of: "Member at position 22 was null."
I can move the new field to a different class and everything works just
fine. This error only happens in the single class where I need this new
attribute.
This is the 8th OptionalField to be added to the class. The actual code is
as follows:
<OptionalFieldAttribute(VersionAdded:=6)Private _Status As Integer
The top part of the stack trace includes the following:
at
System.Runtime.Serialization.FormatterServices.Pop ulateObjectMembers(Object
obj, MemberInfo[] members, Object[] data)
at
System.Runtime.Serialization.Formatters.Soap.ReadO bjectInfo.PopulateObjectMembers()
at
System.Runtime.Serialization.Formatters.Soap.Objec tReader.ParseObjectEnd(ParseRecord pr)
at
System.Runtime.Serialization.Formatters.Soap.Objec tReader.Parse(ParseRecord
pr)
at
System.Runtime.Serialization.Formatters.Soap.SoapH andler.EndElement(String
prefix, String name, String urn)
at System.Runtime.Serialization.Formatters.Soap.SoapP arser.ParseXml()
at System.Runtime.Serialization.Formatters.Soap.SoapP arser.Run()
at
System.Runtime.Serialization.Formatters.Soap.Objec tReader.Deserialize(HeaderHandler handler, ISerParser serParser)
at
System.Runtime.Serialization.Formatters.Soap.SoapF ormatter.Deserialize(Stream
serializationStream, HeaderHandler handler)
at
System.Runtime.Serialization.Formatters.Soap.SoapF ormatter.Deserialize(Stream
serializationStream)
at ... [my calling function]
I've found a similar post at
http://social.msdn.microsoft.com/For...-ce25f16af0e7/
that did not include a resolution to the problem either.
I'm trying to figure out how to handle this issue so I can serialize this
additional field correctly and handle previously saved data files.
Jason