我在哪里可以找到 RemotingServices.CreateTransparentProxy 实现?

Where I can find RemotingServices.CreateTransparentProxy implementation?

我试图通过深入研究源代码来深入了解 WCF ChannelFactory 创建的透明代理的工作原理。 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。因此,实现必须位于 class 内,称为 RemotingNative,但在存储库中搜索不会给我任何结果。

我在 github 上发现了一些旧的 SSCLI 代码,其中包含 similar method implementation 但不完全相同。除此之外,我想看看实际的实施情况。

WCF 成为 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 是您寻找的地方。如果你想要 实际 实现 RemotingServices.CreateTransparentProxy() 而不是 SSCLI 代码可能是一个很好的近似值,正如@Christian.K 指出的那样。