private void ProbeEvent(EventSchema eventSchema, EventSource source) { using (var listener = new ProbeEventListener(eventSchema, this)) { try { listener.EnableEvents(source, eventSchema.Level, eventSchema.Keywords); MethodInfo method; if (this.TryInvokeMethod(eventSchema, source, listener, out method)) { if (listener.EventData == null) { throw new EventSourceAnalyzerException(string.Format(CultureInfo.CurrentCulture, Resources.EventSourceAnalyzerMissingWriteEventCallError, method.Name)); } if (listener.Error != null) { throw listener.Error; } } } finally { listener.DisableEvents(source); } } }
private void CheckEnableEvents(EventSource eventSource) { using (var listener = new ProbeEventListener()) { //// EnableEvents will do a general validation pass listener.EnableEvents(eventSource, EventLevel.LogAlways); //// Restore source listener.DisableEvents(eventSource); } }
private void ProbeEvent(EventSchema eventSchema, EventSource source) { using (var listener = new ProbeEventListener(eventSchema, this)) { try { listener.EnableEvents(source, eventSchema.Level, eventSchema.Keywords); MethodInfo method; if (this.TryInvokeMethod(eventSchema, source, listener, out method)) { if (listener.EventData == null) { throw new EventSourceAnalyzerException(string.Format(CultureInfo.CurrentCulture, Properties.Resources.EventSourceAnalyzerMissingWriteEventCallError, method.Name)); } if (listener.Error != null) { throw listener.Error; } } } finally { listener.DisableEvents(source); } } }