Guard against EventListener dispose race
The underlying issue here is EventListener.DisposeOnShutdown has a race condition if a new EventSource is added during an AppDomain or Process exit. When this occurs there is an unhandled exception during shutdown due to a modified collection during enumeration that causes xunit to falsely fail the run. The type CDSCollectionETWBCLProvider triggers this bug in our tests. It is an EventSource for concurrent collections that is loaded on many concurrent collection operations. These operations are not triggered directly in some of our tests and hence lead to the race. This test guards against them force loading, albeit indirectly, the EventSource instance of CDSCollectionETWBCLProvider. Hence uses during shutdown are just re-using this instance and don't trigger the race. closes #8936
Showing
想要评论请 注册 或 登录