c# - 事件源异常 : No Free Buffers available from the operating system

标签 c# exception roslyn tpl-dataflow microsoft.build

完整的异常文本是:

EventSourceException: No Free Buffers available from the operating system (e.g. event rate too fast).

由于递归,我调用此方法大约一百万次。它不会停止,我只是在 VS2013 的输出调试窗口中得到异常文本。但它 super 慢。

private static IEnumerable<string> RecursiveFindServices(ISymbol sym, Solution sln)
{
    List<string> list = new List<string>();
    var callers = SymbolFinder.FindCallersAsync(sym, sln).Result;  // this line may cause the EventSourceException  (try not to call Async)
    foreach(var caller in callers)
    {
        string name = GetMethodName(caller);
        if (caller.CallingSymbol.ContainingType.Name.EndsWith("Test"))
            continue;

        if (recursiveList.Contains(name))
            continue;

        recursiveList.Add(name);

        if (IsWebservice(caller))
            list.Add(name);
        else
            list.AddRange(RecursiveFindServices(caller.CallingSymbol, sln));
    }

    return list;
}

有谁知道这个异常是什么意思以及如何解决它。我假设速度慢与此异常有关。

IsWebservice()GetMethodName() 是纯字符串方法。

我在 .NET 4.5.2 下的 VS2013 项目中运行 Roslyn,是否与此有关? 我刚刚安装了这个 nuget 包

PM> Install-Package Microsoft.CodeAnalysis

然后我不得不复制并在我的项目中包含以下文件。

Microsoft.Build.Conversion.Core.dll     (File Version 14.0)
Microsoft.Build.dll                     (File Version 14.0)
Microsoft.Build.Engine.dll              (File Version 14.0)
Microsoft.Build.Framework.dll           (File Version 14.0)
Microsoft.Build.Tasks.Core.dll          (File Version 14.0)
Microsoft.Build.Utilities.Core.dll      (File Version 14.0)
System.Threading.Tasks.Dataflow.dll     (File Version 4.5.24)

任何关于如何加速代码或找到异常根本原因的想法都会有所帮助。 //谢谢:-)

最佳答案

我在使用 VS 2013 开发渲染方法时遇到了这个问题。我找到了一个解决方案来停止向控制台窗口发送垃圾消息:

转到 VS 2013 选项菜单:

在德语中是这样的:

EXTRAS --> Optionen… --> Debugging --> Allgemein --> (mark) Verwalteten Kmpatibilitäsmodus verwenden

英文是:

TOOLS --> Options… --> Debugging --> General --> (mark) 使用托管兼容模式

这将停止消息。

关于c# - 事件源异常 : No Free Buffers available from the operating system,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31581173/

相关文章:

c# - 如何反编译 ASP.NET/C# Web 应用程序

python - 如何消除“sys.excepthook丢失”错误?

java - 我的类(class)出现空指针错误

c++ - 如何有条件地捕获异常?

c# - Roslyn 中的代理缓存行为更改

c# - Expression.Coalesce 的转换参数是做什么用的?

.net - Roslyn C# 编译器如何知道在哪里可以找到 .NET 程序集文件?

c# - 在 C# 中列出 <int>

c# - IsKeyboardFocusable 在 Inspect Object 中为 true 但在我的应用程序中始终为 false

c# - 多页 PrintDocument 中的不同方向(如何)