开发者

Under what conditions will `RealProxy.GetTransparentProxy()` return `null`?

开发者 https://www.devze.com 2023-02-01 03:57 出处:网络
The documentation at http://msdn.microsoft.com/en-us/library/system.runtime.remoting.proxies.realproxy.gettransparentproxy%28v=VS.100%29.aspx doesn\'t indicate a scenari开发者_如何学Goo where GetTrans

The documentation at http://msdn.microsoft.com/en-us/library/system.runtime.remoting.proxies.realproxy.gettransparentproxy%28v=VS.100%29.aspx doesn't indicate a scenari开发者_如何学Goo where GetTransparentProxy will return null, but I'm getting a null back when I call it.

What circumstances will cause this behavior?


Nevermind, solved it. Its critical to have your RealProxy derived class call the base constructor with the type to be proxied. In my case:

public class MyProxy<T> : RealProxy
{
    public MyProxy()
        : base(typeof(T))    // this was missing
    {
        ...
    }

    ...
}
0

精彩评论

暂无评论...
验证码 换一张
取 消