serializing/deserializing with remoting

J

jeff

I am using .NET remoting with a class,call it MyClass, that
contains many other classes (say one of them is
MySubClass). I have been able to successfully call
functions from the MyClass, but when I try to access the
sub-classes it gives me a:
System.Runtime.Serialization.SerializationException
"The constructor to deserialze an object of type
MyClass.MySubClass was not found."

error. I do have the '[Serializable]' modifier preceeding
the MyClass defn. and preceeding the other subclasses as well.
Also I have included an extra line for MySubClass in my
server.exe.config:

<service>
<wellknown
type="MyNameSpace.MyClass,MyAssemblyName"
objectUri = "MyClass.soap"
mode="Singleton"
/>
<wellknown type="MyNameSpace.MyClass.MySubClass,MyAssemblyName"
objectUri = "MyClass/MySubClass.soap"
mode="Singleton"
/>
</service>

as well as the corresponding lines in the client.exe.config.
What is the serialization/deserialization process for remoting?
What am I missing?

Cheers,

Jeff.
 
R

Rob Teixeira [MVP]

Chances are that one of your objects implements the ISerializable interface
(or inherits from a class that does). This typically happens on type-safe
collections.
That being the case, you need to include the deserialization constructor on
that class (check the help docs for the exact signature of the constructor)
and call the base deserialization constructor from there. Remember that
constructors on the base object aren't propegated to the derived object in
inheritance.

-Rob [MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top