예제 #1
0
 private async Task Check(BehaviorOnStale staleBehavior, CancellationToken token = default(CancellationToken))
 {
     //IL_000a: Unknown result type (might be due to invalid IL or missing references)
     //IL_000b: Unknown result type (might be due to invalid IL or missing references)
     try
     {
         await LoadManifest(staleBehavior, token).ConfigureAwait(false);
     }
     catch (TelemetryManifestParserException ex)
     {
         if (!token.IsCancellationRequested)
         {
             List <string> list = new List <string>();
             for (Exception innerException = ex.InnerException; innerException != null; innerException = innerException.InnerException)
             {
                 list.Add(innerException.Message);
             }
             OnUpdateTelemetryManifestStatusEvent(new TelemetryManifestEventArgs(null));
             InstrumentLoad(null, 0L, ex.Message, (list.Count > 0) ? StringExtensions.Join((IEnumerable <string>)list, ";") : null, 0.0);
         }
     }
     catch (Exception exceptionObject)
     {
         FaultEvent faultEvent = new FaultEvent("VS/Telemetry/InternalFault", $"LoadManifest ManifestManager.Check", exceptionObject)
         {
             PostThisEventToTelemetry = false
         };
         faultEvent.AddProcessDump(Process.GetCurrentProcess().Id);
         mainSession.PostEvent(faultEvent);
     }
 }
예제 #2
0
        /// <summary>
        /// Post a fault event with an exception object and a callback. The callback can be used to calculate expensive data to be sent
        /// to the Watson back end, such as JScript callstacks, etc
        /// It becomes more useful when correlated with <see cref="T:Coding4Fun.VisualStudio.Telemetry.UserTaskEvent" /> or <see cref="T:Coding4Fun.VisualStudio.Telemetry.OperationEvent" /> which may have led to the fault occurence.
        /// </summary>
        /// <param name="telemetrySession"></param>
        /// <param name="eventName">
        /// An event name following data model schema.
        /// It requires that event name is a unique, not null or empty string.
        /// It consists of 3 parts and must follows pattern [product]/[featureName]/[entityName]. FeatureName could be a one-level feature or feature hierarchy delimited by "/".
        /// For examples,
        /// vs/platform/opensolution;
        /// vs/platform/editor/lightbulb/fixerror;
        /// </param>
        /// <param name="description"></param>
        /// <param name="faultSeverity">The severity of the fault, used to identify actionable or important faults in divisional tools and reporting.</param>
        /// <param name="exceptionObject">can be null</param>
        /// <param name="gatherEventDetails">Allows the user to provide code to execute synchronously to gather computationally expensive info about the event</param>
        /// <param name="correlatedWith">
        /// Specify which events to correlate by using property <see cref="P:Coding4Fun.VisualStudio.Telemetry.TelemetryEvent.Correlation" />
        /// Good candidates to correlate with <see cref="T:Coding4Fun.VisualStudio.Telemetry.FaultEvent" /> are,
        /// <see cref="T:Coding4Fun.VisualStudio.Telemetry.UserTaskEvent" />
        /// <see cref="T:Coding4Fun.VisualStudio.Telemetry.OperationEvent" />
        /// </param>
        /// <returns>The fault correlation.</returns>
        public static TelemetryEventCorrelation PostFault(this TelemetrySession telemetrySession, string eventName, string description, FaultSeverity faultSeverity, Exception exceptionObject, Func <IFaultUtility, int> gatherEventDetails, TelemetryEventCorrelation[] correlatedWith)
        {
            FaultEvent faultEvent = new FaultEvent(eventName, description, faultSeverity, exceptionObject, gatherEventDetails);

            faultEvent.Correlate(correlatedWith);
            telemetrySession.PostEvent(faultEvent);
            return(faultEvent.Correlation);
        }
예제 #3
0
        /// <summary>
        /// Queues a telemetry event to be posted to a server.
        /// Choose this method for flexibility.
        /// You should consider choosing PostUserTask, PostOperation, PostFault or PostAsset.
        /// These will enable a richer telemetry experience with additional insights provided by Visual Studio Data Model.
        /// If your data point doesn't align with any VS Data Model entity, please don't force any association and continue to use this method.
        /// If you have any questions regarding VS Data Model, please email VS Data Model Crew ([email protected]).
        /// </summary>
        /// <param name="telemetryEvent">A telemetry event that is ready to be posted.</param>
        public void PostEvent(TelemetryEvent telemetryEvent)
        {
            if (base.IsDisposed)
            {
                return;
            }
            bool       flag       = true;
            FaultEvent faultEvent = telemetryEvent as FaultEvent;

            if (faultEvent != null && watsonSessionChannel != null)
            {
                watsonSessionChannel.PostEvent(faultEvent);
                flag = faultEvent.PostThisEventToTelemetry;
            }
            if (flag)
            {
                if (!customEventPostProtection.TryEnterReadLock(0))
                {
                    numberOfDroppedEventsInDisposing++;
                    return;
                }
                ValidateEvent(telemetryEvent);
                TelemetryContext.ValidateEvent(telemetryEvent);
                PostValidatedEvent(telemetryEvent);
                customEventPostProtection.ExitReadLock();
            }
            TelemetryActivity telemetryActivity = telemetryEvent as TelemetryActivity;

            if (telemetryActivity != null)
            {
                TelemetryService.TelemetryEventSource.WriteActivityPostEvent(telemetryActivity, this);
            }
            else
            {
                TelemetryService.TelemetryEventSource.WriteTelemetryPostEvent(telemetryEvent, this);
            }
        }
예제 #4
0
 /// <summary>
 /// Set product name, feature name and entity name by parsing event name string.
 /// </summary>
 /// <param name="faultEvent">Fault event</param>
 public static void SetProductFeatureEntityName(FaultEvent faultEvent)
 {
     SetProductFeatureEntityName(faultEvent.Name, faultEvent.ReservedProperties);
 }