Skip to content

Commit fe9c960

Browse files
[automated] Merge branch 'main' => 'prerelease' (#8139)
2 parents 263fd07 + e3d1d11 commit fe9c960

File tree

7 files changed

+39
-17
lines changed

7 files changed

+39
-17
lines changed

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
- Diagnostics related feature requests and improvements [#5951](https://github.com/dotnet/vscode-csharp/issues/5951)
44
- Debug from .csproj and .sln [#5876](https://github.com/dotnet/vscode-csharp/issues/5876)
55

6+
# 2.73.x
7+
* Bump Roslyn to 5.0.0-1.25204.1 (PR: [#8138](https://github.com/dotnet/vscode-csharp/pull/8138))
8+
* [View Complete Diff of Changes](https://github.com/dotnet/roslyn/compare/1a06295e3cd3e57be2c79953f16db724db119a4f...ad1c386da419e0d6fe9f25a1f41e5cc2368964e7?w=1)
9+
* Don't show duplicate toast if C# Dev Kit fails to activate (PR: [#8135](https://github.com/dotnet/vscode-csharp/pull/8135))
10+
* Bump xamlTools to 17.14.36004.3 (PR: [#8134](https://github.com/dotnet/vscode-csharp/pull/8134))
11+
* Acquire aspnetcore runtime when using Dev Kit to avoid double acquisition (PR: [#8132](https://github.com/dotnet/vscode-csharp/pull/8132))
12+
613
# 2.72.x
714
* Revert xamlTools to 17.14.35913.250 (PR: [#8121](https://github.com/dotnet/vscode-csharp/pull/8121))
815
* Update Roslyn to 4.14.0-3.25178.1 (PR: [#8103](https://github.com/dotnet/vscode-csharp/pull/8103))

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@
3737
}
3838
},
3939
"defaults": {
40-
"roslyn": "4.14.0-3.25178.1",
40+
"roslyn": "5.0.0-1.25204.1",
4141
"omniSharp": "1.39.12",
4242
"razor": "9.0.0-preview.25177.4",
4343
"razorOmnisharp": "7.0.0-preview.23363.1",
44-
"xamlTools": "17.14.35913.250"
44+
"xamlTools": "17.14.36004.3"
4545
},
4646
"main": "./dist/extension",
4747
"l10n": "./l10n",

src/lsptoolshost/dotnetRuntime/dotnetRuntimeExtensionApi.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export interface IDotnetFindPathContext {
2424
/**
2525
* https://github.com/dotnet/vscode-dotnet-runtime/blob/main/vscode-dotnet-runtime-library/src/IDotnetAcquireContext.ts
2626
*/
27-
interface IDotnetAcquireContext {
27+
export interface IDotnetAcquireContext {
2828
version: string;
2929
requestingExtensionId?: string;
3030
errorConfiguration?: AcquireErrorConfiguration;
@@ -49,7 +49,7 @@ enum AcquireErrorConfiguration {
4949
/**
5050
* https://github.com/dotnet/vscode-dotnet-runtime/blob/main/vscode-dotnet-runtime-library/src/Acquisition/DotnetInstallMode.ts
5151
*/
52-
type DotnetInstallMode = 'sdk' | 'runtime' | 'aspnetcore';
52+
export type DotnetInstallMode = 'sdk' | 'runtime' | 'aspnetcore';
5353

5454
/**
5555
* https://github.com/dotnet/vscode-dotnet-runtime/blob/main/vscode-dotnet-runtime-library/src/DotnetVersionSpecRequirement.ts

src/lsptoolshost/dotnetRuntime/dotnetRuntimeExtensionResolver.ts

+23-12
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,14 @@ import { languageServerOptions } from '../../shared/options';
1212
import { existsSync } from 'fs';
1313
import { CSharpExtensionId } from '../../constants/csharpExtensionId';
1414
import { readFile } from 'fs/promises';
15-
import { IDotnetAcquireResult, IDotnetFindPathContext } from './dotnetRuntimeExtensionApi';
15+
import {
16+
DotnetInstallMode,
17+
IDotnetAcquireContext,
18+
IDotnetAcquireResult,
19+
IDotnetFindPathContext,
20+
} from './dotnetRuntimeExtensionApi';
1621
import { DotNetRuntimeExtensionId } from '../../checkDotNetRuntimeExtensionVersion';
22+
import { getCSharpDevKit } from '../../utils/getCSharpDevKit';
1723

1824
const DotNetMajorVersion = '9';
1925
const DotNetMinorVersion = '0';
@@ -41,14 +47,18 @@ export class DotnetRuntimeExtensionResolver implements IHostExecutableResolver {
4147
return this.hostInfo;
4248
}
4349

50+
const usingDevkit = getCSharpDevKit() !== undefined;
51+
// If we're using devkit, acquire aspnetcore as well - this avoids two separate acquisitions (devkit requires aspnetcore).
52+
const runtimeMode: DotnetInstallMode = usingDevkit ? 'aspnetcore' : 'runtime';
53+
4454
this.channel.appendLine(`Locating .NET runtime version ${DotNetRuntimeVersion}`);
4555
const extensionArchitecture = (await this.getArchitectureFromTargetPlatform()) ?? process.arch;
4656
const findPathRequest: IDotnetFindPathContext = {
4757
acquireContext: {
4858
version: DotNetRuntimeVersion,
4959
requestingExtensionId: CSharpExtensionId,
5060
architecture: extensionArchitecture,
51-
mode: 'runtime',
61+
mode: runtimeMode,
5262
},
5363
versionSpecRequirement: 'greater_than_or_equal',
5464
// Reject previews because we are not setting `DOTNET_ROLL_FORWARD_TO_PRERELEASE` when starting the server.
@@ -62,7 +72,7 @@ export class DotnetRuntimeExtensionResolver implements IHostExecutableResolver {
6272
this.channel.appendLine(
6373
`Did not find .NET ${DotNetRuntimeVersion} on path, falling back to acquire runtime via ${DotNetRuntimeExtensionId}`
6474
);
65-
acquireResult = await this.acquireDotNetProcessDependencies();
75+
acquireResult = await this.acquireDotNetProcessDependencies(runtimeMode);
6676
}
6777

6878
const dotnetExecutablePath = acquireResult.dotnetPath;
@@ -103,21 +113,22 @@ export class DotnetRuntimeExtensionResolver implements IHostExecutableResolver {
103113
* Acquires the .NET runtime if it is not already present.
104114
* @returns The path to the .NET runtime
105115
*/
106-
private async acquireRuntime(): Promise<IDotnetAcquireResult> {
116+
private async acquireRuntime(mode: DotnetInstallMode): Promise<IDotnetAcquireResult> {
107117
// The runtime extension doesn't support specifying a patch versions in the acquire API, so we only use major.minor here.
108118
// That is generally OK, as acquisition will always acquire the latest patch version.
109119
const dotnetAcquireVersion = `${DotNetMajorVersion}.${DotNetMinorVersion}`;
110-
let status = await vscode.commands.executeCommand<IDotnetAcquireResult>('dotnet.acquireStatus', {
120+
121+
const acquireContext: IDotnetAcquireContext = {
111122
version: dotnetAcquireVersion,
112123
requestingExtensionId: CSharpExtensionId,
113-
});
124+
mode: mode,
125+
};
126+
127+
let status = await vscode.commands.executeCommand<IDotnetAcquireResult>('dotnet.acquireStatus', acquireContext);
114128
if (status === undefined) {
115129
await vscode.commands.executeCommand('dotnet.showAcquisitionLog');
116130

117-
status = await vscode.commands.executeCommand<IDotnetAcquireResult>('dotnet.acquire', {
118-
version: dotnetAcquireVersion,
119-
requestingExtensionId: CSharpExtensionId,
120-
});
131+
status = await vscode.commands.executeCommand<IDotnetAcquireResult>('dotnet.acquire', acquireContext);
121132
if (!status) {
122133
throw new Error('Could not resolve the dotnet path!');
123134
}
@@ -130,8 +141,8 @@ export class DotnetRuntimeExtensionResolver implements IHostExecutableResolver {
130141
* Acquires the .NET runtime and any other dependencies required to spawn a particular .NET executable.
131142
* @param path The path to the entrypoint assembly. Typically a .dll.
132143
*/
133-
private async acquireDotNetProcessDependencies(): Promise<IDotnetAcquireResult> {
134-
const acquireResult = await this.acquireRuntime();
144+
private async acquireDotNetProcessDependencies(mode: DotnetInstallMode): Promise<IDotnetAcquireResult> {
145+
const acquireResult = await this.acquireRuntime(mode);
135146

136147
const args = [this.getServerPath(this.platformInfo)];
137148
// This will install any missing Linux dependencies.

test/lsptoolshost/integrationTests/formatting.integration.test.ts

+3
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ describe(`Formatting Tests`, () => {
3939
'using Options;',
4040
'using System;',
4141
'namespace Formatting;',
42+
'',
4243
'class DocumentFormatting',
4344
'{',
4445
' public int Property1',
@@ -108,6 +109,7 @@ describe(`Formatting Tests`, () => {
108109
'using System;',
109110
'using Options;',
110111
'namespace Formatting;',
112+
'',
111113
'class DocumentFormatting',
112114
'{',
113115
' public int Property1',
@@ -134,6 +136,7 @@ describe(`Formatting Tests`, () => {
134136
'using Options;',
135137
'using System;',
136138
'namespace Formatting;',
139+
'',
137140
'class DocumentFormatting',
138141
'{',
139142
' public int Property1',

test/lsptoolshost/integrationTests/formattingEditorConfig.integration.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ describe(`Formatting With EditorConfig Tests`, () => {
3939

4040
const expectedText = [
4141
'namespace Formatting;',
42+
'',
4243
'class DocumentFormattingWithEditorConfig {',
4344
' public int Property1 {',
4445
' get; set;',

version.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
3-
"version": "2.72",
3+
"version": "2.73",
44
"publicReleaseRefSpec": [
55
"^refs/heads/release$",
66
"^refs/heads/prerelease$",

0 commit comments

Comments
 (0)