2 overrides of GetDiagnostics
Microsoft.CodeAnalysis.CSharp (1)
Syntax\CSharpSyntaxTree.cs (1)
864public override IEnumerable<Diagnostic> GetDiagnostics(CancellationToken cancellationToken = default)
Microsoft.CodeAnalysis.VisualBasic (1)
Syntax\VisualBasicSyntaxTree.vb (1)
360Public Overrides Function GetDiagnostics(Optional cancellationToken As CancellationToken = Nothing) As IEnumerable(Of Diagnostic)
196 references to GetDiagnostics
Microsoft.CodeAnalysis.CodeStyle (1)
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (1)
620if (tree.GetDiagnostics(cancellationToken).Any(d => d.Severity == DiagnosticSeverity.Error))
Microsoft.CodeAnalysis.CSharp (4)
Compilation\CSharpCompilation.cs (3)
2955builder.AddRange(syntaxTree.GetDiagnostics(cancellationToken)); 2967builder.AddRange(syntaxTree.GetDiagnostics(cancellationToken)); 3317var syntaxDiagnostics = syntaxTree.GetDiagnostics(cancellationToken);
Compilation\SyntaxAndDeclarationManager.cs (1)
211Debug.Assert(!directive.IsActive || tree.GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error));
Microsoft.CodeAnalysis.CSharp.EditorFeatures (1)
Interactive\CSharpSendToInteractiveSubmissionProvider.cs (1)
33!tree.GetDiagnostics().Any(diagnostic => diagnostic.Severity == DiagnosticSeverity.Error);
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (4)
BreakingChanges.cs (4)
26SyntaxFactory.ParseSyntaxTree(test).GetDiagnostics().Verify(Diagnostic(ErrorCode.ERR_PPDirectiveExpected, @"de\u0066in\U00000065")); 202Assert.Equal(8, tree.GetDiagnostics().Count()); 221Assert.Empty(tree.GetDiagnostics()); 279SyntaxFactory.ParseSyntaxTree(test).GetDiagnostics().Verify(Diagnostic(ErrorCode.ERR_GlobalAttributesNotFirst, "assembly"));
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (1)
FlowAnalysis\FlowDiagnosticTests.cs (1)
868comp.SyntaxTrees[0].GetDiagnostics().Verify(
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (3)
EditAndContinue\Helpers\EditingTestBase.cs (3)
143tree1.GetDiagnostics().Verify(); 144tree2.GetDiagnostics().Verify(); 205tree.GetDiagnostics().Verify();
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (22)
Semantics\InterpolationTests.cs (12)
533Assert.True(SyntaxFactory.ParseSyntaxTree(source + normal).GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error)); 534Assert.True(SyntaxFactory.ParseSyntaxTree(source + normal + " ").GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error)); 535Assert.True(SyntaxFactory.ParseSyntaxTree(source + normal + "{").GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error)); 536Assert.True(SyntaxFactory.ParseSyntaxTree(source + normal + "{ ").GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error)); 537Assert.True(SyntaxFactory.ParseSyntaxTree(source + verbat).GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error)); 538Assert.True(SyntaxFactory.ParseSyntaxTree(source + verbat + " ").GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error)); 539Assert.True(SyntaxFactory.ParseSyntaxTree(source + verbat + "{").GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error)); 540Assert.True(SyntaxFactory.ParseSyntaxTree(source + verbat + "{ ").GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error)); 558Assert.True(SyntaxFactory.ParseSyntaxTree(source).GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error)); 576Assert.True(SyntaxFactory.ParseSyntaxTree(source).GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error)); 595Assert.True(SyntaxFactory.ParseSyntaxTree(source).GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error)); 1489Assert.True(SyntaxFactory.ParseSyntaxTree(text).GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error));
Semantics\MethodBodyModelTests.cs (2)
325Assert.Equal(1, tree.GetDiagnostics().Count()); 326Assert.Equal(650, tree.GetDiagnostics().First().Code);
Semantics\RawInterpolationTests.cs (8)
559Assert.True(SyntaxFactory.ParseSyntaxTree(source + normal).GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error)); 560Assert.True(SyntaxFactory.ParseSyntaxTree(source + normal + " ").GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error)); 561Assert.True(SyntaxFactory.ParseSyntaxTree(source + normal + "{").GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error)); 562Assert.True(SyntaxFactory.ParseSyntaxTree(source + normal + "{ ").GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error)); 580Assert.True(SyntaxFactory.ParseSyntaxTree(source).GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error)); 598Assert.True(SyntaxFactory.ParseSyntaxTree(source).GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error)); 617Assert.True(SyntaxFactory.ParseSyntaxTree(source).GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error)); 1163Assert.True(SyntaxFactory.ParseSyntaxTree(text).GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error));
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (4)
Compilation\CompilationAPITests.cs (2)
56tree.GetDiagnostics().Verify( 118tree.GetDiagnostics().Verify();
Compilation\SemanticModelAPITests.cs (1)
3739Assert.NotEmpty(tree.GetDiagnostics());
Symbols\Source\AccessTests.cs (1)
48var errs = tree.GetDiagnostics();
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (123)
Diagnostics\LineSpanDirectiveTests.cs (7)
42treeB.GetDiagnostics().Verify(); 88treeB.GetDiagnostics().Verify(); 184treeB.GetDiagnostics().Verify(); 234treeB.GetDiagnostics().Verify(); 302treeB.GetDiagnostics().Verify(); 354treeB.GetDiagnostics().Verify(); 412treeB.GetDiagnostics().Verify();
Diagnostics\LocationsTests.cs (8)
311var diags = syntaxTree.GetDiagnostics(); 330diags = syntaxTree.GetDiagnostics(); 350diags = syntaxTree.GetDiagnostics(); 373var diags = syntaxTree.GetDiagnostics(); 395var diags = syntaxTree.GetDiagnostics(); 418var span = syntaxTree.GetDiagnostics().ElementAt(3).Location.GetLineSpan(); 564var diagnostics = tree.GetDiagnostics().ToList(); 592var diagnostics = tree.GetDiagnostics().ToList();
IncrementalParsing\IncrementalParsingTests.cs (16)
563Assert.Empty(tree.GetDiagnostics()); 577Assert.Empty(tree.GetDiagnostics()); 580Assert.Empty(fullTree.GetDiagnostics()); 616Assert.Empty(initialTree.GetDiagnostics()); 841Assert.Empty(withCloseBraceDeletedTree.GetDiagnostics()); 844Assert.Empty(fullTree.GetDiagnostics()); 2784startTree.GetDiagnostics().Verify(); 2797parsedTree.GetDiagnostics().Verify( 2813startTree.GetDiagnostics().Verify(); 2827parsedTree.GetDiagnostics().Verify( 2843startTree.GetDiagnostics().Verify(); 2855parsedTree.GetDiagnostics().Verify( 3107fullTree.GetDiagnostics().Select(d => d.ToString()), 3108incrTree.GetDiagnostics().Select(d => d.ToString())); 3746var pd = parsedTree.GetDiagnostics(); 3747var id = incrementalTree.GetDiagnostics();
LexicalAndXml\LexicalTests.cs (1)
3821var diagnostics = tree.GetDiagnostics();
LexicalAndXml\PreprocessorTests.cs (3)
3215var error = tree.GetDiagnostics().Single(); 3557var diagnostics = tree.GetDiagnostics(); 3875var diagnostic = tree.GetDiagnostics().Single();
LexicalAndXml\XmlDocCommentTests.cs (4)
2793tree.GetDiagnostics().Verify( 2845tree.GetDiagnostics().Verify( 2889tree.GetDiagnostics().Verify( 2922tree.GetDiagnostics().Verify(
Parsing\AsyncParsingTests.cs (2)
2431UsingTree("class async { async async { get; } }").GetDiagnostics().Verify(); 2534UsingTree("interface async { async this[async i] { get; } }").GetDiagnostics().Verify();
Parsing\ExpressionParsingTests.cs (10)
3836tree.GetDiagnostics().Verify(); 3926tree.GetDiagnostics().Verify(); 4017tree.GetDiagnostics().Verify(); 4104tree.GetDiagnostics().Verify(); 4198tree.GetDiagnostics().Verify(); 4501tree.GetDiagnostics().Verify(); 4592tree.GetDiagnostics().Verify(); 4685tree.GetDiagnostics().Verify(); 6513tree.GetDiagnostics().Verify( 6550tree.GetDiagnostics().Verify(
Parsing\LocalFunctionParsingTests.cs (9)
546tree.GetDiagnostics().Verify(); 615tree.GetDiagnostics().Verify( 720UsingTree(code, TestOptions.Regular9).GetDiagnostics().Verify(); 806UsingTree(code, TestOptions.Regular9).GetDiagnostics().Verify(); 1143tree.GetDiagnostics().Verify( 1182file.SyntaxTree.GetDiagnostics().Verify(); 1247file.SyntaxTree.GetDiagnostics().Verify( 1291file.SyntaxTree.GetDiagnostics().Verify(); 1706file.SyntaxTree.GetDiagnostics().Verify();
Parsing\ParserErrorMessageTests.cs (32)
1653var firstDiag = parsedTree.GetDiagnostics().Take(1); 2632var error = parsedTree.GetDiagnostics().Single(); 3765tree.GetDiagnostics().Verify(); 5695tree.GetDiagnostics().Verify(); 5698tree.GetDiagnostics().Verify(); 6148SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp4)).GetDiagnostics().Verify(); 6149SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp3)).GetDiagnostics().Verify(); 6160SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp2)).GetDiagnostics().Verify(); 6161SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp1)).GetDiagnostics().Verify(); 6184SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp2)).GetDiagnostics().Verify(); 6185SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp1)).GetDiagnostics().Verify(); 6215SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp4)).GetDiagnostics().Verify(); 6216SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp3)).GetDiagnostics().Verify(); 6243SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp3)).GetDiagnostics().Verify(); 6244SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp2)).GetDiagnostics().Verify(); 6271SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp3)).GetDiagnostics().Verify(); 6272SyntaxFactory.ParseSyntaxTree(text, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp2)).GetDiagnostics().Verify(); 6285SyntaxFactory.ParseSyntaxTree(text, options: TestOptions.RegularWithDocumentationComments.WithLanguageVersion(LanguageVersion.CSharp2)).GetDiagnostics().Verify(); 6286SyntaxFactory.ParseSyntaxTree(text, options: TestOptions.RegularWithDocumentationComments.WithLanguageVersion(LanguageVersion.CSharp1)).GetDiagnostics().Verify( 6304SyntaxFactory.ParseSyntaxTree(text, options: TestOptions.RegularWithDocumentationComments.WithLanguageVersion(LanguageVersion.CSharp2)).GetDiagnostics().Verify(); 6305SyntaxFactory.ParseSyntaxTree(text, options: TestOptions.RegularWithDocumentationComments.WithLanguageVersion(LanguageVersion.CSharp1)).GetDiagnostics().Verify( 6328SyntaxFactory.ParseSyntaxTree(text, options: TestOptions.RegularWithDocumentationComments.WithLanguageVersion(LanguageVersion.CSharp2)).GetDiagnostics().Verify(); 6329SyntaxFactory.ParseSyntaxTree(text, options: TestOptions.RegularWithDocumentationComments.WithLanguageVersion(LanguageVersion.CSharp1)).GetDiagnostics().Verify( 6348SyntaxFactory.ParseSyntaxTree(text, options: TestOptions.RegularWithDocumentationComments.WithLanguageVersion(LanguageVersion.CSharp2)).GetDiagnostics().Verify(); 6349SyntaxFactory.ParseSyntaxTree(text, options: TestOptions.RegularWithDocumentationComments.WithLanguageVersion(LanguageVersion.CSharp1)).GetDiagnostics().Verify(); 6380SyntaxFactory.ParseSyntaxTree(source, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp2)).GetDiagnostics().Verify(); 6381SyntaxFactory.ParseSyntaxTree(source, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp1)).GetDiagnostics().Verify(); 6475SyntaxFactory.ParseSyntaxTree(source, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp6)).GetDiagnostics().Verify(); 6477SyntaxFactory.ParseSyntaxTree(source, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp5)).GetDiagnostics().Verify(); 6520var actualErrors = parsedTree.GetDiagnostics().ToArray(); 6553var actualErrors = parsedTree.GetDiagnostics().ToArray(); 6627SyntaxFactory.ParseSyntaxTree(source).GetDiagnostics().Verify(
Parsing\ParserRegressionTests.cs (3)
226IEnumerable<Diagnostic> actualErrors = parsedTree.GetDiagnostics(); 244IEnumerable<Diagnostic> actualErrors = parsedTree.GetDiagnostics(); 829var actualErrors = parsedTree.GetDiagnostics();
Parsing\ParsingErrorRecoveryTests.cs (17)
7399Assert.True(syntaxTree.GetDiagnostics().Select(d => ((IFormattable)d).ToString(null, EnsureEnglishUICulture.PreferredOrNull)).SequenceEqual(new[] 7418Assert.True(syntaxTree.GetDiagnostics().Select(d => ((IFormattable)d).ToString(null, EnsureEnglishUICulture.PreferredOrNull)).SequenceEqual(new[] 7451Assert.True(syntaxTree.GetDiagnostics().Select(d => ((IFormattable)d).ToString(null, EnsureEnglishUICulture.PreferredOrNull)).SequenceEqual(new[] 7476Assert.True(syntaxTree.GetDiagnostics().Select(d => ((IFormattable)d).ToString(null, EnsureEnglishUICulture.PreferredOrNull)).SequenceEqual(new[] 7501Assert.True(syntaxTree.GetDiagnostics().Select(d => ((IFormattable)d).ToString(null, EnsureEnglishUICulture.PreferredOrNull)).SequenceEqual(new[] 7527Assert.True(syntaxTree.GetDiagnostics().Select(d => ((IFormattable)d).ToString(null, EnsureEnglishUICulture.PreferredOrNull)).SequenceEqual(new[] 7551Assert.True(syntaxTree.GetDiagnostics().Select(d => ((IFormattable)d).ToString(null, EnsureEnglishUICulture.PreferredOrNull)).SequenceEqual(new[] 7576Assert.Empty(syntaxTree.GetDiagnostics()); 7590syntaxTree.GetDiagnostics().Verify( 7645var diags = tree.GetDiagnostics(); 7672var diags = tree.GetDiagnostics(); 7778tree.GetDiagnostics().Verify( 7809tree.GetDiagnostics().Verify( 7843tree.GetDiagnostics().Verify( 7868tree.GetDiagnostics().Verify( 7895tree.GetDiagnostics().ToArray(); 7909tree.GetDiagnostics().ToArray();
Parsing\ParsingTests.cs (3)
60var actualErrors = parsedTree.GetDiagnostics(); 67var actualErrors = parsedTree.GetDiagnostics(); 74var actualErrors = parsedTree.GetDiagnostics();
Parsing\RecordParsing.cs (5)
265tree.GetDiagnostics().Verify(); 309tree.GetDiagnostics().Verify(); 331tree.GetDiagnostics().Verify(); 334tree.GetDiagnostics().Verify(); 1218tree.GetDiagnostics().Verify();
Parsing\StatementParsingTests.cs (1)
3507tree.GetDiagnostics().Verify();
Parsing\TopLevelStatementsParsingTests.cs (1)
1624tree.GetDiagnostics().Verify();
Syntax\SyntaxNodeTests.cs (1)
1824Assert.Equal(0, syntaxTree.GetDiagnostics().Count());
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (1)
CodeDefinitionWindow\AbstractCodeDefinitionWindowTests.vb (1)
53Assert.Empty(tree.GetDiagnostics(CancellationToken.None))
Microsoft.CodeAnalysis.LanguageServer.Protocol (1)
Handler\Breakpoints\ValidateBreakableRangeHandler.cs (1)
62if (tree.GetDiagnostics(cancellationToken).Any(d => d.Severity == DiagnosticSeverity.Error))
Microsoft.CodeAnalysis.VisualBasic (8)
Compilation\VisualBasicCompilation.vb (5)
272If tree.GetDiagnostics().Any() Then 292If value?.GetDiagnostics().Any() Then 2161builder.AddRange(SyntaxTrees(i).GetDiagnostics(cancellationToken)) 2167builder.AddRange(tree.GetDiagnostics(cancellationToken)) 2255Dim syntaxDiagnostics = tree.GetDiagnostics(cancellationToken)
Symbols\EmbeddedSymbols\EmbeddedSymbolManager.vb (3)
58If s_embeddedSyntax.GetDiagnostics().Any() Then 73If s_vbCoreSyntax.GetDiagnostics().Any() Then 85If s_internalXmlHelperSyntax.GetDiagnostics().Any() Then
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures (1)
LineCommit\CommitFormatter.vb (1)
135Dim diagnostics = tree.GetDiagnostics(cancellationToken).Where(
Microsoft.CodeAnalysis.VisualBasic.ExpressionCompiler (1)
SyntaxHelpers.vb (1)
44diagnostics.AddRange(syntaxTree.GetDiagnostics())
Microsoft.CodeAnalysis.VisualBasic.Features.UnitTests (3)
EditAndContinue\Helpers\EditingTestBase.vb (3)
214tree1.GetDiagnostics().Verify() 215tree2.GetDiagnostics().Verify() 268tree.GetDiagnostics().Verify()
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (12)
IncrementalParser\IncrementalParser.vb (9)
824Assert.Equal(1, oldTree.GetDiagnostics().Count) 825Assert.Equal("Syntax error.", oldTree.GetDiagnostics()(0).GetMessage(EnsureEnglishUICulture.PreferredOrNull)) 826Assert.Equal("[131..134)", oldTree.GetDiagnostics()(0).Location.SourceSpan.ToString) 835Assert.Equal(1, tmpTree.GetDiagnostics().Count) 836Assert.Equal("Syntax error.", tmpTree.GetDiagnostics()(0).GetMessage(EnsureEnglishUICulture.PreferredOrNull)) 837Assert.Equal("[132..135)", tmpTree.GetDiagnostics()(0).Location.SourceSpan.ToString) 1673Dim diagnostics = oldTree.GetDiagnostics() 2582Dim diagnosticsA = treeA.GetDiagnostics() 2583Dim diagnosticsB = treeB.GetDiagnostics()
Parser\ParseAsyncTests.vb (1)
369Assert.True(Aggregate d In tree.GetDiagnostics() Into All(d.Code = ERRID.ERR_ObsoleteArgumentsNeedParens))
Parser\ParserRegressionTests.vb (2)
762tree.GetDiagnostics().VerifyErrorCodes(Diagnostic(ERRID.ERR_BinaryFile)) 935Assert.Equal(Syntax.InternalSyntax.Scanner.BadTokenCountLimit, tree.GetDiagnostics().Where(Function(d) d.Code = ERRID.ERR_IllegalChar).Count())
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (4)
CompilationTestUtils.vb (1)
831AssertTheseDiagnostics(tree.GetDiagnostics().AsImmutable(), errs, suppressInfos)
ParserTestUtilities.vb (3)
85AppendSyntaxErrors(tree.GetDiagnostics(), errors.Builder) 91tree.GetDiagnostics().VerifyErrorCodes(expectedDiagnostics) 93tree.GetDiagnostics().Verify(expectedDiagnostics)
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (2)
VisualStudioMSBuildWorkspaceTests.cs (2)
896var diagnostics = tree.GetDiagnostics(); 915var diagnostics = tree.GetDiagnostics();