Skip to content

Fixed devtools url used for debug with chrome and edge #61813

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
May 15, 2025
Merged
Changes from 4 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
25 changes: 24 additions & 1 deletion src/Components/WebAssembly/Server/src/TargetPickerUi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using System.Text.Json;
using System.Text.Json.Serialization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Extensions;
using System.Dynamic;

namespace Microsoft.AspNetCore.Components.WebAssembly.Server;
Expand Down Expand Up @@ -366,9 +367,31 @@
{
var underlyingV8Endpoint = new Uri(tabToDebug.WebSocketDebuggerUrl);
var proxyEndpoint = new Uri(_debugProxyUrl);
var devToolsUrlAbsolute = new Uri(_browserHost + tabToDebug.DevtoolsFrontendUrl);
var devToolsUrlAbsolute = new Uri(new Uri(_browserHost), relativeUri: NormalizeDevtoolsFrontendUrl(tabToDebug.DevtoolsFrontendUrl));
var devToolsUrlWithProxy = $"{devToolsUrlAbsolute.Scheme}://{devToolsUrlAbsolute.Authority}{devToolsUrlAbsolute.AbsolutePath}?{underlyingV8Endpoint.Scheme}={proxyEndpoint.Authority}{underlyingV8Endpoint.PathAndQuery}";
return devToolsUrlWithProxy;

static string NormalizeDevtoolsFrontendUrl(string devtoolsFrontendUrl)
{
// Currently frontend url can be:
// - absolute (since v135 of chrome and edge)
// chrome example: https://chrome-devtools-frontend.appspot.com/serve_rev/@031848bc6ad02b97854f3d6154d3aefd0434756a/inspector.html?ws=localhost:9222/devtools/page/719FE9D3B43570193235446E0AB36859
// edge example: https://aka.ms/docs-landing-page/serve_rev/@4e2c41645f24197463afa2ab6aa999352ee8255c/inspector.html?ws=localhost:9222/devtools/page/3A4D56E09776321628432588FC9299F4
// - relative (managed as fallback for brosers with prior version)
// example: /devtools/inspector.html?ws=localhost:9222/devtools/page/DAB7FB6187B554E10B0BD18821265734
// The absolute url can't be used as-is because is not valid for debugging and cannot be made relative because of lack "devtools" segment
// before "inspector.html" but we can keep the query string and append to the default "devtools/inspector.html" browser devtools page

const string DefaultBrowserDevToolsPagePath = "devtools/inspector.html";

if (devtoolsFrontendUrl.AsSpan().TrimStart('/').StartsWith(DefaultBrowserDevToolsPagePath))
{
return devtoolsFrontendUrl;
}

UriHelper.FromAbsolute(url, out _, out _, out _, out var query, out _);

Check failure on line 392 in src/Components/WebAssembly/Server/src/TargetPickerUi.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux x64)

src/Components/WebAssembly/Server/src/TargetPickerUi.cs#L392

src/Components/WebAssembly/Server/src/TargetPickerUi.cs(392,36): error CS0103: (NETCORE_ENGINEERING_TELEMETRY=Build) The name 'url' does not exist in the current context

Check failure on line 392 in src/Components/WebAssembly/Server/src/TargetPickerUi.cs

View check run for this annotation

Azure Pipelines / aspnetcore-quarantined-pr (Tests: macOS)

src/Components/WebAssembly/Server/src/TargetPickerUi.cs#L392

src/Components/WebAssembly/Server/src/TargetPickerUi.cs(392,36): error CS0103: (NETCORE_ENGINEERING_TELEMETRY=Build) The name 'url' does not exist in the current context

Check failure on line 392 in src/Components/WebAssembly/Server/src/TargetPickerUi.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux ARM64)

src/Components/WebAssembly/Server/src/TargetPickerUi.cs#L392

src/Components/WebAssembly/Server/src/TargetPickerUi.cs(392,36): error CS0103: (NETCORE_ENGINEERING_TELEMETRY=Build) The name 'url' does not exist in the current context

Check failure on line 392 in src/Components/WebAssembly/Server/src/TargetPickerUi.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux Musl ARM)

src/Components/WebAssembly/Server/src/TargetPickerUi.cs#L392

src/Components/WebAssembly/Server/src/TargetPickerUi.cs(392,36): error CS0103: (NETCORE_ENGINEERING_TELEMETRY=Build) The name 'url' does not exist in the current context

Check failure on line 392 in src/Components/WebAssembly/Server/src/TargetPickerUi.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux Musl ARM64)

src/Components/WebAssembly/Server/src/TargetPickerUi.cs#L392

src/Components/WebAssembly/Server/src/TargetPickerUi.cs(392,36): error CS0103: (NETCORE_ENGINEERING_TELEMETRY=Build) The name 'url' does not exist in the current context

Check failure on line 392 in src/Components/WebAssembly/Server/src/TargetPickerUi.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux Musl x64)

src/Components/WebAssembly/Server/src/TargetPickerUi.cs#L392

src/Components/WebAssembly/Server/src/TargetPickerUi.cs(392,36): error CS0103: (NETCORE_ENGINEERING_TELEMETRY=Build) The name 'url' does not exist in the current context

Check failure on line 392 in src/Components/WebAssembly/Server/src/TargetPickerUi.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux ARM)

src/Components/WebAssembly/Server/src/TargetPickerUi.cs#L392

src/Components/WebAssembly/Server/src/TargetPickerUi.cs(392,36): error CS0103: (NETCORE_ENGINEERING_TELEMETRY=Build) The name 'url' does not exist in the current context

Check failure on line 392 in src/Components/WebAssembly/Server/src/TargetPickerUi.cs

View check run for this annotation

Azure Pipelines / aspnetcore-quarantined-pr (Tests: Ubuntu x64)

src/Components/WebAssembly/Server/src/TargetPickerUi.cs#L392

src/Components/WebAssembly/Server/src/TargetPickerUi.cs(392,36): error CS0103: (NETCORE_ENGINEERING_TELEMETRY=Build) The name 'url' does not exist in the current context

Check failure on line 392 in src/Components/WebAssembly/Server/src/TargetPickerUi.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Test: Ubuntu x64)

src/Components/WebAssembly/Server/src/TargetPickerUi.cs#L392

src/Components/WebAssembly/Server/src/TargetPickerUi.cs(392,36): error CS0103: (NETCORE_ENGINEERING_TELEMETRY=Build) The name 'url' does not exist in the current context

Check failure on line 392 in src/Components/WebAssembly/Server/src/TargetPickerUi.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: macOS arm64)

src/Components/WebAssembly/Server/src/TargetPickerUi.cs#L392

src/Components/WebAssembly/Server/src/TargetPickerUi.cs(392,36): error CS0103: (NETCORE_ENGINEERING_TELEMETRY=Build) The name 'url' does not exist in the current context

Check failure on line 392 in src/Components/WebAssembly/Server/src/TargetPickerUi.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: macOS x64)

src/Components/WebAssembly/Server/src/TargetPickerUi.cs#L392

src/Components/WebAssembly/Server/src/TargetPickerUi.cs(392,36): error CS0103: (NETCORE_ENGINEERING_TELEMETRY=Build) The name 'url' does not exist in the current context

Check failure on line 392 in src/Components/WebAssembly/Server/src/TargetPickerUi.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Test: macOS)

src/Components/WebAssembly/Server/src/TargetPickerUi.cs#L392

src/Components/WebAssembly/Server/src/TargetPickerUi.cs(392,36): error CS0103: (NETCORE_ENGINEERING_TELEMETRY=Build) The name 'url' does not exist in the current context

Check failure on line 392 in src/Components/WebAssembly/Server/src/TargetPickerUi.cs

View check run for this annotation

Azure Pipelines / aspnetcore-quarantined-pr

src/Components/WebAssembly/Server/src/TargetPickerUi.cs#L392

src/Components/WebAssembly/Server/src/TargetPickerUi.cs(392,36): error CS0103: (NETCORE_ENGINEERING_TELEMETRY=Build) The name 'url' does not exist in the current context

Check failure on line 392 in src/Components/WebAssembly/Server/src/TargetPickerUi.cs

View check run for this annotation

Azure Pipelines / aspnetcore-quarantined-pr

src/Components/WebAssembly/Server/src/TargetPickerUi.cs#L392

src/Components/WebAssembly/Server/src/TargetPickerUi.cs(392,36): error CS0103: (NETCORE_ENGINEERING_TELEMETRY=Build) The name 'url' does not exist in the current context

Check failure on line 392 in src/Components/WebAssembly/Server/src/TargetPickerUi.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci

src/Components/WebAssembly/Server/src/TargetPickerUi.cs#L392

src/Components/WebAssembly/Server/src/TargetPickerUi.cs(392,36): error CS0103: (NETCORE_ENGINEERING_TELEMETRY=Build) The name 'url' does not exist in the current context

Check failure on line 392 in src/Components/WebAssembly/Server/src/TargetPickerUi.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci

src/Components/WebAssembly/Server/src/TargetPickerUi.cs#L392

src/Components/WebAssembly/Server/src/TargetPickerUi.cs(392,36): error CS0103: (NETCORE_ENGINEERING_TELEMETRY=Build) The name 'url' does not exist in the current context

Check failure on line 392 in src/Components/WebAssembly/Server/src/TargetPickerUi.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci

src/Components/WebAssembly/Server/src/TargetPickerUi.cs#L392

src/Components/WebAssembly/Server/src/TargetPickerUi.cs(392,36): error CS0103: (NETCORE_ENGINEERING_TELEMETRY=Build) The name 'url' does not exist in the current context

Check failure on line 392 in src/Components/WebAssembly/Server/src/TargetPickerUi.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci

src/Components/WebAssembly/Server/src/TargetPickerUi.cs#L392

src/Components/WebAssembly/Server/src/TargetPickerUi.cs(392,36): error CS0103: (NETCORE_ENGINEERING_TELEMETRY=Build) The name 'url' does not exist in the current context
return $"{DefaultBrowserDevToolsPagePath}{query}";
}
}

private string GetLaunchChromeInstructions(string targetApplicationUrl)
Expand Down
Loading