/// <summary> /// Perform end of pipeline processing. /// </summary> protected override void EndProcessing() { if (this.MyInvocation?.MyCommand?.Version != null && SurveyHelper.GetInstance().ShouldPropmtSurvey(this.MyInvocation.MyCommand.ModuleName, this.MyInvocation.MyCommand.Version)) { WriteSurvey(); if (_qosEvent != null) { _qosEvent.SurveyPrompted = true; } } if (MetricHelper.IsCalledByUser()) { // Send telemetry when cmdlet is directly called by user LogQosEvent(); } else { // When cmdlet is called within another cmdlet, we will not add a new telemetry, but add the cmdlet name to InternalCalledCmdlets MetricHelper.AppendInternalCalledCmdlet(this.MyInvocation?.MyCommand?.Name); } LogCmdletEndInvocationInfo(); TearDownDebuggingTraces(); TearDownHttpClientPipeline(); _previousEndTime = DateTimeOffset.Now; base.EndProcessing(); }