diff options
author | Andy Gocke <angocke@microsoft.com> | 2022-07-20 18:40:43 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-20 18:40:43 +0300 |
commit | 7a61266453f937bad25af292b602dc5348ff18c4 (patch) | |
tree | 81dd0a92a903d09d2887ee8363d087025d6510ce /src/ILLink.CodeFix/RequiresDynamicCodeCodeFixProvider.cs | |
parent | 60f48c55b5e0183bd1cee4cfa14f1d9ad3d90935 (diff) |
Fix syntax node scope and nullable warnings (#2900)
The syntax node scope should be the innermost node, otherwise
GetSymbolInfo will often return null. As an example, GetSymbolInfo will
return null for an ArgumentSyntax node, but the underlying expression
will likely resolve into a symbol.
Also adds proper null checks in case any of the providers return null.
Diffstat (limited to 'src/ILLink.CodeFix/RequiresDynamicCodeCodeFixProvider.cs')
-rw-r--r-- | src/ILLink.CodeFix/RequiresDynamicCodeCodeFixProvider.cs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/ILLink.CodeFix/RequiresDynamicCodeCodeFixProvider.cs b/src/ILLink.CodeFix/RequiresDynamicCodeCodeFixProvider.cs index cab57d7e6..b0e5ef9ec 100644 --- a/src/ILLink.CodeFix/RequiresDynamicCodeCodeFixProvider.cs +++ b/src/ILLink.CodeFix/RequiresDynamicCodeCodeFixProvider.cs @@ -30,7 +30,7 @@ namespace ILLink.CodeFix public sealed override Task RegisterCodeFixesAsync (CodeFixContext context) => BaseRegisterCodeFixesAsync (context); - protected override SyntaxNode[] GetAttributeArguments (ISymbol attributableSymbol, ISymbol targetSymbol, SyntaxGenerator syntaxGenerator, Diagnostic diagnostic) + protected override SyntaxNode[] GetAttributeArguments (ISymbol? attributableSymbol, ISymbol targetSymbol, SyntaxGenerator syntaxGenerator, Diagnostic diagnostic) { var symbolDisplayName = targetSymbol.GetDisplayName (); if (string.IsNullOrEmpty (symbolDisplayName) || HasPublicAccessibility (attributableSymbol)) |