internal ServicedComponentProxy(Type serverType, bool fIsJitActivated, bool fIsPooled, bool fAreMethodsSecure, bool fCreateRealServer) : base(serverType, _stub, -1) { this._gitCookie = 0; this._fIsObjectPooled = fIsPooled; this._fIsJitActivated = fIsJitActivated; this._fDeliverADC = this._fIsObjectPooled || this._fIsJitActivated; this._fIsActive = !this._fDeliverADC; this._tabled = false; this._fUseIntfDispatch = fAreMethodsSecure; this._context = NegativeOne; this._token = NegativeOne; this._tracker = null; this._callback = new Callback(); this._pPoolUnk = IntPtr.Zero; if (Util.ExtendedLifetime) { this._scstub = new ServicedComponentStub(this); } if (fCreateRealServer) { try { this.ConstructServer(); } catch (Exception exception) { if ((exception is NullReferenceException) || (exception is SEHException)) { throw; } this.ReleaseContext(); if (!Util.ExtendedLifetime) { this.ReleaseGitCookie(); } this._fIsServerActivated = false; GC.SuppressFinalize(this); throw; } this.SendCreationEvents(); } }
private void SetupContext(bool construction) { IntPtr currentContextToken = Proxy.GetCurrentContextToken(); if (this._token != currentContextToken) { if (this._token != NegativeOne) { this.ReleaseContext(); } this._token = currentContextToken; this._context = Proxy.GetCurrentContext(); this._tracker = Proxy.FindTracker(this._context); } if (!this._filterConstructors) { RealProxy.SetStubData(this, this._token); } if ((this.IsJitActivated && !this._tabled) && !construction) { IdentityTable.AddObject(this._token, this.GetTransparentProxy()); this._tabled = true; } }