Click here to Skip to main content
16,004,974 members
Home / Discussions / C#
   

C#

 
GeneralRe: (newbee) Reset all back to start app. Pin
S. Senthil Kumar15-Nov-05 21:26
S. Senthil Kumar15-Nov-05 21:26 
Questionmulti keyboard in c# Pin
storion15-Nov-05 8:40
storion15-Nov-05 8:40 
AnswerRe: multi keyboard in c# Pin
Judah Gabriel Himango15-Nov-05 12:10
sponsorJudah Gabriel Himango15-Nov-05 12:10 
QuestionOpenning an XML file into Excel Pin
zaboboa15-Nov-05 8:09
zaboboa15-Nov-05 8:09 
AnswerRe: Openning an XML file into Excel Pin
Judah Gabriel Himango15-Nov-05 12:12
sponsorJudah Gabriel Himango15-Nov-05 12:12 
QuestionXML Heeeelp ! Pin
kerberos_prozac15-Nov-05 6:25
kerberos_prozac15-Nov-05 6:25 
AnswerRe: XML Heeeelp ! Pin
Nick Parker15-Nov-05 18:24
protectorNick Parker15-Nov-05 18:24 
QuestionC#.Net - A Deserialization problem! Help!!! Pin
luckykhalid15-Nov-05 5:32
luckykhalid15-Nov-05 5:32 
I have two projects. One is Server and the other is client. I am using udpclient sockets for network communication. To send custom objects I have to serialize and desterilize by using binary formatters and memory streams. It works great if I use a single project having two threads and communicating with each other. But my actual task is to have two separate programs running on any two machines of a network. Now both the programs have different things to do as one is a server and the other is a client. The server waits for the client to send a custom object. The client serializes a custom object into stream of bytes and sends it to the server. At server side, the server receives the incoming stream and has to desterilize it back into the actual custom object.

My custom object is completely serializable as described inn msdn. Attribute is there and ISerializable interface is implemented.

Both the projects have different names and versions as they are separate assemblies. Now for casting I have included the class of my custom object in both the projects.

But, I get an exception at deserialization time in server. The exception is;

"An unhandled exception of type
'System.Runtime.Serialization.SerializationException'
occurred in mscorlib.dll

Additional information: Cannot find the assembly
Client.exe Version=1.0.2365, Culture=neutral,
PublicKeyToken=null."

What I perceive from this exception is that after serializing, the serialized object also contains the Assembly Meta Data info in which it was created e.g. Assembly Name, Assembly Version etc. So, at server side, when the object is deserialized back to its actual state then the CLR finds out that the deserialized object does not have correct information for the current running Assembly which is Server.exe. So, then CLR thinks that this deserialized object is incompatible with the current assembly i.e server.exe and tries to find the assembly Client.exe. When it is unable to find client.exe as it is not at server side so it raises the exception.

I solution to this problem is that Client and server programs reside in the same directory, which is never going to happen in my case.

Another solution to this problem is that I make a separate .dll for all my custom objects that need to be communicated between server/client and place the same copy of that dll at both the sides. But I don’t want to follow this solution coz then I would be spending my time in just checking the consistency of dll at both sides and what if a dll at some side is mistakenly replaced by some other dll. So chances of errors are more in this solution.

So I am looking for another solution. Please help me if u have one.
Thank you.


Regards
Khalid
AnswerRe: C#.Net - A Deserialization problem! Help!!! Pin
Russell Jones15-Nov-05 5:49
Russell Jones15-Nov-05 5:49 
GeneralRe: C#.Net - A Deserialization problem! Help!!! Pin
luckykhalid15-Nov-05 20:43
luckykhalid15-Nov-05 20:43 
GeneralRe: C#.Net - A Deserialization problem! Help!!! Pin
Russell Jones16-Nov-05 2:41
Russell Jones16-Nov-05 2:41 
AnswerRe: C#.Net - A Deserialization problem! Help!!! Pin
Rob Philpott15-Nov-05 8:53
Rob Philpott15-Nov-05 8:53 
AnswerRe: C#.Net - A Deserialization problem! Help!!! Pin
Marc Clifton15-Nov-05 13:13
mvaMarc Clifton15-Nov-05 13:13 
Questioninjecting code into another process Pin
Keith Vitali15-Nov-05 5:26
Keith Vitali15-Nov-05 5:26 
QuestionThreading slows down whole application Pin
smurfy3415-Nov-05 5:22
smurfy3415-Nov-05 5:22 
AnswerRe: Threading slows down whole application Pin
Andy Brummer15-Nov-05 5:46
sitebuilderAndy Brummer15-Nov-05 5:46 
GeneralRe: Threading slows down whole application Pin
smurfy3415-Nov-05 8:16
smurfy3415-Nov-05 8:16 
GeneralRe: Threading slows down whole application Pin
Andy Brummer15-Nov-05 11:32
sitebuilderAndy Brummer15-Nov-05 11:32 
AnswerRe: Threading slows down whole application Pin
kourvoisier15-Nov-05 10:36
kourvoisier15-Nov-05 10:36 
GeneralRe: Threading slows down whole application Pin
Robert Rohde15-Nov-05 11:16
Robert Rohde15-Nov-05 11:16 
GeneralRe: Threading slows down whole application Pin
kourvoisier15-Nov-05 11:27
kourvoisier15-Nov-05 11:27 
GeneralRe: Threading slows down whole application Pin
Andy Brummer15-Nov-05 11:37
sitebuilderAndy Brummer15-Nov-05 11:37 
QuestionARRGH!! Events are making me go bald Pin
Tom Wright15-Nov-05 5:20
Tom Wright15-Nov-05 5:20 
AnswerRe: ARRGH!! Events are making me go bald Pin
Russell Jones15-Nov-05 5:45
Russell Jones15-Nov-05 5:45 
GeneralRe: ARRGH!! Events are making me go bald Pin
Tom Wright15-Nov-05 6:48
Tom Wright15-Nov-05 6:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.