views:

95

answers:

1

I have written a custom remoting formatter sink for an established application. The formatter appears to work for most cases until I try to use it to call a remote method to which I pass a call-back to a CAO. At this point I get a SerializationException indicating that I am trying to serialise the CAO, which is obviously not what I want to do. The CAO inherits from MBRO and object lifetimes do not come into play at this stage.

Does anyone know how I can serialise the incoming IMessage in my formatter in such a way as to preserve the reference to the CAO? I assume that I need to walk the object graph, converting the CAO to an ObjRef which can then be serialised but my problem is more fundamental as I do not have a concrete 'Message' to serialise, only an IMessage. I would prefer not to use reflection.

I am aware of WCF, but do not wish to migrate to it at this stage as the application is quite large.

+1  A: 

There's an excellent article on Codeproject that may provide you with the answers you are looking for. Implementing events/delegates in remoting is very tricky and the workaround is also tricky to implement. The best site to read up on this is this dude, Ingo Rammer who wrote and authored an excellent book on remoting. I have used GenuineChannels in the past to circumvent the usage of event handling limitation found in the standard .NET remoting and it does work. However GenuineChannels seems to be in trouble already...

Hope this helps, Best regards, Tom.

tommieb75
Thanks for your answer. However, my problem is not with using remoting. Rather it is with issues around the the implementation of my custom formatter sink when serialising IMessages containing remote method calls where one or more of the arguments is a delegate to a CAO (i.e. a call-back to the client).I have Ingo's book and whilst it is a good reference, it does not contain the answer to my question.
Roy