public void AssertRemote() { if (LocalInstance != null) { throw new InvalidOperationException("Object " + LocalInstance.GetType().Name + " is not remote"); } }
public ValueTask <Type> GetObjectTypeAsync(CancellationToken cancellation) { if (!IsRemoteProxy) { return(new ValueTask <Type>(LocalInstance.GetType())); } if (Volatile.Read(ref _isActivated)) { return(new ValueTask <Type>(_objectType)); } var objectTypeTaskCompletionSource = GetObjectTypeTaskCompletionSource(); var task = objectTypeTaskCompletionSource.Task.WithCancellation(cancellation); return(new ValueTask <Type>(task)); }