Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Configuring a logpoint including variables after a breakpoint breaks the debugging session #583

Closed
sebmenard opened this issue Oct 5, 2023 · 1 comment
Assignees
Labels
area-dotnet-debugging Issues around .NET Debugging with console, ASP.NET, or Aspire bug Something isn't working
Milestone

Comments

@sebmenard
Copy link

sebmenard commented Oct 5, 2023

Describe the Issue

I wanted to configure a logpoint with interpolated variables after a breakpoint. However, when I clicked on "Step Into" several times after the breakpoint, and reached the logpoint, then the debugger would stop working.

The result of the logpoint is not displayed in the debugging console. If the logpoint is configured on a line such as Console.WriteLine(), the text passed to this method is not printed on any console (no matter if the console is configured to internalConsole or integratedTerminal in launch.json).

The debugging session can still be stopped or restarted but the bug happens again. However, at this point, it's not possible to continue clicking on "Step Into", because the debugger simply hangs.

I'm not sure if I'm posting in the right repository, but this bug does not happen on Visual Studio 2022, which makes me think it's a bug related to Visual Studio Code extensions for C#.

Steps To Reproduce

  1. Create a new C# console project. dotnet new console is fine.
  2. Replace the contents of Program.cs with the following code:
int var1 = 0;
int var2 = 0;
int var3 = 0;
int var4 = 0;

var1 += 1;
var2 += 2;
var3 += 3;
var4 += 4;

Console.WriteLine("Logpoint");

Console.WriteLine("End of code");
  1. Add a logpoint with the following content on line 2: {var1}
  2. Add a normal breakpoint on line 6.
  3. Add a logpoint with the following content on line 11: {var2}
  4. Start a debugging session. You can use F5, the Run menu, or the Run and Debug view.
  5. Notice the first logpoint displayed on the console with the value of var1 as expected (0).
  6. Click on "Step Into" several times until reaching the second logpoint on line 11.
  7. The debugging session stops working correctly at this point. The content of the logpoint is not displayed on the Debug Console, but only an empty line is. The content of Console.WriteLine() is not displayed either.
  8. Click on Step Into again. The Variables section on the left of the Run and Debug view is cleared. The Call Stack now displays an error.

Expected Behavior

The debugging session should continue after the second logpoint, displaying the value of var2 according to the logpoint and the value passed to the Console.WriteLine() method.

Changing the value of the second logpoint on line 11 to any normal text (such as Logpoint value) makes the debugging session continue normally.

Environment Information

  • OS: Windows 11
  • VS Code version: 1.83.0
  • Extension versions: C# Dev Kit 0.5.150, C# 2.5.30, IntelliCode for C# Dev Kit 0.1.26, .NET Runtime Install Tool 1.8.0
  • .NET SDK version: 7.0.401
  • .NET Runtime version: 7.0.11
@sebmenard sebmenard added the bug Something isn't working label Oct 5, 2023
@microsoft-issue-labeler microsoft-issue-labeler bot added the area-dotnet-debugging Issues around .NET Debugging with console, ASP.NET, or Aspire label Oct 5, 2023
@WardenGnaw WardenGnaw added this to the Nov2023 milestone Oct 24, 2023
@WardenGnaw WardenGnaw self-assigned this Oct 31, 2023
@WardenGnaw
Copy link
Member

This will be fixed in the next release of the C# Extension

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-dotnet-debugging Issues around .NET Debugging with console, ASP.NET, or Aspire bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants