Skip to content

Commit 124893d

Browse files
authored
Add myinvocation to getconfigvalue (#435)
1 parent a0a0c06 commit 124893d

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/Common/AzurePSCmdlet.cs

+8-8
Original file line numberDiff line numberDiff line change
@@ -324,12 +324,12 @@ protected virtual void SetupHttpClientPipeline()
324324
AzureSession.Instance.ClientFactory.AddUserAgent(ModuleName, this.ModuleVersion);
325325
try {
326326
string hostEnv = AzurePSCmdlet.getEnvUserAgent();
327-
if (!String.IsNullOrWhiteSpace(hostEnv))
327+
if (!String.IsNullOrWhiteSpace(hostEnv))
328328
{
329329
AzureSession.Instance.ClientFactory.AddUserAgent(hostEnv);
330330
}
331-
}
332-
catch (Exception)
331+
}
332+
catch (Exception)
333333
{
334334
// ignore if it failed.
335335
}
@@ -409,7 +409,7 @@ protected override void BeginProcessing()
409409
private void WriteBreakingChangeOrPreviewMessage()
410410
{
411411
if (AzureSession.Instance.TryGetComponent<IConfigManager>(nameof(IConfigManager), out var configManager)
412-
&& configManager.GetConfigValue<bool>(ConfigKeysForCommon.DisplayBreakingChangeWarning))
412+
&& configManager.GetConfigValue<bool>(ConfigKeysForCommon.DisplayBreakingChangeWarning, MyInvocation))
413413
{
414414
BreakingChangeAttributeHelper.ProcessCustomAttributesAtRuntime(this.GetType(), this.MyInvocation, WriteWarning);
415415

@@ -457,7 +457,7 @@ protected override void EndProcessing()
457457
if (MetricHelper.IsCalledByUser()
458458
&& SurveyHelper.GetInstance().ShouldPromptAzSurvey()
459459
&& (AzureSession.Instance.TryGetComponent<IConfigManager>(nameof(IConfigManager), out var configManager)
460-
&& !configManager.GetConfigValue<bool>(ConfigKeysForCommon.EnableInterceptSurvey).Equals(false)))
460+
&& !configManager.GetConfigValue<bool>(ConfigKeysForCommon.EnableInterceptSurvey, MyInvocation).Equals(false)))
461461
{
462462
WriteSurvey();
463463
if (_qosEvent != null)
@@ -516,7 +516,7 @@ protected bool IsVerbose()
516516

517517
protected void WriteSurvey()
518518
{
519-
// Using color same with Azure brand event.
519+
// Using color same with Azure brand event.
520520
// Using Ansi Code to control font color(97(Bold White)) and background color(0;120;212(RGB))
521521
string ansiCodePrefix = "\u001b[97;48;2;0;120;212m";
522522
// using '[k' for erase in line. '[0m' to ending ansi code
@@ -540,7 +540,7 @@ protected void WriteSurvey()
540540
}
541541
base.WriteError(errorRecord);
542542
if (AzureSession.Instance.TryGetComponent<IConfigManager>(nameof(IConfigManager), out var configManager)
543-
&& configManager.GetConfigValue<bool>(ConfigKeysForCommon.DisplayBreakingChangeWarning))
543+
&& configManager.GetConfigValue<bool>(ConfigKeysForCommon.DisplayBreakingChangeWarning, MyInvocation))
544544
{
545545
PreviewAttributeHelper.ProcessCustomAttributesAtRuntime(this.GetType(), this.MyInvocation, WriteWarning);
546546
}
@@ -863,7 +863,7 @@ private void RecordDebugMessages()
863863
private bool ShouldRecordDebugMessages()
864864
{
865865
return AzureSession.Instance.TryGetComponent<IConfigManager>(nameof(IConfigManager), out var configManager)
866-
&& configManager.GetConfigValue<bool>(ConfigKeysForCommon.EnableErrorRecordsPersistence)
866+
&& configManager.GetConfigValue<bool>(ConfigKeysForCommon.EnableErrorRecordsPersistence, MyInvocation)
867867
&& IsDataCollectionAllowed();
868868
}
869869

0 commit comments

Comments
 (0)