public void Test_BadEventSource_MismatchedIds() { #if USE_ETW // TODO: Enable when TraceEvent is available on CoreCLR. GitHub issue #4864. // We expect only one session to be on when running the test but if a ETW session was left // hanging, it will confuse the EventListener tests. EtwListener.EnsureStopped(); #endif // USE_ETW TestUtilities.CheckNoEventSourcesRunning("Start"); var onStartups = new bool[] { false, true }; var listenerGenerators = new Func <Listener>[] { () => new EventListenerListener(), #if USE_ETW // TODO: Enable when TraceEvent is available on CoreCLR. GitHub issue #4864. () => new EtwListener() #endif // USE_ETW }; var settings = new EventSourceSettings[] { EventSourceSettings.Default, EventSourceSettings.EtwSelfDescribingEventFormat }; // For every interesting combination, run the test and see that we get a nice failure message. foreach (bool onStartup in onStartups) { foreach (Func <Listener> listenerGenerator in listenerGenerators) { foreach (EventSourceSettings setting in settings) { Test_Bad_EventSource_Startup(onStartup, listenerGenerator(), setting); } } } TestUtilities.CheckNoEventSourcesRunning("Stop"); }
public void Test_BadEventSource_MismatchedIds() { #if USE_ETW // We expect only one session to be on when running the test but if a ETW session was left // hanging, it will confuse the EventListener tests. if (TestUtilities.IsProcessElevated) { EtwListener.EnsureStopped(); } #endif // USE_ETW TestUtilities.CheckNoEventSourcesRunning("Start"); var onStartups = new bool[] { false, true }; var listenerGenerators = new List <Func <Listener> >(); listenerGenerators.Add(() => new EventListenerListener()); #if USE_ETW if (TestUtilities.IsProcessElevated) { listenerGenerators.Add(() => new EtwListener()); } #endif // USE_ETW var settings = new EventSourceSettings[] { EventSourceSettings.Default, EventSourceSettings.EtwSelfDescribingEventFormat }; // For every interesting combination, run the test and see that we get a nice failure message. foreach (bool onStartup in onStartups) { foreach (Func <Listener> listenerGenerator in listenerGenerators) { foreach (EventSourceSettings setting in settings) { Test_Bad_EventSource_Startup(onStartup, listenerGenerator(), setting); } } } TestUtilities.CheckNoEventSourcesRunning("Stop"); }