public void AssertRemote()
 {
     if (LocalInstance != null)
     {
         throw new InvalidOperationException("Object " + LocalInstance.GetType().Name + " is not remote");
     }
 }
Ejemplo n.º 2
0
        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));
        }