Skip to content

Commit

Permalink
Add myinvocation to getconfigvalue (#435)
Browse files Browse the repository at this point in the history
  • Loading branch information
isra-fel authored Dec 17, 2024
1 parent a0a0c06 commit 124893d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/Common/AzurePSCmdlet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
}
Expand Down Expand Up @@ -409,7 +409,7 @@ protected override void BeginProcessing()
private void WriteBreakingChangeOrPreviewMessage()
{
if (AzureSession.Instance.TryGetComponent<IConfigManager>(nameof(IConfigManager), out var configManager)
&& configManager.GetConfigValue<bool>(ConfigKeysForCommon.DisplayBreakingChangeWarning))
&& configManager.GetConfigValue<bool>(ConfigKeysForCommon.DisplayBreakingChangeWarning, MyInvocation))
{
BreakingChangeAttributeHelper.ProcessCustomAttributesAtRuntime(this.GetType(), this.MyInvocation, WriteWarning);

Expand Down Expand Up @@ -457,7 +457,7 @@ protected override void EndProcessing()
if (MetricHelper.IsCalledByUser()
&& SurveyHelper.GetInstance().ShouldPromptAzSurvey()
&& (AzureSession.Instance.TryGetComponent<IConfigManager>(nameof(IConfigManager), out var configManager)
&& !configManager.GetConfigValue<bool>(ConfigKeysForCommon.EnableInterceptSurvey).Equals(false)))
&& !configManager.GetConfigValue<bool>(ConfigKeysForCommon.EnableInterceptSurvey, MyInvocation).Equals(false)))
{
WriteSurvey();
if (_qosEvent != null)
Expand Down Expand Up @@ -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
Expand All @@ -540,7 +540,7 @@ protected void WriteSurvey()
}
base.WriteError(errorRecord);
if (AzureSession.Instance.TryGetComponent<IConfigManager>(nameof(IConfigManager), out var configManager)
&& configManager.GetConfigValue<bool>(ConfigKeysForCommon.DisplayBreakingChangeWarning))
&& configManager.GetConfigValue<bool>(ConfigKeysForCommon.DisplayBreakingChangeWarning, MyInvocation))
{
PreviewAttributeHelper.ProcessCustomAttributesAtRuntime(this.GetType(), this.MyInvocation, WriteWarning);
}
Expand Down Expand Up @@ -863,7 +863,7 @@ private void RecordDebugMessages()
private bool ShouldRecordDebugMessages()
{
return AzureSession.Instance.TryGetComponent<IConfigManager>(nameof(IConfigManager), out var configManager)
&& configManager.GetConfigValue<bool>(ConfigKeysForCommon.EnableErrorRecordsPersistence)
&& configManager.GetConfigValue<bool>(ConfigKeysForCommon.EnableErrorRecordsPersistence, MyInvocation)
&& IsDataCollectionAllowed();
}

Expand Down

0 comments on commit 124893d

Please sign in to comment.