internal virtual void AssertValid() { if (this.URI != null) { Identity identity = IdentityHolder.ResolveIdentity(this.URI); } }
internal static Identity FindOrCreateIdentity(string objURI, string URL, ObjRef objectRef) { Identity identity = null; bool flag = URL != null; identity = IdentityHolder.ResolveIdentity(flag ? URL : objURI); if (flag && identity != null && identity is ServerIdentity) { throw new RemotingException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_WellKnown_CantDirectlyConnect"), URL)); } if (identity == null) { identity = new Identity(objURI, URL); ReaderWriterLock tableLock = IdentityHolder.TableLock; bool flag2 = !tableLock.IsWriterLockHeld; RuntimeHelpers.PrepareConstrainedRegions(); try { if (flag2) { tableLock.AcquireWriterLock(int.MaxValue); } identity = IdentityHolder.SetIdentity(identity, null, DuplicateIdentityOption.UseExisting); identity.RaceSetObjRef(objectRef); } finally { if (flag2 && tableLock.IsWriterLockHeld) { tableLock.ReleaseWriterLock(); } } } return(identity); }
internal virtual void AssertValid() { if (this.URI == null) { return; } IdentityHolder.ResolveIdentity(this.URI); }
internal virtual void AssertValid() { if (URI != null) { Identity resolvedIdentity = IdentityHolder.ResolveIdentity(URI); BCLDebug.Assert( (resolvedIdentity == null) || (resolvedIdentity == this), "Server ID mismatch with URI"); } }
internal ServerIdentity StartupWellKnownObject(string asmName, string svrTypeName, string URI, WellKnownObjectMode mode, bool fReplace) { lock (s_wkoStartLock) { MarshalByRefObject obj2 = null; ServerIdentity identity = null; Type type = LoadType(svrTypeName, asmName); if (!type.IsMarshalByRef) { throw new RemotingException(Environment.GetResourceString("Remoting_WellKnown_MustBeMBR", new object[] { svrTypeName })); } identity = (ServerIdentity)IdentityHolder.ResolveIdentity(URI); if ((identity != null) && identity.IsRemoteDisconnected()) { IdentityHolder.RemoveIdentity(URI); identity = null; } if (identity == null) { s_fullTrust.Assert(); try { obj2 = (MarshalByRefObject)Activator.CreateInstance(type, true); if (RemotingServices.IsClientProxy(obj2)) { RedirectionProxy proxy = new RedirectionProxy(obj2, type) { ObjectMode = mode }; RemotingServices.MarshalInternal(proxy, URI, type); identity = (ServerIdentity)IdentityHolder.ResolveIdentity(URI); identity.SetSingletonObjectMode(); } else if (type.IsCOMObject && (mode == WellKnownObjectMode.Singleton)) { ComRedirectionProxy proxy2 = new ComRedirectionProxy(obj2, type); RemotingServices.MarshalInternal(proxy2, URI, type); identity = (ServerIdentity)IdentityHolder.ResolveIdentity(URI); identity.SetSingletonObjectMode(); } else { if (RemotingServices.GetObjectUri(obj2) != null) { throw new RemotingException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_WellKnown_CtorCantMarshal"), new object[] { URI })); } RemotingServices.MarshalInternal(obj2, URI, type); identity = (ServerIdentity)IdentityHolder.ResolveIdentity(URI); if (mode == WellKnownObjectMode.SingleCall) { identity.SetSingleCallObjectMode(); } else { identity.SetSingletonObjectMode(); } } } catch { throw; } finally { CodeAccessPermission.RevertAssert(); } } return(identity); } }