-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[wasm-ep] Configure the Diagnostic Server using DOTNET_DiagnosticPorts #73011
Comments
Tagging subscribers to 'arch-wasm': @lewing Issue DetailsIn order to make diagnostics work with Blazor, we need to provide a mechanism that works with their WebAssebly startup sequence (near here: MonoPlatform.ts). Using a The other constraint is that So the task is:
|
Turns out we have to init diagnostics in two differnet places because blazor and non-blazor startup will set environment variables in two different codepaths
|
Parse it the same way that the C code does: ``` <uri>[,<connect|listen>][,<suspend|nosuspend>] ``` - uri should be a websocket uri - listen is not supported as it doesn't make sense with a WebSocket - connect is the default if omitted - suspend is the default if omitted --- Additionally, move `mono_wasm_diagnostics_init` to later in the startup flow. This gives Blazor a chance to set DOTNET_DiagnosticPorts from their `onRuntimeInitialized` callback. Fixes dotnet#73011
…73370) * [wasm-ep] Use DOTNET_DiagnosticPorts to configure Diagnostic Server Parse it the same way that the C code does: ``` <uri>[,<connect|listen>][,<suspend|nosuspend>] ``` - uri should be a websocket uri - listen is not supported as it doesn't make sense with a WebSocket - connect is the default if omitted - suspend is the default if omitted --- Additionally, move `mono_wasm_diagnostics_init` to later in the startup flow. This gives Blazor a chance to set DOTNET_DiagnosticPorts from their `onRuntimeInitialized` callback. Fixes #73011 * Initialize diagnostic server in different places for Blazor and non-Blazor It has to be after environment variables are set, but before mono_wasm_load_runtime is called. There is no good place that's common to both startup paths. Try it on both. Use a flag to make diagnostics initialization run at most once * update browser-eventpipe sample to use DOTNET_DiagnosticPorts * remove unused imports
In order to make diagnostics work with Blazor, we need to provide a mechanism that works with their WebAssebly startup sequence (near here: MonoPlatform.ts). Using a
MonoConfig
diagnostic_options
section doesn't work because they don't have this object. Additionally the current call tomono_wasm_init_diagnostics
is inmono_wasm_before_user_runtime_initialized
which is not called for Blazor.The other constraint is that
mono_wasm_init_diagnostics
is async (because it waits for the DS thread to start), so we need to call it during an async part of runtime startup.So the task is:
DOTNET_DiagnosticPorts
environment variable to configure the diagnostic server - similar to desktop. Setting it to a value likews://127.0.0.1:8088/diagnostics,connect,suspend
will cause the runtime to connect to the given WebSocket URL and suspend until a diagnostic tool sends a resume command. We will only supportconnect
, notlisten
(which is not meaningful for a websocket). We will supportsuspend
(the default) andnosuspend
DOTENT_DiagnosticPorts
from theironRuntimeInitialized
callbackawait mono_wasm_init_diagnostics()
tomono_wasm_after_user_runtime_initialized
which is async and runs afteronRuntimeInitialized
but before we call Blazor'spostRun
(which callsMONO.mono_wasm_load_runtime
which is a sync function that actually begins running our C code - ie we must have the diagnostic server running by this point)The text was updated successfully, but these errors were encountered: