87 references to Catches
Microsoft.CodeAnalysis.CSharp (12)
Binder\Binder_Statements.cs (2)
3242var catchBlocks = BindCatchBlocks(node.Catches, diagnostics); 3399: (filter.Parent.Parent is TryStatementSyntax s && s.Catches.Count == 1 && s.Finally == null)
Binder\LocalBinderFactory.cs (2)
853if (node.Catches.Any()) 866foreach (CatchClauseSyntax c in node.Catches)
Syntax.xml.Main.Generated.cs (1)
1942=> node.Update(VisitList(node.AttributeLists), VisitToken(node.TryKeyword), (BlockSyntax?)Visit(node.Block) ?? throw new ArgumentNullException("block"), VisitList(node.Catches), (FinallyClauseSyntax?)Visit(node.Finally));
Syntax.xml.Syntax.Generated.cs (6)
9001if (attributeLists != this.AttributeLists || tryKeyword != this.TryKeyword || block != this.Block || catches != this.Catches || @finally != this.Finally) 9012public new TryStatementSyntax WithAttributeLists(SyntaxList<AttributeListSyntax> attributeLists) => Update(attributeLists, this.TryKeyword, this.Block, this.Catches, this.Finally); 9013public TryStatementSyntax WithTryKeyword(SyntaxToken tryKeyword) => Update(this.AttributeLists, tryKeyword, this.Block, this.Catches, this.Finally); 9014public TryStatementSyntax WithBlock(BlockSyntax block) => Update(this.AttributeLists, this.TryKeyword, block, this.Catches, this.Finally); 9016public TryStatementSyntax WithFinally(FinallyClauseSyntax? @finally) => Update(this.AttributeLists, this.TryKeyword, this.Block, this.Catches, @finally); 9022public TryStatementSyntax AddCatches(params CatchClauseSyntax[] items) => WithCatches(this.Catches.AddRange(items));
Syntax\LookupPosition.cs (1)
426CatchClauseSyntax? lastCatch = tryStmt.Catches.LastOrDefault();
Microsoft.CodeAnalysis.CSharp.Features (9)
Debugging\CSharpProximityExpressionsService.Worker.cs (1)
287foreach (var catchClause in tryStatement.Catches)
DocumentationComments\CSharpDocumentationCommentSnippetService.cs (1)
187foreach (var catchClause in tryStatement.Catches)
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (4)
2663&& SyntaxFactory.AreEquivalent(oldTryStatement.Catches, newTryStatement.Catches); 2697if (tryStatement.Catches is not [var firstCatch, ..]) 2707: tryStatement.Catches.Last().Span.End);
Highlighting\KeywordHighlighters\TryStatementHighlighter.cs (1)
32foreach (var catchDeclaration in tryStatement.Catches)
IntroduceUsingStatement\CSharpIntroduceUsingStatementCodeRefactoringProvider.cs (1)
36=> tryStatement.Catches.Count > 0;
Structure\Providers\BlockSyntaxStructureProvider.cs (1)
74foreach (var catchClause in tryStatement.Catches)
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (66)
Generated\Syntax.Test.xml.Generated.cs (2)
12890Assert.Equal(default, node.Catches); 12892var newNode = node.WithAttributeLists(node.AttributeLists).WithTryKeyword(node.TryKeyword).WithBlock(node.Block).WithCatches(node.Catches).WithFinally(node.Finally);
Parsing\StatementParsingTests.cs (64)
1238Assert.Equal(1, ts.Catches.Count); 1239Assert.NotEqual(default, ts.Catches[0].CatchKeyword); 1240Assert.NotNull(ts.Catches[0].Declaration); 1241Assert.NotEqual(default, ts.Catches[0].Declaration.OpenParenToken); 1242Assert.NotNull(ts.Catches[0].Declaration.Type); 1243Assert.Equal("T", ts.Catches[0].Declaration.Type.ToString()); 1244Assert.NotEqual(default, ts.Catches[0].Declaration.Identifier); 1245Assert.Equal("e", ts.Catches[0].Declaration.Identifier.ToString()); 1246Assert.NotEqual(default, ts.Catches[0].Declaration.CloseParenToken); 1247Assert.NotNull(ts.Catches[0].Block); 1268Assert.Equal(1, ts.Catches.Count); 1269Assert.NotEqual(default, ts.Catches[0].CatchKeyword); 1270Assert.NotNull(ts.Catches[0].Declaration); 1271Assert.NotEqual(default, ts.Catches[0].Declaration.OpenParenToken); 1272Assert.NotNull(ts.Catches[0].Declaration.Type); 1273Assert.Equal("T", ts.Catches[0].Declaration.Type.ToString()); 1274Assert.Equal(SyntaxKind.None, ts.Catches[0].Declaration.Identifier.Kind()); 1275Assert.NotEqual(default, ts.Catches[0].Declaration.CloseParenToken); 1276Assert.NotNull(ts.Catches[0].Block); 1297Assert.Equal(1, ts.Catches.Count); 1298Assert.NotEqual(default, ts.Catches[0].CatchKeyword); 1299Assert.Null(ts.Catches[0].Declaration); 1300Assert.NotNull(ts.Catches[0].Block); 1321Assert.Equal(3, ts.Catches.Count); 1323Assert.NotEqual(default, ts.Catches[0].CatchKeyword); 1324Assert.NotNull(ts.Catches[0].Declaration); 1325Assert.NotEqual(default, ts.Catches[0].Declaration.OpenParenToken); 1326Assert.NotNull(ts.Catches[0].Declaration.Type); 1327Assert.Equal("T", ts.Catches[0].Declaration.Type.ToString()); 1328Assert.NotEqual(default, ts.Catches[0].Declaration.Identifier); 1329Assert.Equal("e", ts.Catches[0].Declaration.Identifier.ToString()); 1330Assert.NotEqual(default, ts.Catches[0].Declaration.CloseParenToken); 1331Assert.NotNull(ts.Catches[0].Block); 1333Assert.NotEqual(default, ts.Catches[1].CatchKeyword); 1334Assert.NotNull(ts.Catches[1].Declaration); 1335Assert.NotEqual(default, ts.Catches[1].Declaration.OpenParenToken); 1336Assert.NotNull(ts.Catches[1].Declaration.Type); 1337Assert.Equal("T2", ts.Catches[1].Declaration.Type.ToString()); 1338Assert.NotEqual(default, ts.Catches[1].Declaration.CloseParenToken); 1339Assert.NotNull(ts.Catches[1].Block); 1341Assert.NotEqual(default, ts.Catches[2].CatchKeyword); 1342Assert.Null(ts.Catches[2].Declaration); 1343Assert.NotNull(ts.Catches[2].Block); 1364Assert.Equal(0, ts.Catches.Count); 1387Assert.Equal(3, ts.Catches.Count); 1389Assert.NotEqual(default, ts.Catches[0].CatchKeyword); 1390Assert.NotNull(ts.Catches[0].Declaration); 1391Assert.NotEqual(default, ts.Catches[0].Declaration.OpenParenToken); 1392Assert.NotNull(ts.Catches[0].Declaration.Type); 1393Assert.Equal("T", ts.Catches[0].Declaration.Type.ToString()); 1394Assert.NotEqual(default, ts.Catches[0].Declaration.Identifier); 1395Assert.Equal("e", ts.Catches[0].Declaration.Identifier.ToString()); 1396Assert.NotEqual(default, ts.Catches[0].Declaration.CloseParenToken); 1397Assert.NotNull(ts.Catches[0].Block); 1399Assert.NotEqual(default, ts.Catches[1].CatchKeyword); 1400Assert.NotNull(ts.Catches[1].Declaration); 1401Assert.NotEqual(default, ts.Catches[1].Declaration.OpenParenToken); 1402Assert.NotNull(ts.Catches[1].Declaration.Type); 1403Assert.Equal("T2", ts.Catches[1].Declaration.Type.ToString()); 1404Assert.NotEqual(default, ts.Catches[1].Declaration.CloseParenToken); 1405Assert.NotNull(ts.Catches[1].Block); 1407Assert.NotEqual(default, ts.Catches[2].CatchKeyword); 1408Assert.Null(ts.Catches[2].Declaration); 1409Assert.NotNull(ts.Catches[2].Block);