Skip to content
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

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

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,4 @@ webpack.config.js

+RuntimeLicenses/dependencies/*
coreclr-debug/install.log
!.vswebassemblybridge/**
4 changes: 3 additions & 1 deletion omnisharptest/omnisharpUnitTests/assets.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,8 @@ function createMSBuildWorkspaceInformation(
isExe = true,
isWebProject = false,
isBlazorWebAssemblyStandalone = false,
isBlazorWebAssemblyHosted = false
isBlazorWebAssemblyHosted = false,
isWebAssemblyProject = false
): ProjectDebugInformation[] {
return [
{
Expand All @@ -525,6 +526,7 @@ function createMSBuildWorkspaceInformation(
isWebProject: isWebProject,
isBlazorWebAssemblyHosted: isBlazorWebAssemblyHosted,
isBlazorWebAssemblyStandalone: isBlazorWebAssemblyStandalone,
isWebAssemblyProject: isWebAssemblyProject,
},
];
}
24 changes: 23 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,23 @@
"binaries": [
"./rzls"
]
},
{
"id": "VSWebAssemblyBridge",
"description": "VSWebAssemblyBridge (Platform Agnostic)",
"url": "https://vsdebugger.blob.core.windows.net/vswebassemblybridge-8-0-532005/vswebassemblybridge.zip",
"installPath": ".vswebassemblybridge",
"platforms": [
"win32",
"linux",
"darwin"
],
"architectures": [
"x86",
"x86_64",
"arm64"
],
"integrity": "4C4B641AF5F8EFC975EB26D71A6DB052DDF2E3AF3AA263FC660C65F0B7044DDD"
}
],
"engines": {
Expand Down Expand Up @@ -1155,6 +1172,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 @@ -5570,4 +5592,4 @@
}
]
}
}
}
5 changes: 3 additions & 2 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -489,5 +489,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)"
}
6 changes: 0 additions & 6 deletions src/coreclrDebug/activate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,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 @@ -26,6 +26,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
5 changes: 5 additions & 0 deletions src/lsptoolshost/debugger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ export function registerDebugger(
context.subscriptions.push(
vscode.debug.registerDebugConfigurationProvider('coreclr', dotnetWorkspaceConfigurationProvider)
);

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

context.subscriptions.push(
vscode.commands.registerCommand('dotnet.generateAssets', async (selectedIndex) =>
generateAssets(workspaceInformationProvider, selectedIndex)
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/services/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
)
);
}
3 changes: 3 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ export async function activate(
requiredPackageIds.push('OmniSharp');
}

requiredPackageIds.push('VSWebAssemblyBridge');

// If the dotnet bundle is installed, this will ensure the dotnet CLI is on the path.
await initializeDotnetPath();

Expand Down Expand Up @@ -360,6 +362,7 @@ export async function activate(
getComponentFolder: (componentName) => {
return getComponentFolder(componentName, languageServerOptions);
},
tryToUseVSDbgForMono: BlazorDebugConfigurationProvider.tryToUseVSDbgForMono,
};
} else {
return {
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
1 change: 1 addition & 0 deletions src/omnisharpWorkspaceDebugInformationProvider.ts
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
Loading
Loading