473,574 Members | 17,471 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1656
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*******@gmai l.comschreef in bericht
news:43******** *************** ***********@k1g 2000prb.googleg roups.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 DataContractSer ializer 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; "serializat ion 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
2448
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 System.Collections.Comparer has 1 members, number of members deserialized is 0. at...
2
2228
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 one of them is serializable, these methods have been added and work properly. As an additional headache this custom class can also include a few...
11
11937
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 streams. I ran the test for 50K, 100K, 500K iterations, where each iteration consists of sending an object from a client process to a server process,...
3
2862
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 able to get a reference to the remote object and that works fine. When I try to make a call to a remote object's method I get an exception:...
0
913
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 reading and am trying to put the pieces together before coding but never having worked seriously with XML, I need some direction. I will be generating...
2
1075
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 default values are obviously NOT serializad. Instead, they are serialized when they are different from those of default. Sample: Class ColorClass...
1
3481
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 the overhead at startup and thus enhance the performance of our applications. The programs are coded in c# under .net 1.1.
3
1454
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 is shared between the two applications, so they are using exactly the same code (this module also contains the class, so I am certain the class code...
2
3842
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). Not counting storing data in a database (which is obviously suitable for some things, but not necessary or even necessarily desirable for other...
0
7738
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8081
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8119
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6482
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5635
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5322
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3759
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3771
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1359
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.