public static ISymbol GetSemanticSymbol()

in src/Analysis/Codelyzer.Analysis.CSharp/SemanticHelper.cs [100:121]


        public static ISymbol GetSemanticSymbol(SyntaxNode syntaxNode,
            SemanticModel semanticModel,
            SemanticModel preportSemanticModel = null)
        {
            if (semanticModel == null && preportSemanticModel == null) return null;

            var symbol = semanticModel?.GetSymbolInfo(syntaxNode).Symbol;
            if (symbol == null && preportSemanticModel != null)
            {
                try
                {
                    symbol = preportSemanticModel.GetSymbolInfo(syntaxNode).Symbol;
                }
                catch (Exception)
                {
                    //When looking for a symbol, and the semantic model is not passed, this generates an error.
                    //We don't log this error because this is an expected behavior when there's no previous semantic models
                }
        }

            return symbol;
        }