Repository: dotnet/roslyn
File: src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/SymbolUsageInfo.cs (C#)

Code before:
                        case SymbolKind.Parameter:
                        case SymbolKind.Local:
                            var valueUsageInfo = ValueUsageInfo.Read;
                            if (semanticFacts.IsWrittenTo(semanticModel, node, cancellationToken))
                                valueUsageInfo |= ValueUsageInfo.Write;

                            return Create(valueUsageInfo);
                    }
                }

                return SymbolUsageInfo.None;
            }
        }

        bool IsInNameOfOperation(SyntaxNode node)
        {
            // Walk up out of the member access expression. This way if we have something like
            // nameof(C.Goo()), we ensure that operation.Parent is the INameOfOperation. 

            while (syntaxFacts.IsMemberAccessExpression(node?.Parent))
                node = node.Parent;

            var operation = semanticModel.GetOperation(node, cancellationToken);

            // Note: sizeof/typeof also return 'name', but are handled in GetSymbolUsageInfo.
            if (operation?.Parent is INameOfOperation)
                return true;

            return false;
        }
    }

    private static bool IsNodeOrAnyAncestorLeftSideOfDot(SyntaxNode node, ISyntaxFacts syntaxFacts)
    {
        if (syntaxFacts.IsLeftSideOfDot(node))
        {
            return true;
        }

        if (syntaxFacts.IsRightOfQualifiedName(node) ||
            syntaxFacts.IsNameOfSimpleMemberAccessExpression(node) ||
            syntaxFacts.IsNameOfMemberBindingExpression(node))
        {
            return syntaxFacts.IsLeftSideOfDot(node.Parent);
        }

        return false;
    }
}


Review comment (suggestion):
```suggestion
            if (node is null)
                return false;
            
            var operation = semanticModel.GetOperation(node, cancellationToken);
```

Code after:
                        case SymbolKind.Parameter:
                        case SymbolKind.Local:
                            var valueUsageInfo = ValueUsageInfo.Read;
                            if (semanticFacts.IsWrittenTo(semanticModel, node, cancellationToken))
                                valueUsageInfo |= ValueUsageInfo.Write;

                            return Create(valueUsageInfo);
                    }
                }

                return SymbolUsageInfo.None;
            }
        }

        bool IsInNameOfOperation(SyntaxNode node)
        {
            // Walk up out of the member access expression. This way if we have something like
            // nameof(C.Goo()), we ensure that operation.Parent is the INameOfOperation. 

            while (syntaxFacts.IsMemberAccessExpression(node?.Parent))
                node = node.Parent;

            if (node is null)
                return false;

            var operation = semanticModel.GetOperation(node, cancellationToken);

            // Note: sizeof/typeof also return 'name', but are handled in GetSymbolUsageInfo.
            if (operation?.Parent is INameOfOperation)
                return true;

            return false;
        }
    }

    private static bool IsNodeOrAnyAncestorLeftSideOfDot(SyntaxNode node, ISyntaxFacts syntaxFacts)
    {
        if (syntaxFacts.IsLeftSideOfDot(node))
        {
            return true;
        }

        if (syntaxFacts.IsRightOfQualifiedName(node) ||
            syntaxFacts.IsNameOfSimpleMemberAccessExpression(node) ||
            syntaxFacts.IsNameOfMemberBindingExpression(node))
        {
            return syntaxFacts.IsLeftSideOfDot(node.Parent);
        }

        return false;
    }