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

Set noDebug flag on launch url for Blazor WASM apps #2393

Merged
merged 1 commit into from
Aug 17, 2020
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,13 @@ export class BlazorDebugConfigurationProvider implements vscode.DebugConfigurati
}

private async launchBrowser(folder: vscode.WorkspaceFolder | undefined, configuration: vscode.DebugConfiguration) {
const setNoDebugFlag = (url: string) => configuration.noDebug ? `${url}?_blazor_debug=false` : url;
const browser = {
name: JS_DEBUG_NAME,
type: configuration.browser === 'edge' ? 'pwa-msedge' : 'pwa-chrome',
request: 'launch',
timeout: configuration.timeout || 30000,
url: configuration.url || 'https://localhost:5001',
url: setNoDebugFlag(configuration.url || 'https://localhost:5001'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we don't enforce configuration.url not to have query-strings already this will break, right? If we enforce that already great, if not you might have to use a URL class/function to add the querystring in a more robust way.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change should be backwards compatible. If the query param is set but the framework doesn't contain the matching updates, then the flag will no-op.

If it is not set and the framework is updated then it defaults to true.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I meant that if configuration.url = 'https://localhost:5001?somequeryString=stuff' then this new function does url:${configuration.url}?_blazor_debug=false`` then we end up with https://localhost:5001?somequeryString=stuff?_blazor_debug=false, which would result in some weird querystrings.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see. We decided to keep the logic simple here. We don't anticipate that a lot of people will be launching with custom query strings. If they are, it's fairly easy to work around (e.g., edit the URL)/

webRoot: configuration.webRoot || '${workspaceFolder}',
inspectUri: '{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}',
trace: configuration.trace || false,
Expand Down