473,396 Members | 1,998 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,396 software developers and data experts.

Serialization between two different applications.

Hi.

There are a server and a client, and I need to exchange "Message"
objects between them. The class Message included in both applications
has the exact signature (namespace, all fields, methods, etc. In fact,
I copied the same file into both projects) But serialzing from one
side and deserializing on the other side causes assembly not found
exception. I've searched the internet and found some article that said
I need to implement ISerializable to work around, but after trying
that, I think that might only work on the same application
(assembly).

What should I do? I know the easiest solution to this is to move the
class "Message" into a separate assembly and refer to it in both
applications (server and client), but is this the only way? The
Message classes in the two applications are exactly the same (again,
copy and paste) , can't I somehow convert the deserialized object into
Message object, by force? I would like to hear how you deal with this
kind of situation, because I think probably many people already have
encountered with this problem before. Thank you.

Jun 27 '08 #1
3 1643
Sin Jeong-hun,

You have made from your Message a seperated DLL library (or put it in a for
you common library).

Then you could use the class on both sides to serialize and deserialize by
just referencing to it and using it..

Cor

Yo
"Sin Jeong-hun" <ty*******@gmail.comschreef in bericht
news:43**********************************@k1g2000p rb.googlegroups.com...
Hi.

There are a server and a client, and I need to exchange "Message"
objects between them. The class Message included in both applications
has the exact signature (namespace, all fields, methods, etc. In fact,
I copied the same file into both projects) But serialzing from one
side and deserializing on the other side causes assembly not found
exception. I've searched the internet and found some article that said
I need to implement ISerializable to work around, but after trying
that, I think that might only work on the same application
(assembly).

What should I do? I know the easiest solution to this is to move the
class "Message" into a separate assembly and refer to it in both
applications (server and client), but is this the only way? The
Message classes in the two applications are exactly the same (again,
copy and paste) , can't I somehow convert the deserialized object into
Message object, by force? I would like to hear how you deal with this
kind of situation, because I think probably many people already have
encountered with this problem before. Thank you.
Jun 27 '08 #2
As an alternative - is xml serialization an option? Both XmlSerializer
and DataContractSerializer should be perfectly happy with this setup.
The latter has the advantage that it can [optionally, not by default]
cope with full graphs, where-as XmlSerializer is limited to trees
[i.e. no loops back to objects that have already been serialized in
the same branch].

Xml also has a few tricks when it comes to evoloving the type, and xml
compresses very well with things like GZip if data volume is an issue.

Marc
Jun 27 '08 #3
I forgot to add; "serialization surrogates" may be an option, but
frankly it gets very messy very quickly. Not my first choice...

(my first choice would be assembly sharing ;-p)

Marc
Jun 27 '08 #4

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

Similar topics

3
by: Alexander | last post by:
When i store rule on PC with .NET.SP1 i cant restore them from PC without SP1. An i get this Error: System.Runtime.Serialization.SerializationException: Possible Version mismatch. Type...
2
by: Just D. | last post by:
All, 1. Did anybody write Serialization/Deserialization of some custom class derived from the CollectionBase class? The custom class is like a container of many different simple classes, each...
11
by: ajou_king | last post by:
I was running some tests on my Win32 1GHZ processor to see how long it would take to transmit objects numerous times via TCP/IP using C# ..NET Remoting vs the C++ trustworthy method of binary...
3
by: Steve | last post by:
I've been following a couple remoting tutorials on the web, they are all pretty much the same. I've got my different applications built(client, server and remote object (dll)) The client is...
0
by: BK | last post by:
I am using VB.NET in Visual Studion 2003 I am going to have to build an application that uses XML, Serialization and display. I have been asked to implement it using XML. I have done some...
2
by: Carlo, MCP | last post by:
Hello, I'm troubling from months with a serious serialization problem that I'm not able to solve. I try to describe as simply as I can. 1) I have a class tha does something with colors. All...
1
by: Thomas Qvist | last post by:
We are building a suite of programs consisting of both winforms applications and office addins. We would like to pre-generate the xml-serialization classes and add it to our project to avoid...
3
by: Marc | last post by:
Hi, I am trying to serialize a data structure -- a list (of custom class) -- in one application, then read it in with another application. My serialize and deserialize subs are in a module that...
2
by: Peter Duniho | last post by:
I've been learning about mechanisms .NET offers to export data. The initial goal is to see what sorts of ways are available to save an application's state (document, internal database, whatever). ...
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
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...

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.