R
Russ
Hi,
I'm trying to build a gerenic routine which deals with versioning problems
between serailized objects. All my objects are Serialized into a SQL
server DB, but I need to make changes to the object tree and also make
future changes easier.
I'm using custom serialization and reflection and I think I'm getting there,
but I have a wierd problem. I've extracted all the properties from the
object in question and passed the info to the following VB routine. It's
working fine until it encounters an invalid member in the serializationinfo
(which is expected - it's a newly added property in my object), but after
that it never recovers - from that point on I'm getting a
serializationexeption (member <name> not found) for each subsequent property
even when the member definitely exists in the serializationinfo. This only
happens AFTER the expected error, until then it's fine.
Any clues?
Thanks,
Russ
Private Shared Function CopyObject(ByVal Info As SerializationInfo, ByVal
PI() As PropertyInfo, ByRef O As Object)
Dim P As PropertyInfo
For Each P In PI
Try
P.SetValue(O, Info.GetValue(P.Name, P.PropertyType), Nothing)
Catch ex As Exception
End Try
Next
Return O
End Function
I'm trying to build a gerenic routine which deals with versioning problems
between serailized objects. All my objects are Serialized into a SQL
server DB, but I need to make changes to the object tree and also make
future changes easier.
I'm using custom serialization and reflection and I think I'm getting there,
but I have a wierd problem. I've extracted all the properties from the
object in question and passed the info to the following VB routine. It's
working fine until it encounters an invalid member in the serializationinfo
(which is expected - it's a newly added property in my object), but after
that it never recovers - from that point on I'm getting a
serializationexeption (member <name> not found) for each subsequent property
even when the member definitely exists in the serializationinfo. This only
happens AFTER the expected error, until then it's fine.
Any clues?
Thanks,
Russ
Private Shared Function CopyObject(ByVal Info As SerializationInfo, ByVal
PI() As PropertyInfo, ByRef O As Object)
Dim P As PropertyInfo
For Each P In PI
Try
P.SetValue(O, Info.GetValue(P.Name, P.PropertyType), Nothing)
Catch ex As Exception
End Try
Next
Return O
End Function