I'm working on my first project that uses AppDomains and I'm wondering what happens when an object derives from MarshalByRefObject and is also marked [Serializable]?
for example:
[Serializable]
public class DummyClass: MarshalByRefObject
{
}
I'm working on my first project that uses AppDomains and I'm wondering what happens when an object derives from MarshalByRefObject and is also marked [Serializable]?
for example:
[Serializable]
public class DummyClass: MarshalByRefObject
{
}
It gets marshalled by reference, but can still be serialised for other use-cases for serialisation. There's an implementation detail to this that is interesting enough to be worth noting: The formatter that is serialising for remoting uses a
SurrogateSelector
that will produce a proxy for anyMarshalByRefObject
it serialises, hence serialising will still result in marshalling by reference. Other serialisation uses won't have thatSurrogateSelector
and so won't have that effect.