I have two different applications and I am using GroupLab Networking to communicate between them. The idea is there is a shared dictionary and when something changes in this shared dictionary, the other application gets a notification. The notification part works. Here is the problem. I have the following code in the first application.
TouchInfo t = new TouchInfo();
int.TryParse(txtXCoord.Text, out t.X);
int.TryParse(txtYCoord.Text, out t.Y);
this.sharedDictionary1["/pointOne"] = t;
Where TouchInfo is a struct. This object stored in the shared dictionary can be accessed by both applications. The code looks like this:
TouchInfo val = (TouchInfo)this.sharedDictionary1["/pointOne"]
While this code works in the application that created the object. I get the following error in the second:
{Unserializable object: problem: System.Runtime.Serialization.SerializationException: Unable to find assembly 'NetworkingTestProgramOne, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
I realize this problem is because the serialization also stores the assembly information of the program that serialized it. But I do need it to communicate across different programs. How do I make this work?
Have you got
TouchInfodeclared in two different assemblies? That’s a bad idea – you should have one common assembly containing the types required by both applications.Personally I’d try to avoid the default .NET binary serialization anyway, preferring something more controllable – I’m biased towards Google Protocol Buffers for various reasons. Does GroupLab Networking require “normal” binary serialization?
As an aside, I’d also try to avoid using mutable structs if at all possible.