Skip to content

Adding changes to support use monovsdbg to debug wasm apps. #7220

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

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
1f4d94e
Adding changes to support use monovsdbg to debug wasm apps.
thaystg Jun 10, 2024
d7f8606
Adding VSWebAssemblyPackage.
thaystg Jun 13, 2024
cfb2d67
Addressing Gregg's comments
thaystg Jun 18, 2024
d59699b
Fixing prettier
thaystg Jun 18, 2024
981c74b
Fixing package.json
thaystg Jun 18, 2024
0bc4ca2
Merge branch 'main' into dev/thays/support_wasm_monovsdbg
thaystg Jun 18, 2024
c4d88dc
Adding vswebassembly to gitignore
thaystg Jun 18, 2024
d3b8441
Test if the vswebassembly path exists and also pass DOTNET_MODIFIABLE…
thaystg Jun 19, 2024
b094acf
Fix prettier
thaystg Jun 19, 2024
4796772
Bump VSWebAssemblyBridge.
thaystg Jun 20, 2024
83de7bb
Check targetFramework before enable it.
thaystg Jun 21, 2024
e2802c1
Merge branch 'dev/thays/support_wasm_monovsdbg' of github.com:thaystg…
thaystg Jun 21, 2024
d6fd0b6
Addressing Gregg's comments.
thaystg Jul 1, 2024
04b4c77
Renaming function.
thaystg Jul 1, 2024
a5452a8
Addressing Gregg's comments.
thaystg Jul 2, 2024
2b1ee0d
Merge branch 'main' into dev/thays/support_wasm_monovsdbg
thaystg Jul 2, 2024
e06f914
Addressing Gregg's comments.
thaystg Jul 8, 2024
4e70917
Merge branch 'main' into dev/thays/support_wasm_monovsdbg
thaystg Jul 8, 2024
9dfa93c
Addressing Gregg's suggestion.
thaystg Jul 10, 2024
c12e04b
Merge branch 'main' into dev/thays/support_wasm_monovsdbg
thaystg Jul 29, 2025
b6a67c0
fix vswebassembly version
thaystg Jul 29, 2025
7e49904
Merge branch 'main' into dev/thays/support_wasm_monovsdbg
thaystg Jul 29, 2025
4163249
Fixing merge
thaystg Jul 29, 2025
4f86d19
fix compilation
thaystg Jul 29, 2025
bcb7bdd
Merge branch 'main' into dev/thays/support_wasm_monovsdbg
thaystg Jul 29, 2025
d9176bd
Last adjust to support wasm debugger with icordebug on vscode-csharp
thaystg Aug 1, 2025
8fd232c
fix eslint errors and adding .gitignore.
thaystg Aug 5, 2025
f4c236e
Bump vswebassemblybridge
thaystg Aug 8, 2025
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ coverage/

\.DS_Store
vsix/
.vswebassemblybridge/
1 change: 1 addition & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,4 @@ esbuild.js

+RuntimeLicenses/dependencies/*
coreclr-debug/install.log
!.vswebassemblybridge/**
34 changes: 33 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,23 @@
"binaries": [
"./rzls"
]
},
{
"id": "VSWebAssemblyBridge",
Copy link
Contributor

Choose a reason for hiding this comment

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

id

Should this be added here so you can use the update dependencies script?

"description": "VSWebAssemblyBridge (Platform Agnostic)",
"url": "https://vsdebugger.blob.core.windows.net/vswebassemblybridge-9-0-640601/vswebassemblybridge.zip",
"installPath": ".vswebassemblybridge",
"platforms": [
"win32",
"linux",
"darwin"
],
"architectures": [
"x86",
"x86_64",
"arm64"
],
"integrity": "2D3BA529626307448281E719BC3182E09475A4571741E08AFA401579E8895AFA"
}
],
"engines": {
Expand All @@ -718,6 +735,7 @@
"onDebugResolve:coreclr",
"onDebugResolve:clr",
"onDebugResolve:monovsdbg",
"onDebugResolve:monovsdbg_wasm",
"onDebugResolve:dotnet",
"onLanguage:csharp",
"onCommand:o.showOutput",
Expand Down Expand Up @@ -1204,6 +1222,11 @@
"description": "%generateOptionsSchema.expressionEvaluationOptions.showRawValues.description%",
"default": false
},
"csharp.wasm.debug.useVSDbg": {
"type": "boolean",
"description": "%generateOptionsSchema.useVSDbg.description%",
"default": true
},
"dotnet.unitTestDebuggingOptions": {
"type": "object",
"description": "%configuration.dotnet.unitTestDebuggingOptions%",
Expand Down Expand Up @@ -4811,6 +4834,15 @@
"csharp"
],
"aiKey": "0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255"
},
{
"type": "monovsdbg_wasm",
"label": ".NET Core using Mono Runtime",
"hiddenWhen": "true",
"languages": [
"csharp"
],
"aiKey": "0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255"
}
],
"semanticTokenTypes": [
Expand Down Expand Up @@ -5645,4 +5677,4 @@
}
}
}
}
}
5 changes: 3 additions & 2 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -499,5 +499,6 @@
"comment": [
"Markdown text between `` should not be translated or localized (they represent literal text) and the capitalization, spacing, and punctuation (including the ``) should not be altered."
]
}
}
},
"generateOptionsSchema.useVSDbg.description": "Enable new .NET 9+ Wasm Debugger (preview)"
}
1 change: 1 addition & 0 deletions src/activateRoslyn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export function activateRoslyn(
getComponentFolder: (componentName) => {
return getComponentFolder(componentName, languageServerOptions);
},
tryToUseVSDbgForMono: BlazorDebugConfigurationProvider.tryToUseVSDbgForMono,
};

return exports;
Expand Down
7 changes: 1 addition & 6 deletions src/coreclrDebug/activate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,10 @@ export async function activate(
new BaseVsDbgConfigurationProvider(platformInformation, csharpOutputChannel)
)
);
context.subscriptions.push(
vscode.debug.registerDebugConfigurationProvider(
'monovsdbg',
new BaseVsDbgConfigurationProvider(platformInformation, csharpOutputChannel)
)
);
disposables.add(vscode.debug.registerDebugAdapterDescriptorFactory('coreclr', factory));
disposables.add(vscode.debug.registerDebugAdapterDescriptorFactory('clr', factory));
disposables.add(vscode.debug.registerDebugAdapterDescriptorFactory('monovsdbg', factory));
disposables.add(vscode.debug.registerDebugAdapterDescriptorFactory('monovsdbg_wasm', factory));

context.subscriptions.push(disposables);
}
Expand Down
14 changes: 13 additions & 1 deletion src/coreclrDebug/provisionalDebugSessionTracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class ProvisionalDebugSessionTracker {
* @param session Debug session.
*/
onDidStartDebugSession(session: vscode.DebugSession): void {
if (session.type !== 'coreclr') {
if (session.type !== 'coreclr' && session.type !== 'monovsdbg' && session.type !== 'monovsdbg_wasm') {
return;
}

Expand Down Expand Up @@ -88,6 +88,18 @@ export class ProvisionalDebugSessionTracker {
this._onDidStartDebugSession?.dispose();
this._onDidTerminateDebugSession?.dispose();
}
getDebugSessionByType(type: string): vscode.DebugSession | undefined {
const sessions = this._sessions;
if (sessions != undefined) {
const sessionsIt = sessions.entries();
for (const session of sessionsIt) {
if (session[0].type == type) {
return session[0];
}
}
}
return undefined;
}
}

export const debugSessionTracker = new ProvisionalDebugSessionTracker();
1 change: 1 addition & 0 deletions src/csharpExtensionExports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export interface CSharpExtensionExports {
determineBrowserType: () => Promise<string | undefined>;
experimental: CSharpExtensionExperimentalExports;
getComponentFolder: (componentName: string) => string;
tryToUseVSDbgForMono: (urlStr: string, projectPath: string) => Promise<[string, number, number]>;
}

export interface CSharpExtensionExperimentalExports {
Expand Down
8 changes: 8 additions & 0 deletions src/lsptoolshost/debugger/debugger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ export function registerDebugger(
vscode.debug.registerDebugConfigurationProvider('coreclr', dotnetWorkspaceConfigurationProvider)
);

context.subscriptions.push(
vscode.debug.registerDebugConfigurationProvider('monovsdbg', dotnetWorkspaceConfigurationProvider)
);

context.subscriptions.push(
vscode.debug.registerDebugConfigurationProvider('monovsdbg_wasm', dotnetWorkspaceConfigurationProvider)
);

context.subscriptions.push(
vscode.commands.registerCommand('dotnet.generateAssets', async (selectedIndex) => {
if (!(await promptForDevKitDebugConfigurations())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class RoslynWorkspaceDebugInformationProvider implements IWorkspaceDebugI

// LSP serializes and deserializes URIs as (URI formatted) strings not actual types. So convert to the actual type here.
const projects: ProjectDebugInformation[] | undefined = await mapAsync(response, async (p) => {
const webProject = isWebProject(p.projectPath);
const [webProject, webAssemblyProject] = isWebProject(p.projectPath);
const webAssemblyBlazor = await isBlazorWebAssemblyProject(p.projectPath);
return {
projectPath: p.projectPath,
Expand All @@ -58,6 +58,7 @@ export class RoslynWorkspaceDebugInformationProvider implements IWorkspaceDebugI
targetsDotnetCore: p.targetsDotnetCore,
isExe: p.isExe,
isWebProject: webProject,
isWebAssemblyProject: webAssemblyProject,
isBlazorWebAssemblyHosted: isBlazorWebAssemblyHosted(
p.isExe,
webProject,
Expand Down
12 changes: 12 additions & 0 deletions src/lsptoolshost/solutionSnapshot/descriptors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,16 @@ export default class Descriptors {
protocolMajorVersion: 3,
}
);

/**
* The descriptor for token acquisition service that is hosted within the VS Code Extension Host process.
* Use {@link IQueryExecutionService} for the RPC interface.
*/
static readonly projectQueryExecutionService: ServiceRpcDescriptor = Object.freeze(
new ServiceJsonRpcDescriptor(
ServiceMoniker.create('Microsoft.VisualStudio.ProjectSystem.Query.Remoting.QueryExecutionService', '0.2'),
Formatters.Utf8,
MessageDelimiters.HttpLikeHeaders
)
);
}
1 change: 1 addition & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export async function activate(
if (useOmnisharpServer) {
requiredPackageIds.push('OmniSharp');
}
requiredPackageIds.push('VSWebAssemblyBridge');
if (csharpDevkitExtension) {
requiredPackageIds.push('RoslynCopilot');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export class OmnisharpWorkspaceDebugInformationProvider implements IWorkspaceDeb
isWebProject: p.IsWebProject,
isBlazorWebAssemblyHosted: p.IsBlazorWebAssemblyHosted,
isBlazorWebAssemblyStandalone: p.IsBlazorWebAssemblyStandalone,
isWebAssemblyProject: p.IsWebAssemblyProject,
solutionPath: null,
};
});
Expand Down
1 change: 1 addition & 0 deletions src/omnisharp/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ export interface MSBuildProject {
IsWebProject: boolean;
IsBlazorWebAssemblyStandalone: boolean;
IsBlazorWebAssemblyHosted: boolean;
IsWebAssemblyProject: boolean;
}

export interface TargetFramework {
Expand Down
3 changes: 1 addition & 2 deletions src/omnisharp/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,7 @@ export async function requestWorkspaceInformation(server: OmniSharpServer) {
const response = await server.makeRequest<protocol.WorkspaceInformationResponse>(protocol.Requests.Projects);
if (response.MsBuild && response.MsBuild.Projects) {
for (const project of response.MsBuild.Projects) {
project.IsWebProject = isWebProject(project.Path);

[project.IsWebProject, project.IsWebAssemblyProject] = isWebProject(project.Path);
const isProjectBlazorWebAssemblyProject = await isBlazorWebAssemblyProject(project.Path);

const targetsDotnetCore =
Expand Down
Loading
Loading