UaClient/ServiceModel/Ua/Channels/CommunicationObject.cs
/// <summary>
/// Causes a communication object to transition from the created state into the opened 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 from the created state into the opened state.
Causes a communication object to transition from the created state into the opened state .
public async Task OpenAsync(CancellationToken token = default(CancellationToken))
        {
            await this.semaphore.WaitAsync(token).ConfigureAwait(false);
            try
            {
                this.ThrowIfDisposedOrImmutable();
                this.State = CommunicationState.Opening;
            }
            finally
            {
                this.semaphore.Release();
            }
            bool flag2 = true;
            try
            {
                await this.OnOpeningAsync(token).ConfigureAwait(false);
                if (!this.onOpeningCalled)
                {
                    throw new InvalidOperationException($"Channel did not call base.OnOpeningAsync");
                }
                await this.OnOpenAsync(token).ConfigureAwait(false);
                await this.OnOpenedAsync(token).ConfigureAwait(false);
                if (!this.onOpenedCalled)
                {
                    throw new InvalidOperationException($"Channel did not call base.OnOpenedAsync");
                }
                flag2 = false;
            }
            finally
            {
                if (flag2)
                {
                    await this.FaultAsync().ConfigureAwait(false);
                }
            }
        }
public async Task OpenAsync ( CancellationToken token = default ( CancellationToken ) ) { await this . semaphore . WaitAsync ( token ) . ConfigureAwait ( false ) ; try { this . ThrowIfDisposedOrImmutable ( ) ; this . State = CommunicationState . Opening ; } finally { this . semaphore . Release ( ) ; } bool flag2 = true ; try { await this . OnOpeningAsync ( token ) . ConfigureAwait ( false ) ; if ( ! this . onOpeningCalled ) { throw new InvalidOperationException ( $" Channel did not call base.OnOpeningAsync " ) ; } await this . OnOpenAsync ( token ) . ConfigureAwait ( false ) ; await this . OnOpenedAsync ( token ) . ConfigureAwait ( false ) ; if ( ! this . onOpenedCalled ) { throw new InvalidOperationException ( $" Channel did not call base.OnOpenedAsync " ) ; } flag2 = false ; } finally { if ( flag2 ) { await this . FaultAsync ( ) . ConfigureAwait ( false ) ; } } }
Causes a communication object to transition from the created state into the opened state.
Causes a communication object to transition from the created state into the opened 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 .