public TResult SimulateBrowsingSession <TResult>(Func <BrowsingSession, TResult> testScript) { var serializableDelegate = new SerializableDelegate <Func <BrowsingSession, TResult> >(testScript); FuncExecutionResult <TResult> result = appDomainProxy.RunBrowsingSessionInAppDomain2(serializableDelegate); CopyFields <object>(result.DelegateCalled.Delegate.Target, testScript.Target); return(result.DelegateCallResult); //return appDomainProxy.RunBrowsingSessionInAppDomain(serializableDelegate); }