Skip to content

Commit ceb2c41

Browse files
authored
support breaking change attribute for dynamic parameters (#407)
* 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 * delete unused method
1 parent b1b6e80 commit ceb2c41

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/Common/CustomAttributes/BreakingChangeAttributeHelper.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
using System.Linq;
2121
using System.Management.Automation;
2222
using System.Reflection;
23+
using System.Runtime.CompilerServices;
2324
using System.Text;
2425

2526
namespace Microsoft.WindowsAzure.Commands.Common.CustomAttributes
@@ -154,12 +155,12 @@ public static IEnumerable<GenericBreakingChangeWithVersionAttribute> GetAllBreak
154155
attributeList.AddRange(f.GetCustomAttributes(typeof(GenericBreakingChangeWithVersionAttribute), false).Cast<GenericBreakingChangeWithVersionAttribute>());
155156
}
156157

157-
foreach (PropertyInfo p in type.GetRuntimeProperties())
158+
foreach (ParameterMetadata param in invocationInfo.MyCommand.Parameters.Values)
158159
{
159-
attributeList.AddRange(p.GetCustomAttributes(typeof(GenericBreakingChangeWithVersionAttribute), false).Cast<GenericBreakingChangeWithVersionAttribute>());
160+
attributeList.AddRange(param.Attributes.Where(a => a is GenericBreakingChangeWithVersionAttribute).Select(a => a as GenericBreakingChangeWithVersionAttribute));
160161
}
161162

162163
return invocationInfo == null ? attributeList : attributeList.Where(e => e.IsApplicableToInvocation(invocationInfo));
163164
}
164165
}
165-
}
166+
}

0 commit comments

Comments
 (0)