bool TryFindMonoTODO (SemanticModel semanticModel, SyntaxNode node, out Diagnostic diagnostic, CancellationToken cancellationToken) { var info = semanticModel.GetSymbolInfo (node); diagnostic = default(Diagnostic); if (info.Symbol == null || semanticModel.IsFromGeneratedCode (cancellationToken)) return false; foreach (var attr in info.Symbol.GetAttributes ()) { if (attr.AttributeClass.ContainingNamespace.GetFullName () != "System") continue; string val; if (attributes.TryGetValue (attr.AttributeClass.Name, out val)) { string msg = null; if (attr.ConstructorArguments.Length > 0) { var arg = attr.ConstructorArguments [0]; msg = arg.Value != null ? arg.Value.ToString () : null; } var tree = semanticModel.SyntaxTree; diagnostic = Diagnostic.Create(descriptor, tree.GetLocation(node.Span), string.IsNullOrEmpty (msg) ? val : val + ": " + msg); return true; } } return false; }