message: Remove dispose event listener after newAckBasedPromise completes
diff: @@ -300,15 +300,21 @@ export abstract class SharedObject<TEvent extends ISharedObjectEvents = ISharedO
  protected async newAckBasedPromise<T>(
  executor: (resolve: (value?: T | PromiseLike<T> | undefined) => void, reject: (reason?: any) => void) => void,
  ): Promise<T> {
  - return new Promise((resolve, reject) => {
  + let rejectBecauseDispose: () => void;
  + return new Promise<T>((resolve, reject) => {
  + rejectBecauseDispose =
  + () => reject(new Error("ComponentRuntime disposed while this ack-based Promise was pending"));
  + this.runtime.on("dispose", rejectBecauseDispose);
  +
  + // Even in this case don't return, so the caller's executor can run
  if (this.runtime.disposed) {
  reject("Preparing to wait for an op to be acked but ComponentRuntime has been disposed");
  }
  - this.runtime.once("dispose",
  - () => reject(new Error("ComponentRuntime disposed while this ack-based Promise was pending")));
  -
  executor(resolve, reject);
  + }).finally(() => {
  + // Note: rejectBecauseDispose will never be undefined here
  + this.runtime.off("dispose", rejectBecauseDispose);
  });
  }
  