Skip to content

Commit 2e8a852

Browse files
Fix analyzer failure where incorrect SemanticModel is used (#91764)
Fixes #90356
1 parent c3e67b5 commit 2e8a852

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@
4646
<!-- Override InformationalVersion during servicing as it's returned via public api. -->
4747
<InformationalVersion Condition="'$(PreReleaseVersionLabel)' == 'servicing'">$(ProductVersion)</InformationalVersion>
4848
<InformationalVersion Condition="'$(StabilizePackageVersion)' == 'true'">$(ProductVersion)</InformationalVersion>
49-
<!-- AD0001 : https://github.com/dotnet/runtime/issues/90356 -->
50-
<NoWarn>$(NoWarn),0419,0649;AD0001</NoWarn>
49+
<NoWarn>$(NoWarn),0419,0649</NoWarn>
5150
<Nullable>enable</Nullable>
5251

5352
<!-- Ignore all previous constants since SPCL is sensitive to what is defined and the Sdk adds some by default -->

src/libraries/System.Private.CoreLib/gen/IntrinsicsInSystemPrivateCoreLibAnalyzer.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,12 @@ private static INamedTypeSymbol[][] DecomposePropertySymbolForIsSupportedGroups_
293293
if (propertyDefiningSyntax is PropertyDeclarationSyntax propertyDeclaration
294294
&& propertyDeclaration.ExpressionBody is ArrowExpressionClauseSyntax arrowExpression)
295295
{
296+
if (model.SyntaxTree != arrowExpression.SyntaxTree)
297+
{
298+
#pragma warning disable RS1030
299+
model = model.Compilation.GetSemanticModel(arrowExpression.SyntaxTree);
300+
#pragma warning restore RS1030
301+
}
296302
return DecomposeConditionForIsSupportedGroups(context, model, arrowExpression.Expression);
297303
}
298304
}

0 commit comments

Comments
 (0)