Skip to content

[wasm][debugger] Check client version to send debugger message #89025

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 4 commits into from
Jul 17, 2023

Conversation

thaystg
Copy link
Member

@thaystg thaystg commented Jul 17, 2023

PR #86982 changed the response format for the MDBGPROT_CMD_GET_ASSEMBLY_BYTES in the debugger-agent, to send only the asm metadata instead of the full assembly contents.

But the PR missed adding appropriate version checks for the new format to keep backward compatibility. And this broke when a older proxy which didn't understand the new format was used with the updated runtime.

      Failed to load https://localhost:7284/_framework/Microsoft.AspNetCore.Authorization.wasm (Stream does not contain a valid Webcil file) (stack=   at Microsoft.NET.WebAssembly.Webcil.WebcilReader..ctor(Stream stream)
         at Microsoft.WebAssembly.Diagnostics.AssemblyInfo.FromBytes(MonoProxy monoProxy, SessionId sessionId, Byte[] assembly, Byte[] pdb, ILogger logger, CancellationToken token)
         at Microsoft.WebAssembly.Diagnostics.DebugStore.Load(SessionId id, String[] loaded_files, ExecutionContext context, Boolean useDebuggerProtocol, CancellationToken token)+MoveNext())

With this change I'm adding the needed version guards when sending the response. And bumping the BrowserDebugProxy version, so it can correctly get the newer format response.

Fixes https://github.com/aspnet/AspNetCore-ManualTests/issues/2236

@ghost ghost added the area-Debugger-mono label Jul 17, 2023
@ghost ghost assigned thaystg Jul 17, 2023
@ghost
Copy link

ghost commented Jul 17, 2023

Tagging subscribers to this area: @thaystg
See info in area-owners.md if you want to be subscribed.

Issue Details

Checking that BrowserDebugProxy is waiting for this new format to avoid incompatibility

Author: thaystg
Assignees: -
Labels:

area-Debugger-mono

Milestone: -

@thaystg thaystg requested a review from lewing July 17, 2023 16:22
@radical
Copy link
Member

radical commented Jul 17, 2023

Could you please explain what was the issue here? And how it is being fixed?

@thaystg
Copy link
Member Author

thaystg commented Jul 17, 2023

Could you please explain what was the issue here? And how it is being fixed?

Runtime has a newer version and BrowserDebugProxy is older, then runtime was sending a different message format and BrowserDebugProxy was crashing.
With this change I'm bumping the BrowserDebugProxy version and checking the BrowserDebugProxy version on runtime side to decide the message format before send it.

@radical
Copy link
Member

radical commented Jul 17, 2023

Could you please explain what was the issue here? And how it is being fixed?

Runtime has a newer version and BrowserDebugProxy is older, then runtime was sending a different message format and BrowserDebugProxy was crashing. With this change I'm bumping the BrowserDebugProxy version and checking the BrowserDebugProxy version on runtime side to decide the message format before send it.

Could you please add that to the PR description?

@radical radical added the arch-wasm WebAssembly architecture label Jul 17, 2023
@ghost
Copy link

ghost commented Jul 17, 2023

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

PR #86982 changed the response format for the MDBGPROT_CMD_GET_ASSEMBLY_BYTES in the debugger-agent, to send only the asm metadata instead of the full assembly contents.

But the PR missed adding appropriate version checks for the new format to keep backward compatibility. And this broke when a older proxy which didn't understand the new format was used with the updated runtime.

      Failed to load https://localhost:7284/_framework/Microsoft.AspNetCore.Authorization.wasm (Stream does not contain a valid Webcil file) (stack=   at Microsoft.NET.WebAssembly.Webcil.WebcilReader..ctor(Stream stream)
         at Microsoft.WebAssembly.Diagnostics.AssemblyInfo.FromBytes(MonoProxy monoProxy, SessionId sessionId, Byte[] assembly, Byte[] pdb, ILogger logger, CancellationToken token)
         at Microsoft.WebAssembly.Diagnostics.DebugStore.Load(SessionId id, String[] loaded_files, ExecutionContext context, Boolean useDebuggerProtocol, CancellationToken token)+MoveNext())

With this change I'm adding the needed version guards when sending the response. And bumping the BrowserDebugProxy version, so it can correctly get the newer format response.

Fixes https://github.com/aspnet/AspNetCore-ManualTests/issues/2236

Author: thaystg
Assignees: thaystg
Labels:

arch-wasm, area-Debugger-mono

Milestone: -

@lewing lewing merged commit 58bca2c into dotnet:main Jul 17, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Aug 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-Debugger-mono
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants