public void LogFault(Exception ex, string description, bool dumpProcess) { var session = _session.Value; // No session is not a fatal error if (session == null) { return; } // Never send events when users have not opted in. if (!session.IsOptedIn) { return; } var fault = new FaultEvent( EventPrefix + "UnhandledException", !string.IsNullOrEmpty(description) ? description : "Unhandled exception in Python extension.", ex ); if (dumpProcess) { fault.AddProcessDump(Process.GetCurrentProcess().Id); fault.IsIncludedInWatsonSample = true; } else { fault.IsIncludedInWatsonSample = false; } session.PostEvent(fault); }
public void RecordFault(string eventName, Exception ex, string description, bool dumpProcess) { if (this.IsEnabled) { var fault = new FaultEvent( eventName, !string.IsNullOrEmpty(description) ? description : "Unhandled exception in Cookiecutter extension.", ex ); if (dumpProcess) { fault.AddProcessDump(Process.GetCurrentProcess().Id); fault.IsIncludedInWatsonSample = true; } else { fault.IsIncludedInWatsonSample = false; } _session.PostEvent(fault); } }
/// <summary> /// Process events from the queue. /// Process all events. /// </summary> public void ProcessEvents() { try { if (base.IsDisposed) { throw new ObjectDisposedException(GetType().Name, "it is not allowed to process events after channel is disposed"); } if (scheduler.CanEnterTimedDelegate()) { TelemetryEvent result; while (queue.TryDequeue(out result)) { eventProcessor.ProcessEvent(result); } if (!hasProcessedEvents) { hasProcessedEvents = true; initializedAction(); } } } catch (Exception exceptionObject) { FaultEvent faultEvent = new FaultEvent("VS/Telemetry/InternalFault", $"Exception in SessionChannel.EventProcessorChannel ProcessEvents Channel = {ChannelId}", exceptionObject) { PostThisEventToTelemetry = false }; faultEvent.AddProcessDump(Process.GetCurrentProcess().Id); telemetrySession.PostEvent(faultEvent); } finally { scheduler.ExitTimedDelegate(); } }