Inheritance: System.Exception
        private void CompleteFail(Exception ex)
        {
            var previousState = Interlocked.Exchange(ref _state, InitializationState.Failed);

            Dispatch(() =>
            {
                OnFailure();

                // if the transport failed during start request we want to fail with StartException
                // so that AutoTransport does not try other transports
                if (previousState == InitializationState.AfterConnect && !(ex is StartException))
                {
                    ex = new StartException(Resources.Error_StartFailed, ex);
                }

                _initializationTask.TrySetUnwrappedException(ex);
            });

            if (_tokenCleanup != null)
            {
                _tokenCleanup.Dispose();
            }
        }
        private void CompleteFail(Exception ex)
        {
            var previousState = Interlocked.Exchange(ref _state, InitializationState.Failed);

            Dispatch(() =>
            {
                OnFailure();

                // if the transport failed during start request we want to fail with StartException
                // so that AutoTransport does not try other transports
                if (previousState == InitializationState.AfterConnect && !(ex is StartException))
                {
                    ex = new StartException(Resources.Error_StartFailed, ex);
                }
 
                _initializationTask.TrySetUnwrappedException(ex);
            });

            if (_tokenCleanup != null)
            {
                _tokenCleanup.Dispose();
            }
        }