Skip to content
Merged
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
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
"type": "node",
"request": "launch",
"name": "Generate CDP API",
"program": "${workspaceFolder}/scripts/generate-cdp-api.js"
"program": "${workspaceFolder}/dist/src/build/generateCdp.js"
},
{
"type": "node",
"request": "launch",
"name": "Generate DAP API",
"program": "${workspaceFolder}/scripts/generate-dap-api.js"
"program": "${workspaceFolder}/dist/src/build/generateDap.js"
},
{
"type": "node",
Expand Down
24 changes: 24 additions & 0 deletions src/binder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { DebugAdapter } from './adapter/debugAdapter';
import { DiagnosticToolSuggester } from './adapter/diagnosticToolSuggester';
import { SelfProfile } from './adapter/selfProfile';
import { Thread } from './adapter/threads';
import Cdp from './cdp/api';
import { CancellationTokenSource } from './common/cancellation';
import { DisposableList } from './common/disposable';
import { EventEmitter, IDisposable } from './common/events';
Expand Down Expand Up @@ -410,6 +411,15 @@ export class Binder implements IDisposable {
const debugAdapter = new DebugAdapter(dap, this._asyncStackPolicy, launchParams, container);
const thread = debugAdapter.createThread(cdp, target);

const isBlazor = 'inspectUri' in launchParams && !!launchParams.inspectUri;
if (isBlazor) {
this.attachDotnetDebuggerEvent(
cdp,
this._rootServices.get(ITelemetryReporter),
this._rootServices.get(IsVSCode),
);
}

const startThread = async () => {
await debugAdapter.launchBlocker();
target.runIfWaitingForDebugger();
Expand Down Expand Up @@ -441,6 +451,20 @@ export class Binder implements IDisposable {
await target.afterBind();
}

private attachDotnetDebuggerEvent(
cdp: Cdp.Api,
telemetryReporter: ITelemetryReporter,
isVsCode?: boolean,
) {
cdp.DotnetDebugger.on('reportBlazorDebugError', event => {
telemetryReporter.report('blazorDebugError', {
exceptionType: event.exceptionType,
'!error': event.error,
error: isVsCode ? undefined : event.error,
});
});
}

private _attachToNewTargets(targets: ITarget[], launcher: ILauncher) {
for (const target of targets.values()) {
if (!target.waitingForDebugger()) {
Expand Down
6 changes: 3 additions & 3 deletions src/build/generateCdp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ async function generate() {
const result = [];
const interfaceSeparator = createSeparator();

result.push(autoGeneratedFileHeader('generate-cdp-api.js'));
result.push(autoGeneratedFileHeader('generateCdp.js'));
result.push(`import { IDisposable } from '../common/disposable'; `);
result.push(``);
result.push(`export namespace Cdp {`);
Expand Down Expand Up @@ -233,7 +233,7 @@ async function generate() {

function appendPauseResume() {
result.push(`/**`);
result.push(` * Pauses events being sent through the aPI.`);
result.push(` * Pauses events being sent through the Api.`);
result.push(` */`);
result.push(`pause(): void;`);
result.push(`/**`);
Expand Down Expand Up @@ -274,7 +274,7 @@ async function generate() {
${eventLines.join('\n')}`;
});

const interfaceCode = `${autoGeneratedFileHeader('generate-cdp-api.js')}
const interfaceCode = `${autoGeneratedFileHeader('generateCdp.js')}
interface ICDPOperationClassification {
${propertiesClassifications.join('\n')}
}
Expand Down
4 changes: 2 additions & 2 deletions src/build/generateDap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ async function generate() {
);
const result: string[] = [];

result.push(autoGeneratedFileHeader('generate-dap-api.js'));
result.push(autoGeneratedFileHeader('generateDap.js'));
result.push(`import * as E from './error';`);
result.push(``);
result.push(`export namespace Dap {`);
Expand Down Expand Up @@ -279,7 +279,7 @@ async function generate() {
"!${noPostfixAndLowercase}.errors": { classification: 'CallstackOrException'; purpose: 'PerformanceAndHealth' },`;
});

const interfaceCode = `${autoGeneratedFileHeader('generate-cdp-api.js')}
const interfaceCode = `${autoGeneratedFileHeader('generateCdp.js')}
interface IDAPOperationClassification {
${propertiesClassifications.join('\n')}
}
Expand Down
21 changes: 21 additions & 0 deletions src/build/wasmCustom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,27 @@ export default {
description: 'Sets options for locating symbols.',
},
],
events: [
{
name: 'reportBlazorDebugError',
description:
'Fired when the attached Blazor DotnetDebugger itself, not the blazor app being debugged, encounters an error.',
parameters: [
{
name: 'exceptionType',
description: 'Specifies the type of exception.',
type: 'string',
enum: ['uncaughtException', 'unhandledRejection'],
},
{
name: 'error',
description: 'The error message.',
type: 'string',
enum: ['unknown', 'undefined'],
},
],
},
],
},
],
};
Loading