UaClient/ServiceModel/Ua/Channels/CommunicationObject.cs
/// <summary>
/// Causes a communication object to transition immediately from its current state into the closing state.
/// </summary>
/// <param name="token">The <see cref="T:System.Threading.CancellationToken" /> that notifies when the task should be canceled.</param>
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
Causes a communication object to transition immediately from its current state into the closing state.
Causes a communication object to transition immediately from its current state into the closing state .
public async Task AbortAsync(CancellationToken token = default(CancellationToken))
        {
            await this.semaphore.WaitAsync(token).ConfigureAwait(false);
            try
            {
                if (this.aborted || this.State == CommunicationState.Closed)
                {
                    return;
                }
                this.aborted = true;
                this.State = CommunicationState.Closing;
            }
            finally
            {
                this.semaphore.Release();
            }
            bool flag2 = true;
            try
            {
                await this.OnClosingAsync(token).ConfigureAwait(false);
                if (!this.onClosingCalled)
                {
                    throw new InvalidOperationException($"Channel did not call base.OnClosingAsync");
                }
                await this.OnAbortAsync(token).ConfigureAwait(false);
                await this.OnClosedAsync(token).ConfigureAwait(false);
                if (!this.onClosedCalled)
                {
                    throw new InvalidOperationException($"Channel did not call base.OnClosedAsync");
                }
                flag2 = false;
            }
            finally
            {
                if (flag2)
                {
                }
            }
        }
public async Task AbortAsync ( CancellationToken token = default ( CancellationToken ) ) { await this . semaphore . WaitAsync ( token ) . ConfigureAwait ( false ) ; try { if ( this . aborted || this . State == CommunicationState . Closed ) { return ; } this . aborted = true ; this . State = CommunicationState . Closing ; } finally { this . semaphore . Release ( ) ; } bool flag2 = true ; try { await this . OnClosingAsync ( token ) . ConfigureAwait ( false ) ; if ( ! this . onClosingCalled ) { throw new InvalidOperationException ( $" Channel did not call base.OnClosingAsync " ) ; } await this . OnAbortAsync ( token ) . ConfigureAwait ( false ) ; await this . OnClosedAsync ( token ) . ConfigureAwait ( false ) ; if ( ! this . onClosedCalled ) { throw new InvalidOperationException ( $" Channel did not call base.OnClosedAsync " ) ; } flag2 = false ; } finally { if ( flag2 ) { } } }
Causes a communication object to transition immediately from its current state into the closing state.
Causes a communication object to transition immediately from its current state into the closing state .
A  representing the asynchronous operation.
A representing the asynchronous operation .
token
CancellationToken
The  that notifies when the task should be canceled.
The that notifies when the task should be canceled .