Skip to content

Commit ee6980f

Browse files
authored
Merge pull request #6712 from dibarbet/merge_main
Snap main to release
2 parents f94bbb3 + 7976f10 commit ee6980f

File tree

10 files changed

+75
-422
lines changed

10 files changed

+75
-422
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@
66
- Debug from .csproj and .sln [#5876](https://github.com/dotnet/vscode-csharp/issues/5876)
77

88
## Latest
9+
* Update Roslyn to 4.9.0-3.23604.10 (PR: [#6676](https://github.com/dotnet/vscode-csharp/pull/6676))
10+
* Pass through folders for additional files (PR: [#71061](https://github.com/dotnet/roslyn/pull/71061))
11+
* Automatically detect missing NuGet packages and restore (PR: [#70851](https://github.com/dotnet/roslyn/pull/70851))
12+
* Enable route embedded language features in vscode (PR: [#70927](https://github.com/dotnet/roslyn/pull/70927))
13+
* Add automatic nuget restore support to C# standalone (PR: [#6676](https://github.com/dotnet/vscode-csharp/pull/6676))
14+
* Update required VSCode version to 1.75.0 (PR: [#6711](https://github.com/dotnet/vscode-csharp/pull/6711))
15+
* Update debugger docs to point to official documentation (PR: [#6674](https://github.com/dotnet/vscode-csharp/pull/6674))
16+
17+
## 2.12.19
918
* Update Roslyn to 4.9.0-2.23571.2 (PR: [#6681](https://github.com/dotnet/vscode-csharp/pull/6681))
1019
* Workaround vscode bug with returning defaultBehavior from prepareRename (PR: [#70840](https://github.com/dotnet/roslyn/pull/70840))
1120
* Implement textDocument/prepareRename to show error in invalid rename locations (PR: [#70724](https://github.com/dotnet/roslyn/pull/70724))

debugger-launchjson.md

Lines changed: 2 additions & 362 deletions
Large diffs are not rendered by default.

debugger.md

Lines changed: 9 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
1-
# Instructions for setting up the .NET Core debugger
2-
This page gives you detailed instructions on how to debug code running under .NET Core in VS Code.
1+
## .NET Debugging in Visual Studio Code
32

4-
#### Your Feedback​
5-
File bugs and feature requests [here](https://github.com/dotnet/vscode-csharp/issues) to help us build great tooling for .NET Core.
3+
While it is possible to use the C# extension as a standalone extension, we highly recommend using [C# Dev Kit](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp). When using C# Dev Kit, the [official C# debugger documentation](https://code.visualstudio.com/docs/csharp/debugging) and the [official getting started guide](https://code.visualstudio.com/docs/csharp/getting-started) should be used instead of this page.
4+
5+
## Getting started debugging without C# Dev Kit
6+
7+
This guide provides information on getting started with .NET debugging when using the C# extension without C# Dev Kit.
68

79
### First Time setup
810
##### 1: Get Visual Studio Code
911
Install Visual Studio Code (VS Code). Pick the latest VS Code version from here: https://code.visualstudio.com
1012

1113
##### 2: Install .NET command line tools
12-
Install the .NET Core command line tools (CLI) by following the installation part of the instructions here: https://dotnet.microsoft.com/download
14+
Install the .NET command line tools (CLI) by following the installation part of the instructions here: https://dotnet.microsoft.com/download
1315

1416
##### 3: Install C# Extension for VS Code
1517
Open the command palette in VS Code (press <kbd>F1</kbd>) and run `Extensions: Install Extensions`. Enter `C#` in the search box and press `Enter`. Select the extension and click on `Install`.
1618

1719
If you have previously installed the C# extension, make sure that you have a recent version. You can check this by opening the command palette (press <kbd>F1</kbd>) and running `Extensions: Show Installed Extensions`.
1820

19-
##### 4: Wait for download of platform-specific files
20-
The first time that C# code is opened in VS Code, the extension will download the platform-specific files needed for debugging and editing. Debugging and editor features will not work until these steps finish.
21-
22-
2321
### Once for each project
2422
The following steps have to be executed for every project.
2523
##### 1: Get a project
@@ -73,37 +71,13 @@ If your code was built on a different computer from where you would like to run
7371
#### [Configurating launch.json for C# Debugging](debugger-launchjson.md)
7472

7573
#### Attach Support
76-
The C# debugger supports attaching to processes. To do this, switch to the Debug tab, and open the configuration drop down.
7774

78-
![Debug launch configuration drop down](https://raw.githubusercontent.com/wiki/dotnet/vscode-csharp/images/debug-launch-configurations.png)
79-
80-
Select the '.NET Core Attach' configuration. Clicking the play button (or pressing <kbd>F5</kbd>) will then try to attach. In launch.json, if `processId` is set to `""` this will provide UI to select which process to attach to.
75+
See the [official documentation](https://code.visualstudio.com/docs/csharp/debugging#_attaching-to-a-process).
8176

8277
#### Remote Debugging
8378

8479
The debugger supports remotely launching or attaching to processes. See [Attaching to remote processes](https://github.com/dotnet/vscode-csharp/wiki/Attaching-to-remote-processes) in the wiki for more information.
8580

8681
#### Exception Settings
8782

88-
The VS Code .NET debugger supports configuration options for if the debugger stops when exceptions are thrown or caught. This is done through two different entries in the BREAKPOINTS section of the Run view:
89-
90-
![Exceptions settings in BREAKPOINTS Run View](https://raw.githubusercontent.com/wiki/dotnet/vscode-csharp/images/Exception-Settings.png)
91-
92-
Note that the BREAKPOINTS section will be missing these entries until the first time that the folder has been debugged with the .NET debugger.
93-
94-
Checking 'All Exceptions' will configure the debugger to stop when an exception is thrown. If Just My Code is enabled (which it is by default) the debugger will not break if an exception is internally thrown and caught in library code. Though if the exception is thrown in library code and returned to user code the debugger will break then.
95-
96-
Checking 'User-Unhandled Exceptions' will configure the debugger to stop when an exception is caught in non-user code after having been thrown in user code or traveled through user code. Exceptions that become user-unhandled aren't always a problem, it could be that user code is implementing an API and is expected to raise an exception in this scenario, but it is often a problem. So, by default, the debugger will stop when an exception becomes user-unhandled.
97-
98-
##### Exception Conditions
99-
Both checkboxes support conditions to break on only selected exception types. To edit the condition, click on the pencil icon (see image above) or right click on the entry and invoke 'Edit Condition'. The condition is a comma-separated list of exception types to break on, or if the list starts with '!', a list of exception types to ignore.
100-
101-
Examples conditions:
102-
103-
| Example condition value | Result |
104-
|-------------------------|--------|
105-
| System.NullReferenceException | This will break on just null reference exceptions. |
106-
| System.NullReferenceException, System.InvalidOperationException | This will break on both null reference exceptions and invalid operation exceptions. |
107-
| !System.Threading.Tasks.TaskCanceledException | This will break on all exceptions except for task canceled. |
108-
| !System.Threading.Tasks.TaskCanceledException, System.NotImplementedException | This will break on all exceptions except for task cancelled and not implemented. |
109-
83+
See the [official documentation](https://code.visualstudio.com/docs/csharp/debugging#_stopping-on-exceptions).

package.json

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
}
3838
},
3939
"defaults": {
40-
"roslyn": "4.9.0-2.23571.2",
40+
"roslyn": "4.9.0-3.23604.10",
4141
"omniSharp": "1.39.10",
4242
"razor": "7.0.0-preview.23528.1",
4343
"razorOmnisharp": "7.0.0-preview.23363.1",
@@ -1014,7 +1014,7 @@
10141014
}
10151015
],
10161016
"engines": {
1017-
"vscode": "^1.73.0"
1017+
"vscode": "^1.75.0"
10181018
},
10191019
"activationEvents": [
10201020
"onDebugInitialConfigurations",
@@ -1023,18 +1023,7 @@
10231023
"onDebugResolve:clr",
10241024
"onDebugResolve:dotnet",
10251025
"onLanguage:csharp",
1026-
"onLanguage:aspnetcorerazor",
1027-
"onCommand:o.restart",
1028-
"onCommand:o.pickProjectAndStart",
10291026
"onCommand:o.showOutput",
1030-
"onCommand:dotnet.restore.project",
1031-
"onCommand:dotnet.restore.all",
1032-
"onCommand:dotnet.generateAssets",
1033-
"onCommand:dotnet.openSolution",
1034-
"onCommand:csharp.downloadDebugger",
1035-
"onCommand:csharp.listProcess",
1036-
"onCommand:csharp.listRemoteProcess",
1037-
"onCommand:csharp.listRemoteDockerProcess",
10381027
"onCommand:omnisharp.registerLanguageMiddleware",
10391028
"workspaceContains:project.json",
10401029
"workspaceContains:**/*.{csproj,sln,slnf,csx,cake}"
@@ -1742,6 +1731,11 @@
17421731
"default": null,
17431732
"description": "Sets a path where MSBuild binary logs are written to when loading projects, to help diagnose loading errors."
17441733
},
1734+
"dotnet.projects.enableAutomaticRestore": {
1735+
"type": "boolean",
1736+
"default": true,
1737+
"description": "%configuration.dotnet.projects.enableAutomaticRestore%"
1738+
},
17451739
"razor.languageServer.directory": {
17461740
"type": "string",
17471741
"scope": "machine-overridable",

package.nls.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"configuration.dotnet.server.trace": "Sets the logging level for the language server",
3232
"configuration.dotnet.server.extensionPaths": "Override for path to language server --extension arguments",
3333
"configuration.dotnet.server.crashDumpPath": "Sets a folder path where crash dumps are written to if the language server crashes. Must be writeable by the user.",
34+
"configuration.dotnet.projects.enableAutomaticRestore": "Enables automatic NuGet restore if the extension detects assets are missing.",
3435
"configuration.dotnet.preferCSharpExtension": "Forces projects to load with the C# extension only. This can be useful when using legacy project types that are not supported by C# Dev Kit. (Requires window reload)",
3536
"configuration.dotnet.implementType.insertionBehavior": "The insertion location of properties, events, and methods When implement interface or abstract class.",
3637
"configuration.dotnet.implementType.insertionBehavior.withOtherMembersOfTheSameKind": "Place them with other members of the same kind.",

src/lsptoolshost/restore.ts

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@
55

66
import * as vscode from 'vscode';
77
import { RoslynLanguageServer } from './roslynLanguageServer';
8-
import { RestorableProjects, RestoreParams, RestorePartialResult, RestoreRequest } from './roslynProtocol';
8+
import {
9+
RestorableProjects,
10+
RestoreParams,
11+
RestorePartialResult,
12+
RestoreRequest,
13+
ProjectHasUnresolvedDependenciesRequest,
14+
} from './roslynProtocol';
915
import path = require('path');
1016

1117
let _restoreInProgress = false;
@@ -22,10 +28,15 @@ export function registerRestoreCommands(
2228
);
2329
context.subscriptions.push(
2430
vscode.commands.registerCommand('dotnet.restore.all', async (): Promise<void> => {
25-
return restore(languageServer, restoreChannel);
31+
return restore(languageServer, restoreChannel, [], true);
2632
})
2733
);
34+
35+
languageServer.registerOnRequest(ProjectHasUnresolvedDependenciesRequest.type, async (params) => {
36+
await restore(languageServer, restoreChannel, params.projectFilePaths, false);
37+
});
2838
}
39+
2940
async function chooseProjectAndRestore(
3041
languageServer: RoslynLanguageServer,
3142
restoreChannel: vscode.OutputChannel
@@ -49,22 +60,25 @@ async function chooseProjectAndRestore(
4960
return;
5061
}
5162

52-
await restore(languageServer, restoreChannel, pickedItem.description);
63+
await restore(languageServer, restoreChannel, [pickedItem.description!], true);
5364
}
5465

55-
async function restore(
66+
export async function restore(
5667
languageServer: RoslynLanguageServer,
5768
restoreChannel: vscode.OutputChannel,
58-
projectFile?: string
69+
projectFiles: string[],
70+
showOutput: boolean
5971
): Promise<void> {
6072
if (_restoreInProgress) {
6173
vscode.window.showErrorMessage(vscode.l10n.t('Restore already in progress'));
6274
return;
6375
}
6476
_restoreInProgress = true;
65-
restoreChannel.show(true);
77+
if (showOutput) {
78+
restoreChannel.show(true);
79+
}
6680

67-
const request: RestoreParams = { projectFilePath: projectFile };
81+
const request: RestoreParams = { projectFilePaths: projectFiles };
6882
await vscode.window
6983
.withProgress(
7084
{

src/lsptoolshost/roslynLanguageServer.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
MessageTransports,
2828
RAL,
2929
CancellationToken,
30+
RequestHandler,
3031
} from 'vscode-languageclient/node';
3132
import { PlatformInformation } from '../shared/platform';
3233
import { readConfigurations } from './configurationMiddleware';
@@ -319,6 +320,13 @@ export class RoslynLanguageServer {
319320
return response;
320321
}
321322

323+
public registerOnRequest<Params, Result, Error>(
324+
type: RequestType<Params, Result, Error>,
325+
handler: RequestHandler<Params, Result, Error>
326+
) {
327+
this._languageClient.addDisposable(this._languageClient.onRequest(type, handler));
328+
}
329+
322330
public async registerSolutionSnapshot(token: vscode.CancellationToken): Promise<SolutionSnapshotId> {
323331
const response = await this.sendRequest0(RoslynProtocol.RegisterSolutionSnapshotRequest.type, token);
324332
if (response) {

src/lsptoolshost/roslynProtocol.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,17 +152,24 @@ export interface NamedPipeInformation {
152152

153153
export interface RestoreParams extends lsp.WorkDoneProgressParams, lsp.PartialResultParams {
154154
/**
155-
* An optional file path to restore.
156-
* If none is specified, the solution (or all loaded projects) are restored.
155+
* The set of projects to restore.
156+
* If none are specified, the solution (or all loaded projects) are restored.
157157
*/
158-
projectFilePath?: string;
158+
projectFilePaths: string[];
159159
}
160160

161161
export interface RestorePartialResult {
162162
stage: string;
163163
message: string;
164164
}
165165

166+
export interface UnresolvedProjectDependenciesParams {
167+
/**
168+
* The set of projects that have unresolved dependencies and require a restore.
169+
*/
170+
projectFilePaths: string[];
171+
}
172+
166173
export namespace WorkspaceDebugConfigurationRequest {
167174
export const method = 'workspace/debugConfiguration';
168175
export const messageDirection: lsp.MessageDirection = lsp.MessageDirection.clientToServer;
@@ -260,3 +267,9 @@ export namespace RestorableProjects {
260267
export const messageDirection: lsp.MessageDirection = lsp.MessageDirection.clientToServer;
261268
export const type = new lsp.RequestType0<string[], void>(method);
262269
}
270+
271+
export namespace ProjectHasUnresolvedDependenciesRequest {
272+
export const method = 'workspace/_roslyn_projectHasUnresolvedDependencies';
273+
export const messageDirection: lsp.MessageDirection = lsp.MessageDirection.serverToClient;
274+
export const type = new lsp.RequestType<UnresolvedProjectDependenciesParams, void, void>(method);
275+
}

src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ export async function activate(
8383
// ensure it gets properly disposed. Upon disposal the events will be flushed.
8484
context.subscriptions.push(reporter);
8585

86-
const csharpChannel = vscode.window.createOutputChannel('C#');
8786
const dotnetTestChannel = vscode.window.createOutputChannel('.NET Test Log');
8887
const dotnetChannel = vscode.window.createOutputChannel('.NET NuGet Restore');
88+
const csharpChannel = vscode.window.createOutputChannel('C#');
8989
const csharpchannelObserver = new CsharpChannelObserver(csharpChannel);
9090
const csharpLogObserver = new CsharpLoggerObserver(csharpChannel);
9191
eventStream.subscribe(csharpchannelObserver.post);

version.json

Lines changed: 1 addition & 1 deletion
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.12",
3+
"version": "2.13",
44
"publicReleaseRefSpec": [
55
"^refs/heads/release$",
66
"^refs/heads/main$",

0 commit comments

Comments
 (0)