I created an EventSource (WebApiEventSource) in my ASP.NET WebApi application (to is as ITraceWriter-implementation):
[EventSource(Name = "WebApi")]
public class WebApiEventSource : EventSource
{
public static readonly WebApiEventSource Log = new WebApiEventSource();
[Event(1)]
public void Event(string url, string message)
{
WriteEvent(1, url, message);
}
}
I checked that EventSource's methods are called during runtime without errors.
Then I run PerfView and checked in its log that it can see my provider (EventSource):
Parsing Spec *WebApi Enabling Provider:*WebApi Level:Critical Keywords:0x0 Options:None Values: Guid:fc7bbb67-1b01-557b-5e0e-c1c4e40b6a24
Then I run 'collect' with filter "*WebApi", execute some action in my app and stop it.
But there're no any events from my provider in etl file! Section "Events" doesn't even contain the name of my provider.
What did I miss?
UPDATED: I found the reason, see my answer below.