Skip to content

Fix adding a breakpoint in a JS file while debugging a blazor app #1488

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

Merged
merged 5 commits into from
Dec 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/targets/browser/blazorSourcePathResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ export class BlazorSourcePathResolver extends BrowserSourcePathResolver {
// Blazor files have a file:/// url. Override the default absolutePathToUrlRegexp which returns an http based regexp
const fileUrl = utils.absolutePathToFileUrl(absolutePath);
const fileRegexp = utils.urlToRegex(fileUrl);
const fileRegexpSuper = super.absolutePathToUrlRegexp(absolutePath);
if (!fileRegexp.includes(fileRegexpSuper)) return `${fileRegexp}|${fileRegexpSuper}`;
return fileRegexp;
}

Expand Down
3 changes: 2 additions & 1 deletion src/test/browser/blazorSourcePathResolverTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ describe('BlazorSourcePathResolver.absolutePathToUrlRegexp', () => {
if (getCaseSensitivePaths()) {
expect(regexp).to.equal(
'file:\\/\\/\\/c\\/Users\\/digeff\\/source\\/repos\\/MyBlazorApp\\/MyBlazorApp\\/Pages\\/Counter\\.razor($|\\?)' +
'|\\/c\\/Users\\/digeff\\/source\\/repos\\/MyBlazorApp\\/MyBlazorApp\\/Pages\\/Counter\\.razor($|\\?)',
'|\\/c\\/Users\\/digeff\\/source\\/repos\\/MyBlazorApp\\/MyBlazorApp\\/Pages\\/Counter\\.razor($|\\?)' +
'|http:\\/\\/localhost:1234\\/\\.\\.\\/\\.\\.\\/\\.\\.\\/\\.\\.\\/\\.\\.\\/\\.\\.\\/\\.\\.\\/c\\/Users\\/digeff\\/source\\/repos\\/MyBlazorApp/MyBlazorApp/Pages/Counter.razor($|\\?)',
);
} else {
// This regexp was generated from running the real scenario, verifying that the breakpoint with this regexp works, and then copying it here
Expand Down