public void KeepRemoteObjectAlive() { sum = CSScript.Evaluator .CreateDelegateRemotely(@"int Sum(int a, int b) { return a+b; }"); //Normally remote objects are disposed if they are not accessed withing a default timeout period. //It is not even enough to keep transparent proxies or their wrappers (e.g. 'sum') referenced. //To prevent GC collection in the remote domain use .NET ClientSponsor mechanism as below. sumSponsor = sum.ExtendLifeFromMinutes(30); }
public void KeepRemoteObjectAlive() { sum = CSScript.Evaluator .CreateDelegateRemotely(@"int Sum(int a, int b) { return a+b; }"); //Normally remote objects are disposed if they are not accessed withing a default timeout period. //It is not even enough to keep transparent proxies or their wrappers (e.g. 'sum') referenced. //To prevent GC collection in the remote domain use .NET ClientSponsor mechanism as below. sumSponsor = sum.ExtendLifeFromMinutes(30); }