void ObservePromise(Promise <T> promise) { promise.Done(deferred.Resolve); promise.Fail(t => { nonResolvedCount++; if (nonResolvedCount == size) { deferred.Dispose(); } }); promise.Disposed(() => { nonResolvedCount++; if (nonResolvedCount == size) { deferred.Dispose(); } }); }