473,407 Members | 2,314 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,407 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 1128

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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.