When I try to parse several ETL files in parallel via
using (ITraceProcessor processor = TraceProcessor.Create(myEtlFile, new TraceProcessorSettings
{
AllowLostEvents = true,
}))
I get this exception
System.Runtime.InteropServices.InvalidComObjectException: COM object that has been separated from its underlying RCW cannot be used. The COM object was released while it was still in use on another thread.
Stack Trace:
InterfaceMarshaler.ConvertToManaged(IntPtr pUnk, IntPtr itfMT, IntPtr classMT, Int32 flags)
AddInManagerAdapter.Create(String toolkitPath)
ToolkitTraceProcessingEngine.Create(String path, ITraceProcessorSettings settings, ITraceProcessorSettings & effectiveSettings)
TraceProcessor.Create(String path, ITraceProcessorSettings settings)
Is this a bug or a "known" limitation?
This is a known limitation. Given how the underlying native code interaction works, only one trace processor can be created at a time, unfortunately.
In general, TraceProcessor only supports single-threaded access, even for static methods. Some consumers have found places where multi-threaded code can work, but it's not tested/guaranteed - we generally haven't added locks or done anything to enable safe concurrent access.