[Serializable] vs. MarshalByRefObject in COM+ application - 11-16-2004 , 07:37 AM
I have a COM+ application implemented as managed code (a C# class
deriving from ServicedComponent). It gives out another C# class as a
return value for one of it's methods.
I've found (and seen it confirmed on these newsgroups) that this will
only work if the class returned from my COM+ application's method is
- marked as [Serializable]
- derived from MarshalByRefObject.
However here's what I don't understand: I would assume (and have seen
it alluded to) that the class would be passed by value if it was
marked as [Serializable], and would be passed by reference if it
derived from MarshalByRefObject. I'm seeing it passed by reference in
I tested this by marking the class as [Serializable] (and not deriving
it from MarshalByRefObject) and then invoking the method on my COM+
application that returns an instance of the class.
- When the class is huge (a public byte array of 10000 bytes), I
don't see that much DCOM traffic on the network, so clearly the whole
thing is not being serialized from the server to the client
- When I set a breakpoint on one of the class's methods on the COM+
server, it is hit when that method is invoked from the client. If the
object was being serialized and passed by value to the client, I
should not hit the breakpoint on the server.
Does anyone know what this behavior is?
|Thread Tools||Search this Thread|