/// <summary> /// Issues the subscription failures. /// </summary> /// <param name="gseResponse">The GetStreamingEvents response.</param> private void IssueSubscriptionFailures(GetStreamingEventsResponse gseResponse) { ServiceResponseException exception = new ServiceResponseException(gseResponse); foreach (string id in gseResponse.ErrorSubscriptionIds) { StreamingSubscription subscription = null; lock (this.lockObject) { // Client can do any good or bad things in the below event handler if (this.subscriptions != null && this.subscriptions.ContainsKey(id)) { subscription = this.subscriptions[id]; } } if (subscription != null) { SubscriptionErrorEventArgs eventArgs = new SubscriptionErrorEventArgs( subscription, exception); if (this.OnSubscriptionError != null) { this.OnSubscriptionError(this, eventArgs); } } if (gseResponse.ErrorCode != ServiceError.ErrorMissedNotificationEvents) { // Client can do any good or bad things in the above event handler lock (this.lockObject) { if (this.subscriptions != null && this.subscriptions.ContainsKey(id)) { // We are no longer servicing the subscription. this.subscriptions.Remove(id); } } } } }