[Mono-dev] XSP Problem : System.Exception: Error reading headers.

Brian Crowell mono-devel at fluggo.com
Mon Aug 21 14:42:19 EDT 2006


Lluis Sanchez wrote:
> They are not so silly. The problem is we can't leak objects created in
> one domain to another domain. That's why CADMessageBase makes a copy of
> the content of the CADObjRef, instead of reusing it.

The copies are made in CADMessageBase.UnmarshalArgument, which, if I'm not 
mistaken, is called after the jump to the new domain. That means that the 
contents of CADObjRef have already been serialized and deserialized, so no copy 
needs to be made-- the contents have already been copied.

The silly thing about it to me is that ObjRef is marked ISerializable. In other 
words, it knows how to serialize itself. CADObjRef takes advantage of this by 
storing the ObjRef in a field-- but once it's across the gap, it discards most 
of the ObjRef's internal information by only reporting the TypeName string on 
the other side.

Think about that-- the ObjRef's TypeInfo instance is serialized and 
deserialized, and then the type's name is pulled from this field to construct 
yet *another* TypeInfo instance from the *less* applicable type data at the far 
end of the channel.

That's why I changed the code to preserve the work the ObjRef had done in 
serializing itself, and used the CADObjRef type to preserve the only piece of 
information that the ObjRef is missing: the domain ID, needed to construct a 
path back to the object underlying the ObjRef.

--Brian



More information about the Mono-devel-list mailing list