Repository: Azure/azure-sdk-for-net
File: sdk/eventhub/Azure.Messaging.EventHubs/src/Primitives/EventProcessor.cs (C#)

Code before:
        }

        /// <summary>
        ///   Queries for the identifiers of the Event Hub partitions.
        /// </summary>
        ///
        /// <param name="connection">The active connection to the Event Hubs service.</param>
        /// <param name="cancellationToken">A <see cref="CancellationToken"/> instance to signal the request to cancel the query.</param>
        ///
        /// <returns>The set of identifiers for the Event Hub partitions.</returns>
        ///
        protected virtual Task<string[]> ListPartitionIdsAsync(EventHubConnection connection,
                                                                     CancellationToken cancellationToken)
        {
            // If EventHubProperties has been initialized, return the cached partition IDs
            // synchronously to avoid async state machine allocation on the common path.

            if (EventHubProperties != null)
            {
                return Task.FromResult(EventHubProperties.PartitionIds);
            }

            // If EventHubProperties hasn't been initialized (processor not yet started),
            // fall back to querying the service directly to preserve pre-5.12.0 behavior.

            return ListPartitionIdsFromServiceAsync(connection, cancellationToken);
        }

        /// <summary>
        ///   Queries the Event Hub service for the set of partition identifiers.
        /// </summary>
        ///
        /// <param name="connection">The connection to the Event Hubs namespace to be used for service communication.</param>
        /// <param name="cancellationToken">A <see cref="CancellationToken"/> instance to signal the request to cancel the operation.</param>
        ///
        /// <returns>The set of identifiers for the Event Hub partitions.</returns>
        ///
        private async Task<string[]> ListPartitionIdsFromServiceAsync(EventHubConnection connection,
                                                                      CancellationToken cancellationToken)
        {
            var properties = await connection.GetPropertiesAsync(RetryPolicy, cancellationToken).ConfigureAwait(false);
            return properties.PartitionIds;
        }

        /// <summary>
        ///   Allows reporting that a partition was stolen by another event consumer causing ownership
        ///   to be considered relinquished until the next load balancing cycle reconciles it.
        /// </summary>
        ///
        /// <param name="partitionId">The identifier of the partition that was stolen.</param>
        ///

Review comment (suggestion):
```suggestion
            return await ListPartitionIdsFromServiceAsync(connection, cancellationToken).ConfigureAwait(false);
```

nit:  By convention, we don't elide the await in scenarios such as this in order to be consistent with fully-formed stack traces.

Code after:
        }

        /// <summary>
        ///   Queries for the identifiers of the Event Hub partitions.
        /// </summary>
        ///
        /// <param name="connection">The active connection to the Event Hubs service.</param>
        /// <param name="cancellationToken">A <see cref="CancellationToken"/> instance to signal the request to cancel the query.</param>
        ///
        /// <returns>The set of identifiers for the Event Hub partitions.</returns>
        ///
        protected virtual async Task<string[]> ListPartitionIdsAsync(EventHubConnection connection,
                                                                           CancellationToken cancellationToken)
        {
            if (EventHubProperties != null)
            {
                return EventHubProperties.PartitionIds;
            }

            // If EventHubProperties hasn't been initialized (processor not yet started),
            // fall back to querying the service directly to preserve pre-5.12.0 behavior.

            return await connection.GetPartitionIdsAsync(RetryPolicy, cancellationToken).ConfigureAwait(false);
        }

        /// <summary>
        ///   Allows reporting that a partition was stolen by another event consumer causing ownership
        ///   to be considered relinquished until the next load balancing cycle reconciles it.
        /// </summary>
        ///
        /// <param name="partitionId">The identifier of the partition that was stolen.</param>
        ///
        private void ReportPartitionStolen(string partitionId) => LoadBalancer.ReportPartitionStolen(partitionId);

        /// <summary>
        ///   Signals the <see cref="EventProcessor{TPartition}" /> to begin processing events. Should this method be called while the processor is running, no action is taken.
        /// </summary>
        ///
        /// <param name="async">When <c>true</c>, the method will be executed asynchronously; otherwise, it will execute synchronously.</param>
        /// <param name="cancellationToken">A <see cref="CancellationToken"/> instance to signal the request to cancel the start operation.  This won't affect the <see cref="EventProcessor{TPartition}" /> once it starts running.</param>
        ///
        private async Task StartProcessingInternalAsync(bool async,
                                                        CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested<TaskCanceledException>();
            Logger.EventProcessorStart(Identifier, EventHubName, ConsumerGroup);

            var capturedValidationException = default(Exception);

            try
            {