当前位置: 首页>>代码示例>>C#>>正文


C# Exception.Unwrap方法代码示例

本文整理汇总了C#中System.Exception.Unwrap方法的典型用法代码示例。如果您正苦于以下问题:C# Exception.Unwrap方法的具体用法?C# Exception.Unwrap怎么用?C# Exception.Unwrap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Exception的用法示例。


在下文中一共展示了Exception.Unwrap方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ExceptionViewModel

        public ExceptionViewModel(Exception exception)
        {
            DisplayName = "An unhandled exception occurred";
            CloseCommand = new RelayCommand(TryClose);

            _exception = exception.Unwrap().ToAggregate();
        }
开发者ID:henjuv,项目名称:Mg2,代码行数:7,代码来源:ExceptionViewModel.cs

示例2: IsRequestAborted

        internal static bool IsRequestAborted(Exception exception)
        {
            exception = exception.Unwrap();

            // Support an alternative way to propagate aborted requests
            if (exception is OperationCanceledException)
            {
                return true;
            }

            // There is a race in StreamExtensions where if the endMethod in ReadAsync is called before
            // the Stream is disposed, but executes after, Stream.EndRead will be called on a disposed object.
            // Since we call HttpWebRequest.Abort in several places while potentially reading the stream,
            // and we don't want to lock around HttpWebRequest.Abort and Stream.EndRead, we just swallow the 
            // exception.
            // If the Stream is closed before the call to the endMethod, we expect an OperationCanceledException,
            // so this is a fairly rare race condition.
            if (exception is ObjectDisposedException)
            {
                return true;
            }

            var webException = exception as WebException;
            return (webException != null && webException.Status == WebExceptionStatus.RequestCanceled);
        }
开发者ID:Choulla-Naresh8264,项目名称:SignalR,代码行数:25,代码来源:ExceptionHelper.cs

示例3: IsRequestAborted

        internal static bool IsRequestAborted(Exception exception)
        {
            exception = exception.Unwrap();

            // Support an alternative way to propagate aborted requests
            if (exception is OperationCanceledException)
            {
                return true;
            }

            var webException = exception as WebException;
            return (webException != null && webException.Status == WebExceptionStatus.RequestCanceled);
        }
开发者ID:bfriesen,项目名称:SignalR,代码行数:13,代码来源:ExceptionHelper.cs

示例4: Close

        private void Close(Exception exception)
        {
            if (Interlocked.Exchange(ref _reading, 0) == 1)
            {
                Debug.WriteLine("EventSourceReader: Connection Closed");
                if (Closed != null)
                {
                    if (exception != null)
                    {
                        exception = exception.Unwrap();
                    }

                    Closed(exception);
                }

                // Release the buffer
                _readBuffer = null;
            }
        }
开发者ID:Kazzje,项目名称:SignalR,代码行数:19,代码来源:EventSourceStreamReader.cs

示例5: IsRequestAborted

 internal static bool IsRequestAborted(Exception exception)
 {
     var webException = exception.Unwrap() as WebException;
     return (webException != null && webException.Status == WebExceptionStatus.RequestCanceled);
 }
开发者ID:nairit,项目名称:SignalR,代码行数:5,代码来源:ExceptionHelper.cs

示例6: Close

        private void Close(Exception exception)
        {
            var previousState = Interlocked.Exchange(ref _reading, State.Stopped);

            if (previousState != State.Stopped)
            {
                if (Closed != null)
                {
                    if (exception != null)
                    {
                        exception = exception.Unwrap();
                    }

                    Closed(exception);
                }

                lock (_bufferLock)
                {
                    // Release the buffer
                    _readBuffer = null;
                }
            }
        }
开发者ID:rllibby,项目名称:SignalR,代码行数:23,代码来源:AsyncStreamReader.cs

示例7: Close

        private void Close(Exception exception)
        {
            var previousState = Interlocked.Exchange(ref _reading, State.Stopped);

            if (previousState == State.Processing)
            {
                Debug.WriteLine("EventSourceReader: Connection Closed");
                if (Closed != null)
                {
                    if (exception != null)
                    {
                        exception = exception.Unwrap();
                    }

                    Closed(exception);
                }

                lock (_bufferLock)
                {
                    // Release the buffer
                    _readBuffer = null;
                }
            }

            if (previousState != State.Stopped && Disabled != null)
            {
                Disabled();
            }
        }
开发者ID:rustd,项目名称:SignalR,代码行数:29,代码来源:EventSourceStreamReader.cs


注:本文中的System.Exception.Unwrap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。