From 14faa838fe92f650976583500f1336d7f5b19aea Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 16 Sep 2026 18:26:41 +0000 Subject: [PATCH 01/12] Add C# Dev Kit v11 compatibility check Co-authored-by: dibarbet <5749229+dibarbet@users.noreply.github.com> --- src/checkCSharpDevKitVersion.ts | 27 ++++++++++ src/main.ts | 2 + .../checkCSharpDevKitVersion.test.ts | 49 +++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 src/checkCSharpDevKitVersion.ts create mode 100644 test/lsptoolshost/unitTests/checkCSharpDevKitVersion.test.ts diff --git a/src/checkCSharpDevKitVersion.ts b/src/checkCSharpDevKitVersion.ts new file mode 100644 index 000000000..b24217c0c --- /dev/null +++ b/src/checkCSharpDevKitVersion.ts @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as vscode from 'vscode'; +import { major } from 'semver'; +import { CSharpDevKitExports } from './csharpDevKitExports'; + +const requiredCSharpDevKitMajorVersion = 11; + +export async function checkCSharpDevKitVersion( + csharpDevKitExtension: vscode.Extension | undefined +): Promise { + if ( + !csharpDevKitExtension || + major(csharpDevKitExtension.packageJSON.version) >= requiredCSharpDevKitMajorVersion + ) { + return; + } + + const message = vscode.l10n.t( + 'This version of the C# extension requires C# Dev Kit version 11 or later. Please install the pre-release version of C# Dev Kit or use the release version of the C# extension.' + ); + await vscode.window.showErrorMessage(message); + throw new Error(message); +} diff --git a/src/main.ts b/src/main.ts index 600619a2f..5235d33de 100644 --- a/src/main.ts +++ b/src/main.ts @@ -27,6 +27,7 @@ import { checkDotNetRuntimeExtensionVersion } from './checkDotNetRuntimeExtensio import { checkIsSupportedPlatform } from './checkSupportedPlatform'; import { activateRoslyn } from './activateRoslyn'; import { LimitedActivationStatus } from './shared/limitedActivationStatus'; +import { checkCSharpDevKitVersion } from './checkCSharpDevKitVersion'; export async function activate( context: vscode.ExtensionContext @@ -71,6 +72,7 @@ export async function activate( const requiredPackageIds: string[] = ['Debugger', 'Razor']; const csharpDevkitExtension = getCSharpDevKit(); + await checkCSharpDevKitVersion(csharpDevkitExtension); const useOmnisharpServer = !csharpDevkitExtension && commonOptions.useOmnisharpServer; if (useOmnisharpServer) { requiredPackageIds.push('OmniSharp'); diff --git a/test/lsptoolshost/unitTests/checkCSharpDevKitVersion.test.ts b/test/lsptoolshost/unitTests/checkCSharpDevKitVersion.test.ts new file mode 100644 index 000000000..cdadbb9e3 --- /dev/null +++ b/test/lsptoolshost/unitTests/checkCSharpDevKitVersion.test.ts @@ -0,0 +1,49 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as vscode from 'vscode'; +import { beforeEach, describe, expect, jest, test } from '@jest/globals'; +import { checkCSharpDevKitVersion } from '../../../src/checkCSharpDevKitVersion'; +import { CSharpDevKitExports } from '../../../src/csharpDevKitExports'; + +describe('C# Dev Kit version check', () => { + beforeEach(() => { + jest.restoreAllMocks(); + }); + + test('allows activation when C# Dev Kit is not installed', async () => { + const showErrorMessage = jest.spyOn(vscode.window, 'showErrorMessage'); + + await checkCSharpDevKitVersion(undefined); + + expect(showErrorMessage).not.toHaveBeenCalled(); + }); + + test.each(['11.0.0', '11.0.0-pre.1', '12.0.0'])( + 'allows activation with C# Dev Kit version %s', + async (version) => { + const showErrorMessage = jest.spyOn(vscode.window, 'showErrorMessage'); + + await checkCSharpDevKitVersion(createExtension(version)); + + expect(showErrorMessage).not.toHaveBeenCalled(); + } + ); + + test('blocks activation with an older C# Dev Kit version', async () => { + const showErrorMessage = jest.spyOn(vscode.window, 'showErrorMessage').mockResolvedValue(undefined); + + await expect(checkCSharpDevKitVersion(createExtension('10.9.99'))).rejects.toThrow( + 'This version of the C# extension requires C# Dev Kit version 11 or later. Please install the pre-release version of C# Dev Kit or use the release version of the C# extension.' + ); + expect(showErrorMessage).toHaveBeenCalledTimes(1); + }); +}); + +function createExtension(version: string): vscode.Extension { + return { + packageJSON: { version }, + } as vscode.Extension; +} From db7ef15801cec35683e30297857e65e0a5743d69 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 16 Sep 2026 18:27:30 +0000 Subject: [PATCH 02/12] Format C# Dev Kit compatibility tests Co-authored-by: dibarbet <5749229+dibarbet@users.noreply.github.com> --- .../unitTests/checkCSharpDevKitVersion.test.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/test/lsptoolshost/unitTests/checkCSharpDevKitVersion.test.ts b/test/lsptoolshost/unitTests/checkCSharpDevKitVersion.test.ts index cdadbb9e3..e564aa4c4 100644 --- a/test/lsptoolshost/unitTests/checkCSharpDevKitVersion.test.ts +++ b/test/lsptoolshost/unitTests/checkCSharpDevKitVersion.test.ts @@ -21,16 +21,13 @@ describe('C# Dev Kit version check', () => { expect(showErrorMessage).not.toHaveBeenCalled(); }); - test.each(['11.0.0', '11.0.0-pre.1', '12.0.0'])( - 'allows activation with C# Dev Kit version %s', - async (version) => { - const showErrorMessage = jest.spyOn(vscode.window, 'showErrorMessage'); + test.each(['11.0.0', '11.0.0-pre.1', '12.0.0'])('allows activation with C# Dev Kit version %s', async (version) => { + const showErrorMessage = jest.spyOn(vscode.window, 'showErrorMessage'); - await checkCSharpDevKitVersion(createExtension(version)); + await checkCSharpDevKitVersion(createExtension(version)); - expect(showErrorMessage).not.toHaveBeenCalled(); - } - ); + expect(showErrorMessage).not.toHaveBeenCalled(); + }); test('blocks activation with an older C# Dev Kit version', async () => { const showErrorMessage = jest.spyOn(vscode.window, 'showErrorMessage').mockResolvedValue(undefined); From 90a1273ea9e27778fc0da82ddb85fa1a1c716e0c Mon Sep 17 00:00:00 2001 From: David Barbet Date: Wed, 16 Sep 2026 11:39:13 -0700 Subject: [PATCH 03/12] Add localization entry for C# Dev Kit version requirement Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: b3a2d96f-a3d1-4cad-868f-50dc15c71516 --- l10n/bundle.l10n.json | 1 + 1 file changed, 1 insertion(+) diff --git a/l10n/bundle.l10n.json b/l10n/bundle.l10n.json index 27e7d2c6a..3479f4011 100644 --- a/l10n/bundle.l10n.json +++ b/l10n/bundle.l10n.json @@ -5,6 +5,7 @@ "Update and reload": "Update and reload", "The {0} extension requires at least {1} of the .NET Install Tool ({2}) extension. Please update to continue": "The {0} extension requires at least {1} of the .NET Install Tool ({2}) extension. Please update to continue", "Version {0} of the .NET Install Tool ({1}) was not found, {2} will not activate.": "Version {0} of the .NET Install Tool ({1}) was not found, {2} will not activate.", + "This version of the C# extension requires C# Dev Kit version 11 or later. Please install the pre-release version of C# Dev Kit or use the release version of the C# extension.": "This version of the C# extension requires C# Dev Kit version 11 or later. Please install the pre-release version of C# Dev Kit or use the release version of the C# extension.", ".NET Test Log": ".NET Test Log", ".NET NuGet Restore": ".NET NuGet Restore", "Cannot create .NET debug configurations. No workspace folder was selected.": "Cannot create .NET debug configurations. No workspace folder was selected.", From 2b55f2345d170968027f9ac5c4587a6b89222c2f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 16 Sep 2026 20:39:39 +0000 Subject: [PATCH 04/12] Require C# Dev Kit version 11.1 Co-authored-by: dibarbet <5749229+dibarbet@users.noreply.github.com> --- l10n/bundle.l10n.json | 2 +- src/checkCSharpDevKitVersion.ts | 11 ++++------- .../unitTests/checkCSharpDevKitVersion.test.ts | 6 +++--- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/l10n/bundle.l10n.json b/l10n/bundle.l10n.json index 3479f4011..3488332c4 100644 --- a/l10n/bundle.l10n.json +++ b/l10n/bundle.l10n.json @@ -5,7 +5,7 @@ "Update and reload": "Update and reload", "The {0} extension requires at least {1} of the .NET Install Tool ({2}) extension. Please update to continue": "The {0} extension requires at least {1} of the .NET Install Tool ({2}) extension. Please update to continue", "Version {0} of the .NET Install Tool ({1}) was not found, {2} will not activate.": "Version {0} of the .NET Install Tool ({1}) was not found, {2} will not activate.", - "This version of the C# extension requires C# Dev Kit version 11 or later. Please install the pre-release version of C# Dev Kit or use the release version of the C# extension.": "This version of the C# extension requires C# Dev Kit version 11 or later. Please install the pre-release version of C# Dev Kit or use the release version of the C# extension.", + "This version of the C# extension requires C# Dev Kit version 11.1 or later. Please install the pre-release version of C# Dev Kit or use the release version of the C# extension.": "This version of the C# extension requires C# Dev Kit version 11.1 or later. Please install the pre-release version of C# Dev Kit or use the release version of the C# extension.", ".NET Test Log": ".NET Test Log", ".NET NuGet Restore": ".NET NuGet Restore", "Cannot create .NET debug configurations. No workspace folder was selected.": "Cannot create .NET debug configurations. No workspace folder was selected.", diff --git a/src/checkCSharpDevKitVersion.ts b/src/checkCSharpDevKitVersion.ts index b24217c0c..861c74cd2 100644 --- a/src/checkCSharpDevKitVersion.ts +++ b/src/checkCSharpDevKitVersion.ts @@ -4,23 +4,20 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { major } from 'semver'; +import { lt } from 'semver'; import { CSharpDevKitExports } from './csharpDevKitExports'; -const requiredCSharpDevKitMajorVersion = 11; +const requiredCSharpDevKitVersion = '11.1.0'; export async function checkCSharpDevKitVersion( csharpDevKitExtension: vscode.Extension | undefined ): Promise { - if ( - !csharpDevKitExtension || - major(csharpDevKitExtension.packageJSON.version) >= requiredCSharpDevKitMajorVersion - ) { + if (!csharpDevKitExtension || !lt(csharpDevKitExtension.packageJSON.version, requiredCSharpDevKitVersion)) { return; } const message = vscode.l10n.t( - 'This version of the C# extension requires C# Dev Kit version 11 or later. Please install the pre-release version of C# Dev Kit or use the release version of the C# extension.' + 'This version of the C# extension requires C# Dev Kit version 11.1 or later. Please install the pre-release version of C# Dev Kit or use the release version of the C# extension.' ); await vscode.window.showErrorMessage(message); throw new Error(message); diff --git a/test/lsptoolshost/unitTests/checkCSharpDevKitVersion.test.ts b/test/lsptoolshost/unitTests/checkCSharpDevKitVersion.test.ts index e564aa4c4..d4bbbeae3 100644 --- a/test/lsptoolshost/unitTests/checkCSharpDevKitVersion.test.ts +++ b/test/lsptoolshost/unitTests/checkCSharpDevKitVersion.test.ts @@ -21,7 +21,7 @@ describe('C# Dev Kit version check', () => { expect(showErrorMessage).not.toHaveBeenCalled(); }); - test.each(['11.0.0', '11.0.0-pre.1', '12.0.0'])('allows activation with C# Dev Kit version %s', async (version) => { + test.each(['11.1.0', '11.1.1-pre.1', '12.0.0'])('allows activation with C# Dev Kit version %s', async (version) => { const showErrorMessage = jest.spyOn(vscode.window, 'showErrorMessage'); await checkCSharpDevKitVersion(createExtension(version)); @@ -32,8 +32,8 @@ describe('C# Dev Kit version check', () => { test('blocks activation with an older C# Dev Kit version', async () => { const showErrorMessage = jest.spyOn(vscode.window, 'showErrorMessage').mockResolvedValue(undefined); - await expect(checkCSharpDevKitVersion(createExtension('10.9.99'))).rejects.toThrow( - 'This version of the C# extension requires C# Dev Kit version 11 or later. Please install the pre-release version of C# Dev Kit or use the release version of the C# extension.' + await expect(checkCSharpDevKitVersion(createExtension('11.0.99'))).rejects.toThrow( + 'This version of the C# extension requires C# Dev Kit version 11.1 or later. Please install the pre-release version of C# Dev Kit or use the release version of the C# extension.' ); expect(showErrorMessage).toHaveBeenCalledTimes(1); }); From 8e96cdc7ae5242b7b95a03a7c48f7be6e926bacc Mon Sep 17 00:00:00 2001 From: David Barbet Date: Wed, 16 Sep 2026 13:45:31 -0700 Subject: [PATCH 05/12] Bump C# extension to 11.1 and restore Dev Kit v11 requirement Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: b3a2d96f-a3d1-4cad-868f-50dc15c71516 --- l10n/bundle.l10n.json | 2 +- src/checkCSharpDevKitVersion.ts | 11 +++++++---- .../unitTests/checkCSharpDevKitVersion.test.ts | 6 +++--- version.json | 2 +- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/l10n/bundle.l10n.json b/l10n/bundle.l10n.json index 3488332c4..3479f4011 100644 --- a/l10n/bundle.l10n.json +++ b/l10n/bundle.l10n.json @@ -5,7 +5,7 @@ "Update and reload": "Update and reload", "The {0} extension requires at least {1} of the .NET Install Tool ({2}) extension. Please update to continue": "The {0} extension requires at least {1} of the .NET Install Tool ({2}) extension. Please update to continue", "Version {0} of the .NET Install Tool ({1}) was not found, {2} will not activate.": "Version {0} of the .NET Install Tool ({1}) was not found, {2} will not activate.", - "This version of the C# extension requires C# Dev Kit version 11.1 or later. Please install the pre-release version of C# Dev Kit or use the release version of the C# extension.": "This version of the C# extension requires C# Dev Kit version 11.1 or later. Please install the pre-release version of C# Dev Kit or use the release version of the C# extension.", + "This version of the C# extension requires C# Dev Kit version 11 or later. Please install the pre-release version of C# Dev Kit or use the release version of the C# extension.": "This version of the C# extension requires C# Dev Kit version 11 or later. Please install the pre-release version of C# Dev Kit or use the release version of the C# extension.", ".NET Test Log": ".NET Test Log", ".NET NuGet Restore": ".NET NuGet Restore", "Cannot create .NET debug configurations. No workspace folder was selected.": "Cannot create .NET debug configurations. No workspace folder was selected.", diff --git a/src/checkCSharpDevKitVersion.ts b/src/checkCSharpDevKitVersion.ts index 861c74cd2..b24217c0c 100644 --- a/src/checkCSharpDevKitVersion.ts +++ b/src/checkCSharpDevKitVersion.ts @@ -4,20 +4,23 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; -import { lt } from 'semver'; +import { major } from 'semver'; import { CSharpDevKitExports } from './csharpDevKitExports'; -const requiredCSharpDevKitVersion = '11.1.0'; +const requiredCSharpDevKitMajorVersion = 11; export async function checkCSharpDevKitVersion( csharpDevKitExtension: vscode.Extension | undefined ): Promise { - if (!csharpDevKitExtension || !lt(csharpDevKitExtension.packageJSON.version, requiredCSharpDevKitVersion)) { + if ( + !csharpDevKitExtension || + major(csharpDevKitExtension.packageJSON.version) >= requiredCSharpDevKitMajorVersion + ) { return; } const message = vscode.l10n.t( - 'This version of the C# extension requires C# Dev Kit version 11.1 or later. Please install the pre-release version of C# Dev Kit or use the release version of the C# extension.' + 'This version of the C# extension requires C# Dev Kit version 11 or later. Please install the pre-release version of C# Dev Kit or use the release version of the C# extension.' ); await vscode.window.showErrorMessage(message); throw new Error(message); diff --git a/test/lsptoolshost/unitTests/checkCSharpDevKitVersion.test.ts b/test/lsptoolshost/unitTests/checkCSharpDevKitVersion.test.ts index d4bbbeae3..e564aa4c4 100644 --- a/test/lsptoolshost/unitTests/checkCSharpDevKitVersion.test.ts +++ b/test/lsptoolshost/unitTests/checkCSharpDevKitVersion.test.ts @@ -21,7 +21,7 @@ describe('C# Dev Kit version check', () => { expect(showErrorMessage).not.toHaveBeenCalled(); }); - test.each(['11.1.0', '11.1.1-pre.1', '12.0.0'])('allows activation with C# Dev Kit version %s', async (version) => { + test.each(['11.0.0', '11.0.0-pre.1', '12.0.0'])('allows activation with C# Dev Kit version %s', async (version) => { const showErrorMessage = jest.spyOn(vscode.window, 'showErrorMessage'); await checkCSharpDevKitVersion(createExtension(version)); @@ -32,8 +32,8 @@ describe('C# Dev Kit version check', () => { test('blocks activation with an older C# Dev Kit version', async () => { const showErrorMessage = jest.spyOn(vscode.window, 'showErrorMessage').mockResolvedValue(undefined); - await expect(checkCSharpDevKitVersion(createExtension('11.0.99'))).rejects.toThrow( - 'This version of the C# extension requires C# Dev Kit version 11.1 or later. Please install the pre-release version of C# Dev Kit or use the release version of the C# extension.' + await expect(checkCSharpDevKitVersion(createExtension('10.9.99'))).rejects.toThrow( + 'This version of the C# extension requires C# Dev Kit version 11 or later. Please install the pre-release version of C# Dev Kit or use the release version of the C# extension.' ); expect(showErrorMessage).toHaveBeenCalledTimes(1); }); diff --git a/version.json b/version.json index 72ac11e7f..fa720aa48 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", - "version": "2.152", + "version": "11.1", "publicReleaseRefSpec": [ "^refs/heads/release$", "^refs/heads/prerelease$", From 342a1209c278ff325f98657edf8a5f420ccbd78e Mon Sep 17 00:00:00 2001 From: David Barbet Date: Wed, 16 Sep 2026 14:06:38 -0700 Subject: [PATCH 06/12] fixup --- l10n/bundle.l10n.json | 2 +- src/checkCSharpDevKitVersion.ts | 4 ++-- test/lsptoolshost/unitTests/checkCSharpDevKitVersion.test.ts | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/l10n/bundle.l10n.json b/l10n/bundle.l10n.json index 3479f4011..2b9777255 100644 --- a/l10n/bundle.l10n.json +++ b/l10n/bundle.l10n.json @@ -5,7 +5,7 @@ "Update and reload": "Update and reload", "The {0} extension requires at least {1} of the .NET Install Tool ({2}) extension. Please update to continue": "The {0} extension requires at least {1} of the .NET Install Tool ({2}) extension. Please update to continue", "Version {0} of the .NET Install Tool ({1}) was not found, {2} will not activate.": "Version {0} of the .NET Install Tool ({1}) was not found, {2} will not activate.", - "This version of the C# extension requires C# Dev Kit version 11 or later. Please install the pre-release version of C# Dev Kit or use the release version of the C# extension.": "This version of the C# extension requires C# Dev Kit version 11 or later. Please install the pre-release version of C# Dev Kit or use the release version of the C# extension.", + "This version of the C# extension requires C# Dev Kit version 11 or later. Please install the latest pre-release version of C# Dev Kit or use the release version of the C# extension.": "This version of the C# extension requires C# Dev Kit version 11 or later. Please install the latest pre-release version of C# Dev Kit or use the release version of the C# extension.", ".NET Test Log": ".NET Test Log", ".NET NuGet Restore": ".NET NuGet Restore", "Cannot create .NET debug configurations. No workspace folder was selected.": "Cannot create .NET debug configurations. No workspace folder was selected.", diff --git a/src/checkCSharpDevKitVersion.ts b/src/checkCSharpDevKitVersion.ts index b24217c0c..b4fc09289 100644 --- a/src/checkCSharpDevKitVersion.ts +++ b/src/checkCSharpDevKitVersion.ts @@ -20,8 +20,8 @@ export async function checkCSharpDevKitVersion( } const message = vscode.l10n.t( - 'This version of the C# extension requires C# Dev Kit version 11 or later. Please install the pre-release version of C# Dev Kit or use the release version of the C# extension.' + 'This version of the C# extension requires C# Dev Kit version 11 or later. Please install the latest pre-release version of C# Dev Kit or use the release version of the C# extension.' ); - await vscode.window.showErrorMessage(message); + await vscode.window.showErrorMessage(message, { modal: true }); throw new Error(message); } diff --git a/test/lsptoolshost/unitTests/checkCSharpDevKitVersion.test.ts b/test/lsptoolshost/unitTests/checkCSharpDevKitVersion.test.ts index e564aa4c4..3dceaf9d8 100644 --- a/test/lsptoolshost/unitTests/checkCSharpDevKitVersion.test.ts +++ b/test/lsptoolshost/unitTests/checkCSharpDevKitVersion.test.ts @@ -36,6 +36,7 @@ describe('C# Dev Kit version check', () => { 'This version of the C# extension requires C# Dev Kit version 11 or later. Please install the pre-release version of C# Dev Kit or use the release version of the C# extension.' ); expect(showErrorMessage).toHaveBeenCalledTimes(1); + expect(showErrorMessage).toHaveBeenCalledWith(expect.any(String), { modal: true }); }); }); From 968f2afd56650d8d7606262ed611623c70c94e66 Mon Sep 17 00:00:00 2001 From: David Barbet Date: Wed, 16 Sep 2026 14:47:51 -0700 Subject: [PATCH 07/12] feedback --- CHANGELOG.md | 4 ++++ azure-pipelines.yml | 2 ++ azure-pipelines/test-matrix.yml | 10 +++++++--- l10n/bundle.l10n.json | 1 + src/checkCSharpDevKitVersion.ts | 9 +++++++-- .../unitTests/checkCSharpDevKitVersion.test.ts | 13 +++++++++++-- test/vscodeLauncher.ts | 2 +- 7 files changed, 33 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 67402833b..183e66080 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ - Diagnostics related feature requests and improvements [#5951](https://github.com/dotnet/vscode-csharp/issues/5951) - Debug from .csproj and .sln [#5876](https://github.com/dotnet/vscode-csharp/issues/5876) +# 11.1.x + +* Require C# Dev Kit version 11 or later (PR: [#9776](https://github.com/dotnet/vscode-csharp/pull/9776)) + # 2.152.x * Update Roslyn to 5.12.0-1.26465.4 (PR: [#9772](https://github.com/dotnet/vscode-csharp/pull/9772)) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 352a7232b..282686b43 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -85,6 +85,7 @@ stages: os: linux # Prefer the dotnet from the container. installDotNet: false + runDevKitTests: false testVSCodeVersion: $(testVSCodeVersion) pool: name: NetCore-Public @@ -102,6 +103,7 @@ stages: os: linux # Prefer the dotnet from the container. installDotNet: false + runDevKitTests: false testVSCodeVersion: $(testVSCodeVersion) pool: name: NetCore-Public diff --git a/azure-pipelines/test-matrix.yml b/azure-pipelines/test-matrix.yml index 658000533..a12982081 100644 --- a/azure-pipelines/test-matrix.yml +++ b/azure-pipelines/test-matrix.yml @@ -10,6 +10,9 @@ parameters: type: boolean - name: testVSCodeVersion type: string + - name: runDevKitTests + type: boolean + default: true jobs: - job: @@ -21,9 +24,10 @@ jobs: CSharpIntegrationTests: npmCommand: test:integration:csharp isIntegration: true - DevKitTests: - npmCommand: test:integration:devkit - isIntegration: true + ${{ if parameters.runDevKitTests }}: + DevKitTests: + npmCommand: test:integration:devkit + isIntegration: true RazorCohostTests: npmCommand: test:integration:razor:cohost isIntegration: true diff --git a/l10n/bundle.l10n.json b/l10n/bundle.l10n.json index 2b9777255..0e2184b34 100644 --- a/l10n/bundle.l10n.json +++ b/l10n/bundle.l10n.json @@ -6,6 +6,7 @@ "The {0} extension requires at least {1} of the .NET Install Tool ({2}) extension. Please update to continue": "The {0} extension requires at least {1} of the .NET Install Tool ({2}) extension. Please update to continue", "Version {0} of the .NET Install Tool ({1}) was not found, {2} will not activate.": "Version {0} of the .NET Install Tool ({1}) was not found, {2} will not activate.", "This version of the C# extension requires C# Dev Kit version 11 or later. Please install the latest pre-release version of C# Dev Kit or use the release version of the C# extension.": "This version of the C# extension requires C# Dev Kit version 11 or later. Please install the latest pre-release version of C# Dev Kit or use the release version of the C# extension.", + "Open C# Dev Kit": "Open C# Dev Kit", ".NET Test Log": ".NET Test Log", ".NET NuGet Restore": ".NET NuGet Restore", "Cannot create .NET debug configurations. No workspace folder was selected.": "Cannot create .NET debug configurations. No workspace folder was selected.", diff --git a/src/checkCSharpDevKitVersion.ts b/src/checkCSharpDevKitVersion.ts index b4fc09289..1dde7b404 100644 --- a/src/checkCSharpDevKitVersion.ts +++ b/src/checkCSharpDevKitVersion.ts @@ -6,6 +6,7 @@ import * as vscode from 'vscode'; import { major } from 'semver'; import { CSharpDevKitExports } from './csharpDevKitExports'; +import { csharpDevkitExtensionId } from './utils/getCSharpDevKit'; const requiredCSharpDevKitMajorVersion = 11; @@ -20,8 +21,12 @@ export async function checkCSharpDevKitVersion( } const message = vscode.l10n.t( - 'This version of the C# extension requires C# Dev Kit version 11 or later. Please install the latest pre-release version of C# Dev Kit or use the release version of the C# extension.' + 'C# Dev Kit version 11 or later is required. Please switch to the pre-release version of the C# Dev Kit.' ); - await vscode.window.showErrorMessage(message, { modal: true }); + const openCSharpDevKit = vscode.l10n.t('Open C# Dev Kit'); + const selection = await vscode.window.showErrorMessage(message, { modal: true }, openCSharpDevKit); + if (selection === openCSharpDevKit) { + await vscode.commands.executeCommand('extension.open', csharpDevkitExtensionId); + } throw new Error(message); } diff --git a/test/lsptoolshost/unitTests/checkCSharpDevKitVersion.test.ts b/test/lsptoolshost/unitTests/checkCSharpDevKitVersion.test.ts index 3dceaf9d8..0197c87fd 100644 --- a/test/lsptoolshost/unitTests/checkCSharpDevKitVersion.test.ts +++ b/test/lsptoolshost/unitTests/checkCSharpDevKitVersion.test.ts @@ -33,10 +33,19 @@ describe('C# Dev Kit version check', () => { const showErrorMessage = jest.spyOn(vscode.window, 'showErrorMessage').mockResolvedValue(undefined); await expect(checkCSharpDevKitVersion(createExtension('10.9.99'))).rejects.toThrow( - 'This version of the C# extension requires C# Dev Kit version 11 or later. Please install the pre-release version of C# Dev Kit or use the release version of the C# extension.' + 'C# Dev Kit version 11 or later is required. Please switch to the pre-release version of the C# Dev Kit.' ); expect(showErrorMessage).toHaveBeenCalledTimes(1); - expect(showErrorMessage).toHaveBeenCalledWith(expect.any(String), { modal: true }); + expect(showErrorMessage).toHaveBeenCalledWith(expect.any(String), { modal: true }, 'Open C# Dev Kit'); + }); + + test('opens C# Dev Kit when requested', async () => { + jest.spyOn(vscode.window, 'showErrorMessage').mockResolvedValue('Open C# Dev Kit' as never); + const executeCommand = jest.spyOn(vscode.commands, 'executeCommand').mockResolvedValue(undefined); + + await expect(checkCSharpDevKitVersion(createExtension('10.9.99'))).rejects.toThrow(); + + expect(executeCommand).toHaveBeenCalledWith('extension.open', 'ms-dotnettools.csdevkit'); }); }); diff --git a/test/vscodeLauncher.ts b/test/vscodeLauncher.ts index 639925b8d..7895e173d 100644 --- a/test/vscodeLauncher.ts +++ b/test/vscodeLauncher.ts @@ -32,7 +32,7 @@ export async function prepareVSCodeAndExecuteTests( const extensionsToInstall = [ 'ms-dotnettools.vscode-dotnet-runtime@3.0.0', 'ms-dotnettools.csharp', - 'ms-dotnettools.csdevkit@1.92.5', + 'ms-dotnettools.csdevkit@11.0.2', ]; await installExtensions(extensionsToInstall, cli, args); From 794042bf5f3fe8abc2962a416fb472a955e7a185 Mon Sep 17 00:00:00 2001 From: David Barbet Date: Wed, 16 Sep 2026 15:21:38 -0700 Subject: [PATCH 08/12] fixes --- CHANGELOG.md | 4 ---- l10n/bundle.l10n.json | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 183e66080..9a45dd4bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,11 +4,7 @@ - Debug from .csproj and .sln [#5876](https://github.com/dotnet/vscode-csharp/issues/5876) # 11.1.x - * Require C# Dev Kit version 11 or later (PR: [#9776](https://github.com/dotnet/vscode-csharp/pull/9776)) - -# 2.152.x - * Update Roslyn to 5.12.0-1.26465.4 (PR: [#9772](https://github.com/dotnet/vscode-csharp/pull/9772)) * Avoid cache misses due to cancellation in deprioritized analyzer cache (PR: [#85222](https://github.com/dotnet/roslyn/pull/85222)) * Move the LanguageServerProjectLoader over to our priority queue (PR: [#85272](https://github.com/dotnet/roslyn/pull/85272)) diff --git a/l10n/bundle.l10n.json b/l10n/bundle.l10n.json index 0e2184b34..a9d5f5ab2 100644 --- a/l10n/bundle.l10n.json +++ b/l10n/bundle.l10n.json @@ -5,7 +5,7 @@ "Update and reload": "Update and reload", "The {0} extension requires at least {1} of the .NET Install Tool ({2}) extension. Please update to continue": "The {0} extension requires at least {1} of the .NET Install Tool ({2}) extension. Please update to continue", "Version {0} of the .NET Install Tool ({1}) was not found, {2} will not activate.": "Version {0} of the .NET Install Tool ({1}) was not found, {2} will not activate.", - "This version of the C# extension requires C# Dev Kit version 11 or later. Please install the latest pre-release version of C# Dev Kit or use the release version of the C# extension.": "This version of the C# extension requires C# Dev Kit version 11 or later. Please install the latest pre-release version of C# Dev Kit or use the release version of the C# extension.", + "C# Dev Kit version 11 or later is required. Please switch to the pre-release version of the C# Dev Kit.": "C# Dev Kit version 11 or later is required. Please switch to the pre-release version of the C# Dev Kit.", "Open C# Dev Kit": "Open C# Dev Kit", ".NET Test Log": ".NET Test Log", ".NET NuGet Restore": ".NET NuGet Restore", From fc7c3dfd1a5c2af089ae6bc2dd39e508d8ed822c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 18 Sep 2026 01:04:13 +0000 Subject: [PATCH 09/12] Skip Source Link integration tests Co-authored-by: dibarbet <5749229+dibarbet@users.noreply.github.com> --- .../integrationTests/gotoDefinition.integration.test.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/lsptoolshost/integrationTests/gotoDefinition.integration.test.ts b/test/lsptoolshost/integrationTests/gotoDefinition.integration.test.ts index 6de730414..eb607964b 100644 --- a/test/lsptoolshost/integrationTests/gotoDefinition.integration.test.ts +++ b/test/lsptoolshost/integrationTests/gotoDefinition.integration.test.ts @@ -13,7 +13,6 @@ import { navigate, openFileInWorkspaceAsync, testIfCSharp, - testIfDevKit, } from './integrationHelpers'; import { describe, beforeAll, beforeEach, afterAll, test, expect, afterEach } from '@jest/globals'; @@ -219,7 +218,7 @@ describe(`Go To Definition Tests`, () => { ); }); - testIfDevKit('Navigates to definition in source link', async () => { + test.skip('Navigates to definition in source link', async () => { await openFileInWorkspaceAsync(path.join('test', 'UnitTest1.cs')); // Get definitions @@ -245,7 +244,7 @@ describe(`Go To Definition Tests`, () => { expect(vscode.window.activeTextEditor?.document.uri.path.toLowerCase()).toContain('symbolcache'); }); - testIfDevKit('Navigates from definition in source link source goes to source link', async () => { + test.skip('Navigates from definition in source link source goes to source link', async () => { await openFileInWorkspaceAsync(path.join('test', 'UnitTest1.cs')); // Get definitions From 7a43df6ca7a9e9054f09bcd3ef4f2c7f51b40876 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 18 Sep 2026 01:04:49 +0000 Subject: [PATCH 10/12] Document Source Link test skip Co-authored-by: dibarbet <5749229+dibarbet@users.noreply.github.com> --- .../integrationTests/gotoDefinition.integration.test.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/test/lsptoolshost/integrationTests/gotoDefinition.integration.test.ts b/test/lsptoolshost/integrationTests/gotoDefinition.integration.test.ts index eb607964b..3bdf8d241 100644 --- a/test/lsptoolshost/integrationTests/gotoDefinition.integration.test.ts +++ b/test/lsptoolshost/integrationTests/gotoDefinition.integration.test.ts @@ -218,6 +218,7 @@ describe(`Go To Definition Tests`, () => { ); }); + // Re-enable when the C# Dev Kit v11 Source Link bug is fixed. test.skip('Navigates to definition in source link', async () => { await openFileInWorkspaceAsync(path.join('test', 'UnitTest1.cs')); From 63e9a9878702b7d2582e24da8ccf1a83adc37119 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 18 Sep 2026 01:05:24 +0000 Subject: [PATCH 11/12] Document second Source Link test skip Co-authored-by: dibarbet <5749229+dibarbet@users.noreply.github.com> --- .../integrationTests/gotoDefinition.integration.test.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/test/lsptoolshost/integrationTests/gotoDefinition.integration.test.ts b/test/lsptoolshost/integrationTests/gotoDefinition.integration.test.ts index 3bdf8d241..894d8b168 100644 --- a/test/lsptoolshost/integrationTests/gotoDefinition.integration.test.ts +++ b/test/lsptoolshost/integrationTests/gotoDefinition.integration.test.ts @@ -245,6 +245,7 @@ describe(`Go To Definition Tests`, () => { expect(vscode.window.activeTextEditor?.document.uri.path.toLowerCase()).toContain('symbolcache'); }); + // Re-enable when the C# Dev Kit v11 Source Link bug is fixed. test.skip('Navigates from definition in source link source goes to source link', async () => { await openFileInWorkspaceAsync(path.join('test', 'UnitTest1.cs')); From d838038cb9168252519d4dfd34e1a19ef1239ee2 Mon Sep 17 00:00:00 2001 From: David Barbet Date: Fri, 18 Sep 2026 16:30:57 -0700 Subject: [PATCH 12/12] disable C#dk integration tests due to bugs --- azure-pipelines/test-matrix.yml | 3 +- tasks/tests/omnisharptestTasks.ts | 2 +- ...orkspaceSymbolProvider.integration.test.ts | 2 +- test/tasks/vscodeLauncher.test.ts | 59 +++++++++++++++++++ test/vscodeLauncher.ts | 7 ++- 5 files changed, 69 insertions(+), 4 deletions(-) create mode 100644 test/tasks/vscodeLauncher.test.ts diff --git a/azure-pipelines/test-matrix.yml b/azure-pipelines/test-matrix.yml index a12982081..f12dd7f57 100644 --- a/azure-pipelines/test-matrix.yml +++ b/azure-pipelines/test-matrix.yml @@ -12,7 +12,8 @@ parameters: type: string - name: runDevKitTests type: boolean - default: true + # Re-enable once the C# Dev Kit v11 prerelease integration test failures are fixed. + default: false jobs: - job: diff --git a/tasks/tests/omnisharptestTasks.ts b/tasks/tests/omnisharptestTasks.ts index 218927824..e56414249 100644 --- a/tasks/tests/omnisharptestTasks.ts +++ b/tasks/tests/omnisharptestTasks.ts @@ -40,7 +40,7 @@ async function runOmnisharpJestIntegrationTest( CODE_WORKSPACE_ROOT: rootPath, OMNISHARP_ENGINE: engine, OMNISHARP_LOCATION: process.env.OMNISHARP_LOCATION, - CODE_DISABLE_EXTENSIONS: 'true', + CODE_DISABLE_CSHARP_DEV_KIT: 'true', }; await runJestIntegrationTest(testAssetName, testFolder, workspaceFile, suiteName, env); diff --git a/test/omnisharp/omnisharpIntegrationTests/workspaceSymbolProvider.integration.test.ts b/test/omnisharp/omnisharpIntegrationTests/workspaceSymbolProvider.integration.test.ts index 7f6dff7cf..f256f8302 100644 --- a/test/omnisharp/omnisharpIntegrationTests/workspaceSymbolProvider.integration.test.ts +++ b/test/omnisharp/omnisharpIntegrationTests/workspaceSymbolProvider.integration.test.ts @@ -32,7 +32,7 @@ describeIfNotRazorOrGenerator(`WorkspaceSymbolProvider: ${testAssetWorkspace.des await omnisharpConfig.update('minFindSymbolsFilterLength', 2); const symbols = await GetWorkspaceSymbols('P'); - expect(symbols.length).toEqual(0); + expect(symbols).toEqual([]); }); test('Returns elements when minimum filter length is configured and search term is longer or equal', async function () { diff --git a/test/tasks/vscodeLauncher.test.ts b/test/tasks/vscodeLauncher.test.ts new file mode 100644 index 000000000..22f603a80 --- /dev/null +++ b/test/tasks/vscodeLauncher.test.ts @@ -0,0 +1,59 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as cp from 'child_process'; +import { downloadAndUnzipVSCode, resolveCliArgsFromVSCodeExecutablePath, runTests } from '@vscode/test-electron'; +import { beforeEach, describe, expect, jest, test } from '@jest/globals'; +import { prepareVSCodeAndExecuteTests } from '../vscodeLauncher'; + +jest.mock('child_process'); +jest.mock('@vscode/test-electron'); + +describe('VS Code test launcher', () => { + beforeEach(() => { + jest.clearAllMocks(); + jest.mocked(downloadAndUnzipVSCode).mockResolvedValue('code'); + jest.mocked(resolveCliArgsFromVSCodeExecutablePath).mockReturnValue(['code']); + jest.mocked(runTests).mockResolvedValue(0); + jest.mocked(cp.spawnSync).mockReturnValue({ + pid: 1, + output: [], + stdout: '', + stderr: '', + status: 0, + signal: null, + }); + }); + + test.each([ + { flag: undefined, disabled: false }, + { flag: 'false', disabled: false }, + { flag: 'true', disabled: true }, + ])('CODE_DISABLE_CSHARP_DEV_KIT=$flag disables Dev Kit: $disabled', async ({ flag, disabled }) => { + const env = { CODE_DISABLE_CSHARP_DEV_KIT: flag }; + + await expect(prepareVSCodeAndExecuteTests('extension', 'tests', 'workspace', 'user-data', env)).resolves.toBe( + 0 + ); + + expect(runTests).toHaveBeenCalledTimes(1); + const options = jest.mocked(runTests).mock.calls[0][0]; + expect(options.extensionDevelopmentPath).toBe('extension'); + expect(options.extensionTestsPath).toBe('tests'); + expect(options.extensionTestsEnv).toBe(env); + expect(options.launchArgs).toEqual( + expect.arrayContaining([ + 'workspace', + '-n', + '--user-data-dir', + 'user-data', + '--log', + 'ms-dotnettools.csharp:trace', + ]) + ); + expect(options.launchArgs?.includes('--disable-extension=ms-dotnettools.csdevkit')).toBe(disabled); + expect(options.launchArgs).not.toContain('--disable-extensions'); + }); +}); diff --git a/test/vscodeLauncher.ts b/test/vscodeLauncher.ts index 7895e173d..937443bc3 100644 --- a/test/vscodeLauncher.ts +++ b/test/vscodeLauncher.ts @@ -28,7 +28,7 @@ export async function prepareVSCodeAndExecuteTests( // Different test runs may want to have Dev Kit be active or in-active. // Rather than having to uninstall Dev Kit between different test runs, we use workspace settings - // to control which extensions are active - and we always install Dev Kit. + // and launch arguments to control which extensions are active - and we always install Dev Kit. const extensionsToInstall = [ 'ms-dotnettools.vscode-dotnet-runtime@3.0.0', 'ms-dotnettools.csharp', @@ -56,6 +56,11 @@ export async function prepareVSCodeAndExecuteTests( } const launchArgs = [workspacePath, '-n', '--user-data-dir', userDataDir, '--log', 'ms-dotnettools.csharp:trace']; + if (env.CODE_DISABLE_CSHARP_DEV_KIT === 'true') { + // Disabling all extensions would also disable C#'s required .NET runtime extension. + launchArgs.push('--disable-extension=ms-dotnettools.csdevkit'); + } + if (process.platform === 'linux') { // CI containers have a small /dev/shm allocation, which can cause the renderer to crash. launchArgs.push('--disable-dev-shm-usage');