How to disable Task Parallel Library's ETW EventSource in a Universal App?

前端 未结 1 1759
广开言路
广开言路 2021-01-06 03:30

Task Parallel Library uses Event Tracing for Windows (ETW) for logging. Apparently, there is a bug related to logging, in either TPL or ETW, surfacing under Windows Phone or

相关标签:
1条回答
  • 2021-01-06 03:55

    I ran into a similar issue and found a potential solution.

    You can simply call Dispose() on the EventSource!

    This will not remove the event source, but it will disable it. And the base EventSource that they all inherit from does have the proper checks in place to prevent the rest of the inherited class from being called when it is disabled. So, in theory, it should be safe. But there may be some EventSource implementations where this will not work, so test it thoroughly!

    See here for the EventSource.Dispose(bool disposing) implementation.

    0 讨论(0)
提交回复
热议问题