dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.86k stars 671 forks source link

Debugger: Step to a wrong line while debugging #1289

Open ClaireKang opened 7 years ago

ClaireKang commented 7 years ago

Environment data

dotnet --info output: VS Code version: 1.10.1 C# Extension version: \scratch2\scratch\janraj\vsdbg3\csharp-1.8.0-beta1.vsix .NET Core SDK: 1.0.0-preview2-1-003177 OS: linuxmint17

Steps to reproduce

  1. Open attached folder. hwapp.zip
  2. Set the "StopAtEntry: true" on launch.json.
  3. Set bp at the line of 16 in Program.cs
  4. Press F5 to start debugging.(Cursor hit the line of 9 in Program.cs)
  5. F10
  6. F11
  7. F5(Continue).(Cursor hit the bp at the line of 16 in Program.cs)
  8. F5

Expected behavior

Stop debugging

Actual behavior

Cursor hit the bp at the line of 9 in Program.cs or others line.

Investigation

  1. This issue is unstable.
  2. Attached log file. log.txt
  3. This issue also occur on opensuse13.2.
  4. The log file only 2 lines when I collected log with adding" "args":["--engineLogging=/home/Claire/log.txt"] " on package.json. I tried to this operation on different Linux OS, and many OS only can collected 2 lines log file. Could you please help to confirm it?
gregg-miskelly commented 7 years ago

@WardenGnaw should this be resolved?

WardenGnaw commented 7 years ago

I could not reproduce the issue of stepping to the wrong line. However, I am noticing --engineLogging="" is only writing two lines.

gregg-miskelly commented 7 years ago

@WardenGnaw lets open a new bug for the log file issue

gregg-miskelly commented 7 years ago

I took a look at the log. What happened was that somehow the CLR ran the same code on two threads --

<- (E) {"seq":24,"type":"event","event":"stopped","body":{"reason":"step","threadId":14539,"allThreadsStopped":true,"source":{"name":"Program.cs","path":"/home/claire/Documents/hwapp/Program.cs"},"line":9,"column":9}}

And

<- (E) {"seq":24,"type":"event","event":"stopped","body":{"reason":"step","threadId":14542,"allThreadsStopped":true,"source":{"name":"Program.cs","path":"/home/claire/Documents/hwapp/Program.cs"},"line":9,"column":9}}

gregg-miskelly commented 7 years ago

Actually, it isn't just that which is duplicated -- almost all the commands are duplicated. So we are actually debugging two different apps. Not sure if that means that this is a VS Code bug, or a bug in vsdbg-ui that somehow we are duplicating requests. @WardenGnaw did you try OpenSUSE 13.2?

WardenGnaw commented 7 years ago

I have not tried it on OpenSUSE.

For engine logging. I'm only getting these two lines: image

gregg-miskelly commented 7 years ago

@ClaireKang can you still repro this with the 'beta2' drop? If so, is there some way we can connect to your box? If so, please email us a link.

ClaireKang commented 7 years ago

I still can repro this with the 'beta2' drop.

  1. When I done the repro steps, the debug console have already display the .dll has exited, but actually the process still running. afterstop
  2. I tried to collect log file, but it still only got 2 lines, do you need me to file a new bug?
  3. I reproduce this issue on physic machine via Hyper-v, I'm sorry that I have no ideal to share it.
WardenGnaw commented 7 years ago

I have made a fix to the engine logging issue. We will release a new vsix with the fix. Can you show me the engine logging with the new vsix?

ClaireKang commented 7 years ago

It can correctly collect log with latest extension(v1.8.0).

gregg-miskelly commented 7 years ago

Removing from 1.8 since we aren't able to repro the issue from our side, so this will need to be fixed in some later release.