Pass a "non-serialized" object to another appdomain without Serilization/Deserialization (C#)

1k views Asked by At

What is the best way for passing a "non-serialized" object to another appdomain without Serilization/Deserialization ?

More detail: I'm going to invoke a function (from external assembly/plugin) in new appdomain and pass the result to main appdomain (main program). but (unfortunately) the result type is not serializable and therefore i faced to SerializationException

limitations:

the non-serialized type is in external assembly/dll. So i cannot mark it as serializable with attribute.

1

There are 1 answers

5
usr On

If you want to pass it through the remoting infrastructure it must be either by ref or serializable.

Since this type is neither you have limited options:

  1. Perform the processing in the remote app domain.
  2. Perform custom serialization to transfer the data you want (not the object). For example, copy the values to a serializable DTO class or use a serializer library.