Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 scenario where GetTransparentProxy will return null, but I'm getting a null back when I call it.

What circumstances will cause this behavior?

like image 744
David Pfeffer Avatar asked Dec 23 '10 17:12

David Pfeffer


1 Answers

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
    {
        ...
    }

    ...
}
like image 74
David Pfeffer Avatar answered Nov 01 '22 09:11

David Pfeffer