From f8868b84d76eebe43cc6294bf1ca1cc40d2ed184 Mon Sep 17 00:00:00 2001 From: Yabo Hu Date: Wed, 29 Nov 2023 16:44:15 +0800 Subject: [PATCH 1/2] get breaking change attribute for all parameters instead of static parameters only, in this way breaking change attribute for dynamic parameters are able to be displayed --- .../CustomAttributes/BreakingChangeAttributeHelper.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Common/CustomAttributes/BreakingChangeAttributeHelper.cs b/src/Common/CustomAttributes/BreakingChangeAttributeHelper.cs index 3431563fc0..7085c0d335 100644 --- a/src/Common/CustomAttributes/BreakingChangeAttributeHelper.cs +++ b/src/Common/CustomAttributes/BreakingChangeAttributeHelper.cs @@ -20,6 +20,7 @@ using System.Linq; using System.Management.Automation; using System.Reflection; +using System.Runtime.CompilerServices; using System.Text; namespace Microsoft.WindowsAzure.Commands.Common.CustomAttributes @@ -156,10 +157,15 @@ public static IEnumerable GetAllBreak foreach (PropertyInfo p in type.GetRuntimeProperties()) { - attributeList.AddRange(p.GetCustomAttributes(typeof(GenericBreakingChangeWithVersionAttribute), false).Cast()); + attributeList.AddRange(p.GetCustomAttributes(typeof(GenericBreakingChangeWithVersionAttribute), false).Cast()); + } + + foreach (ParameterMetadata param in invocationInfo.MyCommand.Parameters.Values) + { + attributeList.AddRange(param.Attributes.Where(a => a is GenericBreakingChangeWithVersionAttribute).Select(a => a as GenericBreakingChangeWithVersionAttribute)); } return invocationInfo == null ? attributeList : attributeList.Where(e => e.IsApplicableToInvocation(invocationInfo)); } } -} +} \ No newline at end of file From c9f5557b600a25525f79ed0f3401b7700497252e Mon Sep 17 00:00:00 2001 From: Yabo Hu Date: Wed, 29 Nov 2023 16:48:20 +0800 Subject: [PATCH 2/2] delete unused method --- src/Common/CustomAttributes/BreakingChangeAttributeHelper.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/Common/CustomAttributes/BreakingChangeAttributeHelper.cs b/src/Common/CustomAttributes/BreakingChangeAttributeHelper.cs index 7085c0d335..69b65bd459 100644 --- a/src/Common/CustomAttributes/BreakingChangeAttributeHelper.cs +++ b/src/Common/CustomAttributes/BreakingChangeAttributeHelper.cs @@ -155,11 +155,6 @@ public static IEnumerable GetAllBreak attributeList.AddRange(f.GetCustomAttributes(typeof(GenericBreakingChangeWithVersionAttribute), false).Cast()); } - foreach (PropertyInfo p in type.GetRuntimeProperties()) - { - attributeList.AddRange(p.GetCustomAttributes(typeof(GenericBreakingChangeWithVersionAttribute), false).Cast()); - } - foreach (ParameterMetadata param in invocationInfo.MyCommand.Parameters.Values) { attributeList.AddRange(param.Attributes.Where(a => a is GenericBreakingChangeWithVersionAttribute).Select(a => a as GenericBreakingChangeWithVersionAttribute));