Search code examples
c#wcfclrtransparentproxy

Where I can find RemotingServices.CreateTransparentProxy implementation?


I'm trying to get insights about how transparent proxy created by WCF ChannelFactory work by digging into source codes. CreateTransparentProxy is marked by extern keyword and [MethodImplAttribute(MethodImplOptions.InternalCall)] attribute which means that I must look implementation inside CLR as long as my understanding goes. In CLR source codes I found only one mention of function that I need in some sort of c# to c++ code functions mapping file ecalllist.h. So implementation must be lying within class called RemotingNative, but search within repository doesn't give me any result on that.

I've found some old SSCLI codes on github which contains similar method implementation but not exactly the same. And besides that I want to look at actual implementation.


Solution

  • WCF become open sourced the other day. What I found so far is that WCF ServiceChannelProxy now use DispatchProxy.Create<T, TProxy>() instead of RemotingServices.CreateTransparentProxy().
    So it looks like if you want actual implementation of method that creates proxy used by WCF, than DispatchProxy and DispatchProxyGenerator are places that you look for. If you want actual implementation of RemotingServices.CreateTransparentProxy() than SSCLI codes may be a good approximation as @Christian.K pointed out.