microsoft / microsoft/vscode-mock-debug

Normal breakpoints don't get hit util exception line gets hit.

Open
#94 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
358
Forks
200
Avg merge
24d 23h
Merged PRs (30d)
1

Description

I downloaded the repo,and launched the code without changing any lines,and the workspace stops at the top line ("# VS Code Mock Debug") normally,and I set the a breakpoint at line 3,then continue,but the execution doesn't stop at line 3.
I dive into the code,and see the possible reasons to cause this:
In MockRuntime class,there's a method called findNextStatement:

 */
	 private findNextStatement(reverse: boolean, stepEvent?: string): boolean {

		for (let ln = this.currentLine; reverse ? ln >= 0 : ln < this.sourceLines.length; reverse ? ln-- : ln++) {

			// is there a source breakpoint?
			const breakpoints = this.breakPoints.get(this._sourceFile);
			if (breakpoints) {
				const bps = breakpoints.filter(bp => bp.line === ln);
                        ...
                        }
                   ...
              }
       }

The breakpoints will be undefined,cuz this.breakpoints holds an entry, the key of which is "c:/Code Repository/vscode-mock-debug/sampleWorkspace/readme.md",
but the _sourceFile is "C:/Code Repository/vscode-mock-debug/sampleWorkspace/readme.md" now,see what's different?
the previous one starts with a lowercase drive volume while another starts with a uppercase one,and please note that I have a space char in my workspace path.
Platform:Windows
VSCodeVersion:1.76.2

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in the MockRuntime.findNextStatement method and reproduce the breakpoint behavior on Windows with a workspace path containing a space. Inspect how the breakpoint map key and _sourceFile path are produced and compared; done means a normal breakpoint at line 3 is hit without requiring the exception line.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.