private CancelRequestedQuery Match(CancelRequestedRecord cancelRecord)
        {
            CancelRequestedQuery query = null;

            if (this.cancelRequestedSubscriptions != null)
            {
                for (int i = 0; i < this.cancelRequestedSubscriptions.Count; i++)
                {
                    string strB = (cancelRecord.Activity == null) ? null : cancelRecord.Activity.Name;
                    if (string.CompareOrdinal(this.cancelRequestedSubscriptions[i].ActivityName, strB) == 0)
                    {
                        if (!CheckSubscription(this.cancelRequestedSubscriptions[i].ChildActivityName, cancelRecord.Child.Name))
                        {
                            continue;
                        }
                        query = this.cancelRequestedSubscriptions[i];
                        break;
                    }
                    if ((string.CompareOrdinal(this.cancelRequestedSubscriptions[i].ActivityName, "*") == 0) && CheckSubscription(this.cancelRequestedSubscriptions[i].ChildActivityName, cancelRecord.Child.Name))
                    {
                        query = this.cancelRequestedSubscriptions[i];
                        break;
                    }
                }
            }
            if (((query == null) || (this.associatedProfile.ImplementationVisibility != ImplementationVisibility.RootScope)) || (this.ShouldTrackActivity(cancelRecord.Activity, query.ActivityName) && this.ShouldTrackActivity(cancelRecord.Child, query.ChildActivityName)))
            {
                return(query);
            }
            return(null);
        }
 private void TrackCancelRequestedRecord(CancelRequestedRecord cancelRecord)
 {
     if (EtwTrackingParticipantTrackRecords.CancelRequestedRecordIsEnabled(this.diagnosticTrace) && !EtwTrackingParticipantTrackRecords.CancelRequestedRecord(this.diagnosticTrace, cancelRecord.InstanceId, cancelRecord.RecordNumber, cancelRecord.EventTime.ToFileTime(), (cancelRecord.Activity == null) ? string.Empty : cancelRecord.Activity.Name, (cancelRecord.Activity == null) ? string.Empty : cancelRecord.Activity.Id, (cancelRecord.Activity == null) ? string.Empty : cancelRecord.Activity.InstanceId, (cancelRecord.Activity == null) ? string.Empty : cancelRecord.Activity.TypeName, cancelRecord.Child.Name, cancelRecord.Child.Id, cancelRecord.Child.InstanceId, cancelRecord.Child.TypeName, cancelRecord.HasAnnotations ? PrepareAnnotations(cancelRecord.Annotations) : "<items />", (this.TrackingProfile == null) ? string.Empty : this.TrackingProfile.Name, this.ApplicationReference))
     {
         if (EtwTrackingParticipantTrackRecords.CancelRequestedRecord(this.diagnosticTrace, cancelRecord.InstanceId, cancelRecord.RecordNumber, cancelRecord.EventTime.ToFileTime(), (cancelRecord.Activity == null) ? string.Empty : cancelRecord.Activity.Name, (cancelRecord.Activity == null) ? string.Empty : cancelRecord.Activity.Id, (cancelRecord.Activity == null) ? string.Empty : cancelRecord.Activity.InstanceId, (cancelRecord.Activity == null) ? string.Empty : cancelRecord.Activity.TypeName, cancelRecord.Child.Name, cancelRecord.Child.Id, cancelRecord.Child.InstanceId, cancelRecord.Child.TypeName, "<items>...</items>", (this.TrackingProfile == null) ? string.Empty : this.TrackingProfile.Name, this.ApplicationReference))
         {
             this.TraceTrackingRecordTruncated(cancelRecord.RecordNumber);
         }
         else
         {
             this.TraceTrackingRecordDropped(cancelRecord.RecordNumber);
         }
     }
 }
Example #3
0
        private CancelRequestedQuery Match(CancelRequestedRecord cancelRecord)
        {
            CancelRequestedQuery query = null;

            if (this.cancelRequestedSubscriptions != null)
            {
                for (var i = 0; i < this.cancelRequestedSubscriptions.Count; i++)
                {
                    //check specific and then generic
                    var activityName = cancelRecord.Activity == null ? null : cancelRecord.Activity.Name;
                    if (string.CompareOrdinal(this.cancelRequestedSubscriptions[i].ActivityName, activityName) == 0)
                    {
                        if (CheckSubscription(this.cancelRequestedSubscriptions[i].ChildActivityName, cancelRecord.Child.Name))
                        {
                            query = this.cancelRequestedSubscriptions[i];
                            break;
                        }
                    }
                    else if (string.CompareOrdinal(this.cancelRequestedSubscriptions[i].ActivityName, "*") == 0)
                    {
                        if (CheckSubscription(this.cancelRequestedSubscriptions[i].ChildActivityName, cancelRecord.Child.Name))
                        {
                            query = this.cancelRequestedSubscriptions[i];
                            break;
                        }
                    }
                }
            }

            if ((query != null) && (this.associatedProfile.ImplementationVisibility == ImplementationVisibility.RootScope))
            {
                if ((!ShouldTrackActivity(cancelRecord.Activity, query.ActivityName)) ||
                    (!ShouldTrackActivity(cancelRecord.Child, query.ChildActivityName)))
                {
                    return(null);
                }
            }

            return(query);
        }
 private void TrackCancelRequestedRecord(CancelRequestedRecord cancelRecord)
 {
     if (EtwTrackingParticipantTrackRecords.CancelRequestedRecordIsEnabled(this.diagnosticTrace) && !EtwTrackingParticipantTrackRecords.CancelRequestedRecord(this.diagnosticTrace, cancelRecord.InstanceId, cancelRecord.RecordNumber, cancelRecord.EventTime.ToFileTime(), (cancelRecord.Activity == null) ? string.Empty : cancelRecord.Activity.Name, (cancelRecord.Activity == null) ? string.Empty : cancelRecord.Activity.Id, (cancelRecord.Activity == null) ? string.Empty : cancelRecord.Activity.InstanceId, (cancelRecord.Activity == null) ? string.Empty : cancelRecord.Activity.TypeName, cancelRecord.Child.Name, cancelRecord.Child.Id, cancelRecord.Child.InstanceId, cancelRecord.Child.TypeName, cancelRecord.HasAnnotations ? PrepareAnnotations(cancelRecord.Annotations) : "<items />", (this.TrackingProfile == null) ? string.Empty : this.TrackingProfile.Name, this.ApplicationReference))
     {
         if (EtwTrackingParticipantTrackRecords.CancelRequestedRecord(this.diagnosticTrace, cancelRecord.InstanceId, cancelRecord.RecordNumber, cancelRecord.EventTime.ToFileTime(), (cancelRecord.Activity == null) ? string.Empty : cancelRecord.Activity.Name, (cancelRecord.Activity == null) ? string.Empty : cancelRecord.Activity.Id, (cancelRecord.Activity == null) ? string.Empty : cancelRecord.Activity.InstanceId, (cancelRecord.Activity == null) ? string.Empty : cancelRecord.Activity.TypeName, cancelRecord.Child.Name, cancelRecord.Child.Id, cancelRecord.Child.InstanceId, cancelRecord.Child.TypeName, "<items>...</items>", (this.TrackingProfile == null) ? string.Empty : this.TrackingProfile.Name, this.ApplicationReference))
         {
             this.TraceTrackingRecordTruncated(cancelRecord.RecordNumber);
         }
         else
         {
             this.TraceTrackingRecordDropped(cancelRecord.RecordNumber);
         }
     }
 }
 private CancelRequestedQuery Match(CancelRequestedRecord cancelRecord)
 {
     CancelRequestedQuery query = null;
     if (this.cancelRequestedSubscriptions != null)
     {
         for (int i = 0; i < this.cancelRequestedSubscriptions.Count; i++)
         {
             string strB = (cancelRecord.Activity == null) ? null : cancelRecord.Activity.Name;
             if (string.CompareOrdinal(this.cancelRequestedSubscriptions[i].ActivityName, strB) == 0)
             {
                 if (!CheckSubscription(this.cancelRequestedSubscriptions[i].ChildActivityName, cancelRecord.Child.Name))
                 {
                     continue;
                 }
                 query = this.cancelRequestedSubscriptions[i];
                 break;
             }
             if ((string.CompareOrdinal(this.cancelRequestedSubscriptions[i].ActivityName, "*") == 0) && CheckSubscription(this.cancelRequestedSubscriptions[i].ChildActivityName, cancelRecord.Child.Name))
             {
                 query = this.cancelRequestedSubscriptions[i];
                 break;
             }
         }
     }
     if (((query == null) || (this.associatedProfile.ImplementationVisibility != ImplementationVisibility.RootScope)) || (this.ShouldTrackActivity(cancelRecord.Activity, query.ActivityName) && this.ShouldTrackActivity(cancelRecord.Child, query.ChildActivityName)))
     {
         return query;
     }
     return null;
 }
 CancelRequestedRecord(CancelRequestedRecord record)
     : base(record)
 {
     this.Activity = record.Activity;
     this.Child    = record.Child;
 }
 CancelRequestedRecord(CancelRequestedRecord record)
     : base(record)
 {
     this.Activity = record.Activity;
     this.Child = record.Child;            
 }
        CancelRequestedQuery Match(CancelRequestedRecord cancelRecord)
        {
            CancelRequestedQuery query = null;

            if (this.cancelRequestedSubscriptions != null)
            {
                for (int i = 0; i < this.cancelRequestedSubscriptions.Count; i++)
                {
                    //check specific and then generic
                    string activityName = cancelRecord.Activity == null ? null : cancelRecord.Activity.Name;
                    if (string.CompareOrdinal(this.cancelRequestedSubscriptions[i].ActivityName, activityName) == 0)
                    {
                        if (CheckSubscription(this.cancelRequestedSubscriptions[i].ChildActivityName, cancelRecord.Child.Name))
                        {
                            query = this.cancelRequestedSubscriptions[i];
                            break;
                        }
                    }
                    else if (string.CompareOrdinal(this.cancelRequestedSubscriptions[i].ActivityName, "*") == 0)
                    {
                        if (CheckSubscription(this.cancelRequestedSubscriptions[i].ChildActivityName, cancelRecord.Child.Name))
                        {
                            query = this.cancelRequestedSubscriptions[i];
                            break;
                        }
                    }
                }
            }

            if ((query != null) && (this.associatedProfile.ImplementationVisibility == ImplementationVisibility.RootScope))
            {
                if ((!ShouldTrackActivity(cancelRecord.Activity, query.ActivityName)) ||
                    (!ShouldTrackActivity(cancelRecord.Child, query.ChildActivityName)))
                {
                    return null;
                }
            }

            return query;
        }
 protected virtual void OnCancelRequested(CancelRequestedRecord record, TimeSpan timeout) { }
 /// <summary>
 /// When implemented in a derived class, used to synchronously process the tracking record.
 /// </summary>
 /// <param name="record">
 /// The generated tracking record. 
 /// </param>
 /// <param name="timeout">
 /// The time period after which the provider aborts the attempt. 
 /// </param>
 protected virtual void Track(CancelRequestedRecord record, TimeSpan timeout)
 {
     // Do nothing
 }