ETWTraceEventSource source = new ETWTraceEventSource(fileName);
+ Dictionary<string, int> providers = new Dictionary<string, int>();
+ int eventCount = 0;
var sawManifestData = false;
source.Dynamic.All += (eventData) =>
{
+ eventCount++;
+ if (!providers.ContainsKey(eventData.ProviderName))
+ {
+ providers[eventData.ProviderName] = 0;
+ }
+ providers[eventData.ProviderName]++;
+
if (eventData.ProviderName.Equals("SimpleEventSource") && eventData.EventName.Equals("ManifestData"))
{
sawManifestData = true;
};
source.Process();
//File.Delete(fileName);
+
+ if (!sawManifestData)
+ {
+ Console.WriteLine("Did not see ManifestData event from SimpleEventSource, test will fail. Additional info:");
+ Console.WriteLine($" file name {fileName}");
+ Console.WriteLine($" total event count {eventCount}");
+ Console.WriteLine($" total providers {providers.Count}");
+ foreach (var provider in providers.Keys)
+ {
+ Console.WriteLine($" Provider name {provider} event count {providers[provider]}");
+ }
+ }
return sawManifestData;
}
}