-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Description
This issue has been moved from a ticket on Developer Community.
[severity:It’s more difficult to complete my work]
Repro steps:
- Create the following VB program:
Public Module Module1
Public Sub Main()
Console.WriteLine("A")
If Math.Abs(1) = 1 Then Return
Console.WriteLine("B")
End Sub
End Module
Note that this program outputs “A”.
- Select the first two lines inside Sub Main and use the “Extract Method” refactoring tooltip. This creates the following program:
Public Module Module1
Public Sub Main()
NewMethod()
Console.WriteLine("B")
End Sub
Private Sub NewMethod()
Console.WriteLine("A")
If Math.Abs(1) = 1 Then Return
End Sub
End Module
Expected result: The new program behaves exactly like the old program.
Actual result: The new program outputs both “A” and “B”.
This is a bug, since the “extract method” refactoring should not change the behavior of the program. It seems to be a VB. NET-only issue, since the same refactoring works fine in the equivalent C# code (creating a method that returns a “flowControl” bool).
Original Comments
Feedback Bot on 11/11/2025, 01:39 PM:
We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.
Muhammad Nabil Fikri Adenan (Centific Technologies Inc) [MSFT] on 11/12/2025, 01:10 PM:
Thanks for your sharing the detail steps, I can reproduce this issue through your shared steps and this issue has been escalated for further investigation, if there is any process, I will inform you immediately.