private void PostFaultEvent(string eventName, ITelemetryEventMatch eventMatch, Exception exception) { string description; try { description = JsonConvert.SerializeObject((object)eventMatch, (Formatting)0); } catch (Exception ex) { description = ex.Message; } provider.PostFaultEvent(eventName, description, exception); }
/// <inheritdoc /> public int Subscribe(ITelemetryEventMatch eventMatch, Action <TelemetryEvent> handler, bool singleNotification = true) { CodeContract.RequiresArgumentNotNull <ITelemetryEventMatch>(eventMatch, "eventMatch"); CodeContract.RequiresArgumentNotNull <Action <TelemetryEvent> >(handler, "handler"); Subscription subscription = default(Subscription); subscription.Handler = handler; subscription.Match = eventMatch; subscription.SingleNotification = singleNotification; Subscription value = subscription; lock (lockObject) { lastSubscriptionId++; AttachChannel(); Subscriptions[lastSubscriptionId] = value; return(lastSubscriptionId); } }