"System.IO.IOException:操作成功完成".例外 [英] "System.IO.IOException: The operation completed successfully" exception

查看:49
本文介绍了"System.IO.IOException:操作成功完成".例外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到这个异常

System.IO.IOException:操作成功完成.

System.IO.IOException: The operation completed successfully.

在以下代码段中

.该代码在Windows服务中运行.

in the following chunk of code. This code runs in a windows service.

foreach (var error in _currentPowerShell.Streams.Error)
{
    if (!string.IsNullOrEmpty(error.FullyQualifiedErrorId))
    {
        if (!(error.CategoryInfo.Activity == "Get-Alias"))
            throw error.Exception;
    }
}

因为我没有执行任何IO操作,所以这根本没有任何意义!

It doesn't make sense at all since I'm not doing any IO operation!

推荐答案

我认为在使用重叠"流时,我已经见过这一点.这是一个可怕的错误消息

I think I've seen that before, when using 'overlapped' streams. It's a terrible error message

这是一个重叠的I/O(IOCP)完成状态.抛出该异常记录为发生I/O错误".它的误导性是消息操作已成功完成".

It's an overlapped I/O (IOCP) completion status. The thrown exception is documented as "An I/O error has occurred." Its misleading that it is has the message "The operation completed successfully".

当尝试访问受区域限制的文件(例如从IE的Internet区域下载)时,也会发生这种情况

This also might happen when trying to access files that are zone restricted (like when downloaded from an internet zone from IE)

这篇关于"System.IO.IOException:操作成功完成".例外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆