473,394 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

SoapFormatter, Serialization of a DictionaryBase derived class - Please help

a
Hi,

I am using a SoapFormatter to serialize a class which has a member that is
derived from DictionaryBase.

Everything works fine... I can serialize and deserialize. The trouble I
have is that I need to implement versioning, so I have to implement the
ISerializable interface and provide the GetObjectData function and the
constructor to deserialize the object. When I try to deserialize the member
that is derived from DictionaryBase, I get an empty object.

Here is some sample code:

<Serializable()> _
Public Class clsSimpleDictionary
Inherits DictionaryBase
'
' I have removed all the code just to be concise
'
End Class

<Serializable()> _
Public Class SerializedSettings
Implements ISerializable

Public m_SMTPServer As String
Public m_AddressBook As clsSimpleDictionary

Public Sub New()
m_AddressBook = New clsSimpleDictionary
End Sub

Protected Sub New(ByVal info As SerializationInfo, ByVal context As
StreamingContext)
Try
m_SMTPServer = info.GetString("m_SMTPServer")

'
' This is the offending line
'
m_AddressBook = info.GetValue("m_AddressBook",
GetType(clsSimpleDictionary))
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
End Sub

Private Sub GetObjectData(ByVal info As SerializationInfo, ByVal context
As StreamingContext)
Implements ISerializable.GetObjectData

info.AddValue("m_SMTPServer", m_SMTPServer, m_SMTPServer.GetType())
info.AddValue("m_AddressBook", m_AddressBook,
m_AddressBook.GetType())
End Sub

End Class

If I don't implement ISerializable, the SoapFormatter will serialize and
deserialize the clsSimpleDictionary member fine.

Can somebody please point me in the right direction.

TIA

Allan
Nov 20 '05 #1
0 1127

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Philip Reed | last post by:
I'm trying to write a preferences-handling infrastructure that serializes prefs to XML. Basically I want to read in a common "default" prefs set, then read in the user's prefs and override the...
0
by: craig | last post by:
Hi, I'm new to all this and having tremendous difficulty trying to deserialize the following: <soap-env:Envelope...
2
by: Paul | last post by:
We currently persist our objects to xml/soap files using a SoapFormatter. We control the serialization and de-serialization by implementing the ISerializable and its two interface methods, namely,...
1
by: Jim S | last post by:
I have an application where I have to make a tree of objects. To do this, I have my own node class. At certain points in the application, I need to save data. I am having a problem with the...
2
by: Phillip Galey | last post by:
I have an object called Place which contains only string properties and has the <Serializable()> flag before the class name declaration. I also have a collection object called Places, which is...
0
by: Allan Scullion | last post by:
<Sorry, sent again with a sensible name and replay address> Hi, I am using a SoapFormatter to serialize a class which has a member that is derived from DictionaryBase. Everything works...
0
by: GrandpaB | last post by:
I have an error that I have not been able to find. Any insight you can offer would be most appreciated. I believe that the problem is associated with the SoapFormatter. The application allows...
3
by: Wiebe Tijsma | last post by:
Hi, I'm trying to serialize a KeyedCollection with the SoapFormatter, however I'm getting the exception: System.Runtime.Serialization.SerializationException: Soap Serializer does not support...
5
by: =?Utf-8?B?TWFydHluIEZld3RyZWxs?= | last post by:
Hi there. I posted an earlier issue under the name "That assembly does not allow partially trusted callers" but have now identified what the issue is. As explained before I am working in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.