From 6999900801bf324a569ca95a30ff382676b00a47 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 15 Aug 2026 03:32:18 +0000 Subject: [PATCH 1/2] build(deps): bump @microsoft/polyglot-notebooks Bumps [@microsoft/polyglot-notebooks](https://github.com/dotnet/interactive) from 1.0.441801 to 1.0.740304. - [Release notes](https://github.com/dotnet/interactive/releases) - [Commits](https://github.com/dotnet/interactive/commits) --- updated-dependencies: - dependency-name: "@microsoft/polyglot-notebooks" dependency-version: 1.0.740304 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/microsoft-trydotnet-editor/package-lock.json | 8 ++++---- src/microsoft-trydotnet-editor/package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/microsoft-trydotnet-editor/package-lock.json b/src/microsoft-trydotnet-editor/package-lock.json index 3131a5362..a4c541517 100644 --- a/src/microsoft-trydotnet-editor/package-lock.json +++ b/src/microsoft-trydotnet-editor/package-lock.json @@ -9,7 +9,7 @@ "version": "1.0.0", "license": "MIT", "dependencies": { - "@microsoft/polyglot-notebooks": "1.0.441801", + "@microsoft/polyglot-notebooks": "1.0.740304", "monaco-editor": "0.56.0", "rxjs": "7.8.2", "uuid": "14.0.1" @@ -608,9 +608,9 @@ } }, "node_modules/@microsoft/polyglot-notebooks": { - "version": "1.0.441801", - "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/npm/registry/@microsoft/polyglot-notebooks/-/polyglot-notebooks-1.0.441801.tgz", - "integrity": "sha1-vGUZjaNCd1Wv4b4VL1yH/7FOM5Q=", + "version": "1.0.740304", + "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/npm/registry/@microsoft/polyglot-notebooks/-/polyglot-notebooks-1.0.740304.tgz", + "integrity": "sha1-v9rBexPWAg2xA+0KSxw/Q+1emO8=", "license": "MIT", "dependencies": { "rxjs": "7.5.6", diff --git a/src/microsoft-trydotnet-editor/package.json b/src/microsoft-trydotnet-editor/package.json index 289f16aac..9994c7b83 100644 --- a/src/microsoft-trydotnet-editor/package.json +++ b/src/microsoft-trydotnet-editor/package.json @@ -53,7 +53,7 @@ "webpack-cli": "7.0.2" }, "dependencies": { - "@microsoft/polyglot-notebooks": "1.0.441801", + "@microsoft/polyglot-notebooks": "1.0.740304", "monaco-editor": "0.56.0", "rxjs": "7.8.2", "uuid": "14.0.1" From 0dff50f5089ea3ea25f28fca947886fe7ac464a2 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Sat, 15 Aug 2026 09:40:37 -0400 Subject: [PATCH 2/2] Fix CommandFailed not emitted when project/document validation fails (#437) --- .../src/projectKernel.ts | 70 ++++++++++++------- 1 file changed, 44 insertions(+), 26 deletions(-) diff --git a/src/microsoft-trydotnet-editor/src/projectKernel.ts b/src/microsoft-trydotnet-editor/src/projectKernel.ts index 04efe99cd..c5474beb0 100644 --- a/src/microsoft-trydotnet-editor/src/projectKernel.ts +++ b/src/microsoft-trydotnet-editor/src/projectKernel.ts @@ -25,9 +25,14 @@ export abstract class ProjectKernel extends polyglotNotebooks.Kernel { this.registerCommandHandler({ commandType: polyglotNotebooks.SubmitCodeType, handle: (commandInvocation: polyglotNotebooks.IKernelCommandInvocation) => { - - this.throwIfProjectIsNotOpened(); - this.throwIffDocumentIsNotOpened(); + if (!this._project) { + commandInvocation.context.fail(`Project must be opened, send the command '${polyglotNotebooks.OpenProjectType}' first.`); + return Promise.resolve(); + } + if (!this._openDocument) { + commandInvocation.context.fail(`Document must be opened, send the command '${polyglotNotebooks.OpenDocumentType}' first.`); + return Promise.resolve(); + } return this.handleSubmitCode(commandInvocation); } }); @@ -44,7 +49,10 @@ export abstract class ProjectKernel extends polyglotNotebooks.Kernel { this.registerCommandHandler({ commandType: polyglotNotebooks.OpenDocumentType, handle: async (commandInvocation: polyglotNotebooks.IKernelCommandInvocation) => { - this.throwIfProjectIsNotOpened(); + if (!this._project) { + commandInvocation.context.fail(`Project must be opened, send the command '${polyglotNotebooks.OpenProjectType}' first.`); + return; + } await this.handleOpenDocument(commandInvocation); let command = commandInvocation.commandEnvelope.command; this._openDocument = { @@ -60,8 +68,14 @@ export abstract class ProjectKernel extends polyglotNotebooks.Kernel { this.registerCommandHandler({ commandType: polyglotNotebooks.RequestDiagnosticsType, handle: (commandInvocation: polyglotNotebooks.IKernelCommandInvocation) => { - this.throwIfProjectIsNotOpened(); - this.throwIffDocumentIsNotOpened(); + if (!this._project) { + commandInvocation.context.fail(`Project must be opened, send the command '${polyglotNotebooks.OpenProjectType}' first.`); + return Promise.resolve(); + } + if (!this._openDocument) { + commandInvocation.context.fail(`Document must be opened, send the command '${polyglotNotebooks.OpenDocumentType}' first.`); + return Promise.resolve(); + } return this.handleRequestDiagnostics(commandInvocation); } }); @@ -69,8 +83,14 @@ export abstract class ProjectKernel extends polyglotNotebooks.Kernel { this.registerCommandHandler({ commandType: polyglotNotebooks.RequestCompletionsType, handle: (commandInvocation: polyglotNotebooks.IKernelCommandInvocation) => { - this.throwIfProjectIsNotOpened(); - this.throwIffDocumentIsNotOpened(); + if (!this._project) { + commandInvocation.context.fail(`Project must be opened, send the command '${polyglotNotebooks.OpenProjectType}' first.`); + return Promise.resolve(); + } + if (!this._openDocument) { + commandInvocation.context.fail(`Document must be opened, send the command '${polyglotNotebooks.OpenDocumentType}' first.`); + return Promise.resolve(); + } return this.handleRequestCompletions(commandInvocation); } }); @@ -78,8 +98,14 @@ export abstract class ProjectKernel extends polyglotNotebooks.Kernel { this.registerCommandHandler({ commandType: polyglotNotebooks.RequestHoverTextType, handle: (commandInvocation: polyglotNotebooks.IKernelCommandInvocation) => { - this.throwIfProjectIsNotOpened(); - this.throwIffDocumentIsNotOpened(); + if (!this._project) { + commandInvocation.context.fail(`Project must be opened, send the command '${polyglotNotebooks.OpenProjectType}' first.`); + return Promise.resolve(); + } + if (!this._openDocument) { + commandInvocation.context.fail(`Document must be opened, send the command '${polyglotNotebooks.OpenDocumentType}' first.`); + return Promise.resolve(); + } return this.handleRequestHoverText(commandInvocation); } }); @@ -87,27 +113,19 @@ export abstract class ProjectKernel extends polyglotNotebooks.Kernel { this.registerCommandHandler({ commandType: polyglotNotebooks.RequestSignatureHelpType, handle: (commandInvocation: polyglotNotebooks.IKernelCommandInvocation) => { - this.throwIfProjectIsNotOpened(); - this.throwIffDocumentIsNotOpened(); + if (!this._project) { + commandInvocation.context.fail(`Project must be opened, send the command '${polyglotNotebooks.OpenProjectType}' first.`); + return Promise.resolve(); + } + if (!this._openDocument) { + commandInvocation.context.fail(`Document must be opened, send the command '${polyglotNotebooks.OpenDocumentType}' first.`); + return Promise.resolve(); + } return this.handleRequestSignatureHelp(commandInvocation); } }); } - protected throwIfProjectIsNotOpened() { - if (!this._project) { - // todo : align error message with .NET - throw new Error(`Project must be opened, send the command '${polyglotNotebooks.OpenProjectType}' first.`); - } - } - - protected throwIffDocumentIsNotOpened() { - if (!this._openDocument) { - // todo : align error message with .NET - throw new Error(`Document must be opened, send the command '${polyglotNotebooks.OpenDocumentType}' first.`); - } - } - protected abstract handleOpenProject(commandInvocation: polyglotNotebooks.IKernelCommandInvocation): Promise; protected abstract handleRequestDiagnostics(commandInvocation: polyglotNotebooks.IKernelCommandInvocation): Promise; protected abstract handleRequestCompletions(commandInvocation: polyglotNotebooks.IKernelCommandInvocation): Promise;