提交 6102fdf1 编写于 作者: W Wonseok Chae

Merge pull request #1988 from wschae/watson1087305

Fix UnreachableException during Debugging

When computing the distance between blocks for EnC, there was a missing case for LabeledStatement, causing UnreachableException. This PR fixes this issue.
......@@ -3136,6 +3136,42 @@ public void MethodUpdate_Iterator_YieldBreak()
VerifyPreserveLocalVariables(edits, preserveLocalVariables: true);
}
[WorkItem(1087305)]
[Fact]
public void MethodUpdate_LabeledStatement()
{
string src1 = @"
class C
{
static void Main(string[] args)
{
goto Label1;
Label1:
{
Console.WriteLine(1);
}
}
}";
string src2 = @"
class C
{
static void Main(string[] args)
{
goto Label1;
Label1:
{
Console.WriteLine(2);
}
}
}";
var edits = GetTopEdits(src1, src2);
edits.VerifyRudeDiagnostics();
}
#endregion
#region Operators
......
......@@ -767,6 +767,7 @@ private bool TryComputeWeightedDistance(BlockSyntax leftBlock, BlockSyntax right
return true;
case SyntaxKind.Block:
case SyntaxKind.LabeledStatement:
distance = ComputeWeightedBlockDistance(leftBlock, rightBlock);
return true;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册