-->

EventSourceException: No Free Buffers available fr

2019-02-24 09:58发布

问题:

The full exception text is:

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

I am calling this method approx a million times because of recursion. It does not stop, I just get the exception text in the Output Debug windown in VS2013. But it is super slow.

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;
}

Does anyone know what this exception means and how to fix it. I am assuming that the slow speed is related to this exception.

IsWebservice() and GetMethodName() are pure string methods.

I am running Roslyn in a VS2013 project under .NET 4.5.2, can it be related to this? I just installed this nuget package

PM> Install-Package Microsoft.CodeAnalysis

And then I had to copy over and include the following files in my project.

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)

Any ide how to speed up the code or find the root cause of the exception will be helpfull. //Thanks :-)

回答1:

I run into this problem as well as I was developing a rendering method with VS 2013. I found a solution for stop spamming the console window with the message:

Go to the VS 2013 option menu:

In German this is:

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

In English this is:

TOOLS --> Options… --> Debugging --> General --> (mark) Use Managed Compatibility Mode

This will stop the message.



回答2:

Have faced this exception too! Not sure if related or not my C: drive was full at that time, after freeing up some space, haven't got this exception.