I have a serializable Message class that has a Data As Object property that I’m using as a generic holder for information to be sent via a system that uses a combination of push technology and/or IPC to communicate with any other programs that are interested in the information. This allows the communication piece to be agnostic of the information it transmits.
I was serializing this Data As Object as a Byte[], since I was worried about how an Object being serialized and transmitted across the network would behave on the other side. However, when deserializing I get errors about being unable to find the assembly for the types stored within my Data As Object property, because I’m deserializing in the assembly that contains the Message class… not the assembly that contains the type that Data As Object originally was. The assembly that contains the description of the information being transmitted exists on both sides (although, I haven’t figured out how I’m going to take care of versioning gracefully yet).
Would sending an Object directly be a better solution? I was wondering if I’d lose the type information and be unable to cast it back to the type I want at the other end. Perhaps it’s not possible to pass a type as an Object via another assembly without it knowing about my type?
There’s a good chance I’m approaching the problem entirely the wrong way. Alternatives gladly accepted. Thanks!
A: No
A: Yes 🙂