message: Differentiate when container is closed on error - while loading or after load
diff: @@ -466,10 +466,12 @@ export class Container extends EventEmitterWithErrorHandling<IContainerEvents> i
  {
  eventName: "ContainerClose",
  sequenceNumber: error.sequenceNumber ?? this._deltaManager.lastSequenceNumber,
  + loading: !this.loaded,
  },
  error,
  );
  } else {
  + assert(this.loaded);
  this.logger.sendTelemetryEvent({ eventName: "ContainerClose" });
  }
  @@ -492,10 +494,13 @@ export class Container extends EventEmitterWithErrorHandling<IContainerEvents> i
  }
  public async attach(request: IRequest): Promise<void> {
  + assert(this.loaded);
  +
  // If container is already attached or attach is in progress, return.
  if (this._attachState === AttachState.Attached || this.attachInProgress) {
  return;
  }
  +
  this.attachInProgress = true;
  try {
  assert.strictEqual(this.deltaManager.inbound.length, 0, "Inbound queue should be empty when attaching");
  @@ -660,8 +665,6 @@ export class Container extends EventEmitterWithErrorHandling<IContainerEvents> i
  }
  protected resumeInternal(args: IConnectionArgs = {}) {
  - assert(this.loaded);
  -
  if (this.closed) {
  throw new Error("Attempting to setAutoReconnect() a closed DeltaManager");
  }
  @@ -983,9 +986,6 @@ export class Container extends EventEmitterWithErrorHandling<IContainerEvents> i
  await this.loadContext(attributes, maybeSnapshotTree);
  - // Internal context is fully loaded at this point
  - this.loaded = true;
  -
  // Propagate current connection state through the system.
  this.propagateConnectionState();
  @@ -993,6 +993,9 @@ export class Container extends EventEmitterWithErrorHandling<IContainerEvents> i
  this.resume();
  }
  + // Internal context is fully loaded at this point
  + this.loaded = true;
  +
  return {
  existing: this._existing,
  sequenceNumber: attributes.sequenceNumber,
  @@ -1033,9 +1036,9 @@ export class Container extends EventEmitterWithErrorHandling<IContainerEvents> i
  // The load context - given we seeded the quorum - will be great
  await this.createDetachedContext(attributes);
  - this.loaded = true;
  -
  this.propagateConnectionState();
  +
  + this.loaded = true;
  }
  private async getDocumentStorageService(): Promise<IDocumentStorageService> {
  @@ -1397,7 +1400,6 @@ export class Container extends EventEmitterWithErrorHandling<IContainerEvents> i
  }
  private propagateConnectionState() {
  - assert(this.loaded);
  const logOpsOnReconnect: boolean =
  this._connectionState === ConnectionState.Connected &&
  !this.firstConnection &&
  