roslyn: ITryOperation.Finally.Syntax returns BlockSyntax instead of FinallyClauseSyntax
Version Used: Microsoft.CodeAnalysis v2.8.0
Steps to Reproduce:
- Obtain
ITryOperation
for the nexttry
statement:
try
{
}
catch (System.Exception ex)
{
}
finally
{
}
- Inspect its
.Finally.Syntax
property - This returns a
BlockSyntax
, whose.Parent
returnsFinallyClauseSyntax
Expected Behavior:
ITryOperation.Finally.Syntax
points to a FinallyClauseSyntax
, similar to how ITryOperation.Syntax
points to a TryStatementSyntax
instead of its block.
Actual Behavior:
ITryOperation.Finally.Syntax
points to a BlockSyntax
.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 27 (27 by maintainers)
Filed https://github.com/dotnet/roslyn/issues/28097
IBranchOperation.Target points the the destination label symbol. ILoopOperation now exposes the break and continue label symbols and ISwitchOperation exposes an exit lable, so you should be able to match the branches with parent loop/switch if desired. I filed https://github.com/dotnet/roslyn/issues/28095 to track this request.
@bkoelman CFG work merged into the dev15.8-preview3 branch yesterday, and should make it into master sometime today. I would also definitely encourage opening issue(s) for anything we’re not yet tracking. A lot of our initial design for IOperation and CFG was driven by the idea that we’d come back and add convenience APIs for things in a community-driven manner, as we had a limited time budget for V1. So your feedback is very important for shaping the future direction of the API.