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

Draft
wants to merge 25 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 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
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 .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/**
24 changes: 23 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",
"description": "VSWebAssemblyBridge (Platform Agnostic)",
"url": "https://vsdebugger.blob.core.windows.net/vswebassemblybridge-9-0-637901/vswebassemblybridge.zip",
"installPath": ".vswebassemblybridge",
"platforms": [
"win32",
"linux",
"darwin"
],
"architectures": [
"x86",
"x86_64",
"arm64"
],
"integrity": "4C4B641AF5F8EFC975EB26D71A6DB052DDF2E3AF3AA263FC660C65F0B7044DDD"
}
],
"engines": {
Expand Down Expand Up @@ -1204,6 +1221,11 @@
"description": "%generateOptionsSchema.expressionEvaluationOptions.showRawValues.description%",
"default": false
},
"csharp.wasm.debug.useVSDbg": {
"type": "boolean",
"description": "%generateOptionsSchema.useVSDbg.description%",
"default": false
},
"dotnet.unitTestDebuggingOptions": {
"type": "object",
"description": "%configuration.dotnet.unitTestDebuggingOptions%",
Expand Down Expand Up @@ -5645,4 +5667,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
6 changes: 0 additions & 6 deletions src/coreclrDebug/activate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,6 @@ 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));
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') {
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
4 changes: 4 additions & 0 deletions src/lsptoolshost/debugger/debugger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ export function registerDebugger(
vscode.debug.registerDebugConfigurationProvider('coreclr', dotnetWorkspaceConfigurationProvider)
);

context.subscriptions.push(
vscode.debug.registerDebugConfigurationProvider('monovsdbg', 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
)
);
}
5 changes: 3 additions & 2 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 Expand Up @@ -154,7 +155,7 @@ export async function activate(
eventStream,
csharpChannel,
reporter,
getCoreClrDebugPromise
getCoreClrDebugPromise,
);
}
}
Expand All @@ -169,4 +170,4 @@ export async function activate(
reporter.sendTelemetryEvent(activationEvent, activationProperties);

return exports;
}
}
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