From 90206f7636b3f2731248e9e8ab5413d5ddd1c5cd Mon Sep 17 00:00:00 2001 From: Yunchi Wang <54880216+wyunchi-ms@users.noreply.github.com> Date: Tue, 29 Oct 2024 14:12:47 +0800 Subject: [PATCH] Fix the issue that UXMetadata generate null in example.parameters (#26505) --- tools/StaticAnalysis/UXMetadataAnalyzer/UXMetadataAnalyzer.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/StaticAnalysis/UXMetadataAnalyzer/UXMetadataAnalyzer.cs b/tools/StaticAnalysis/UXMetadataAnalyzer/UXMetadataAnalyzer.cs index 50d9ab8e82b1..b3be6a8aa034 100644 --- a/tools/StaticAnalysis/UXMetadataAnalyzer/UXMetadataAnalyzer.cs +++ b/tools/StaticAnalysis/UXMetadataAnalyzer/UXMetadataAnalyzer.cs @@ -178,6 +178,10 @@ private void ValidateMetadata(IssueLoggerContext context, string UXMetadataConte private void ValidateExample(IssueLoggerContext context, UXMetadataCommand command, CmdletMetadata cmdletMetadata, UXMetadataCommandExample example, ReportLogger issueLogger) { + if (example.Parameters == null) + { + return; + } List parameterListConvertedFromAlias = example.Parameters.Select(x => { string parameterNameInExample = x.Name.Trim('-');