diff --git a/src/Common/AzurePSCmdlet.cs b/src/Common/AzurePSCmdlet.cs index 70b3a2d11a..ecfd30138c 100644 --- a/src/Common/AzurePSCmdlet.cs +++ b/src/Common/AzurePSCmdlet.cs @@ -324,12 +324,12 @@ protected virtual void SetupHttpClientPipeline() AzureSession.Instance.ClientFactory.AddUserAgent(ModuleName, this.ModuleVersion); try { string hostEnv = AzurePSCmdlet.getEnvUserAgent(); - if (!String.IsNullOrWhiteSpace(hostEnv)) + if (!String.IsNullOrWhiteSpace(hostEnv)) { AzureSession.Instance.ClientFactory.AddUserAgent(hostEnv); } - } - catch (Exception) + } + catch (Exception) { // ignore if it failed. } @@ -409,7 +409,7 @@ protected override void BeginProcessing() private void WriteBreakingChangeOrPreviewMessage() { if (AzureSession.Instance.TryGetComponent(nameof(IConfigManager), out var configManager) - && configManager.GetConfigValue(ConfigKeysForCommon.DisplayBreakingChangeWarning)) + && configManager.GetConfigValue(ConfigKeysForCommon.DisplayBreakingChangeWarning, MyInvocation)) { BreakingChangeAttributeHelper.ProcessCustomAttributesAtRuntime(this.GetType(), this.MyInvocation, WriteWarning); @@ -457,7 +457,7 @@ protected override void EndProcessing() if (MetricHelper.IsCalledByUser() && SurveyHelper.GetInstance().ShouldPromptAzSurvey() && (AzureSession.Instance.TryGetComponent(nameof(IConfigManager), out var configManager) - && !configManager.GetConfigValue(ConfigKeysForCommon.EnableInterceptSurvey).Equals(false))) + && !configManager.GetConfigValue(ConfigKeysForCommon.EnableInterceptSurvey, MyInvocation).Equals(false))) { WriteSurvey(); if (_qosEvent != null) @@ -516,7 +516,7 @@ protected bool IsVerbose() protected void WriteSurvey() { - // Using color same with Azure brand event. + // Using color same with Azure brand event. // Using Ansi Code to control font color(97(Bold White)) and background color(0;120;212(RGB)) string ansiCodePrefix = "\u001b[97;48;2;0;120;212m"; // using '[k' for erase in line. '[0m' to ending ansi code @@ -540,7 +540,7 @@ protected void WriteSurvey() } base.WriteError(errorRecord); if (AzureSession.Instance.TryGetComponent(nameof(IConfigManager), out var configManager) - && configManager.GetConfigValue(ConfigKeysForCommon.DisplayBreakingChangeWarning)) + && configManager.GetConfigValue(ConfigKeysForCommon.DisplayBreakingChangeWarning, MyInvocation)) { PreviewAttributeHelper.ProcessCustomAttributesAtRuntime(this.GetType(), this.MyInvocation, WriteWarning); } @@ -863,7 +863,7 @@ private void RecordDebugMessages() private bool ShouldRecordDebugMessages() { return AzureSession.Instance.TryGetComponent(nameof(IConfigManager), out var configManager) - && configManager.GetConfigValue(ConfigKeysForCommon.EnableErrorRecordsPersistence) + && configManager.GetConfigValue(ConfigKeysForCommon.EnableErrorRecordsPersistence, MyInvocation) && IsDataCollectionAllowed(); }