Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Register restore commands even if DevKit is being used#8428

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
RikkiGibson wants to merge6 commits intomain
base:main
Choose a base branch
Loading
fromdev/rigibson/use-restore-commands-with-cdk

Conversation

RikkiGibson
Copy link
Member

@RikkiGibsonRikkiGibson commentedJul 17, 2025
edited
Loading

The bug we observed with restore is: we have a new, specific restore behavior for file-based apps, which is implemented only in the base C# extension. When CDK is also loaded, the client simply never responds toprojectNeedsRestore messages and similar from the server.

But CDK doesn't handle restore of file-based apps. So the effect we see is: when both C#+CDK are loaded together in VS Code (from a fresh "reload window" or fresh startup), restore will just not work. The client will silently not initiate the restore process.

I doubt that just always attaching the restore handlers anyways is the right solution. But, as a short term solution, we could simply attach the handlers and say:if CDK is loaded, then only do the restore for file-based apps, while assuming CDK continues to handle projects and solutions.

Wouldn't it be most reasonable to "forward" the message to CDK, and have some way of deciding if CDK handled it, and if they did not, then we handle it? Sorta like how UI event handlers bubble events up? Maybe this doesn't work because CDK has its own completely different mechanism for watching for relevant changes and doing the right thing automatically.

@jasonmalinowski@dibarbet

@@ -21,7 +21,8 @@ let _restoreInProgress = false;
exportfunctionregisterRestoreCommands(context:vscode.ExtensionContext,languageServer:RoslynLanguageServer){
if(getCSharpDevKit()){
// We do not need to register restore commands if using C# devkit.
return;
// TODO: restore commands for FBPs still need to run, even if devkit is being used.
// return;
}
constrestoreChannel=vscode.window.createOutputChannel(vscode.l10n.t('.NET NuGet Restore'));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

this is going to very unfortunately create a second nuget restore channel. Other than having devkit do the restore though I don't have a great alternative. But we should get an issue filed on this at the very least.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Could we use the C# log for the time being? Had the O# extension not separated them, I am not sure I would have the distinction. OR, possibly I would have put all project system logging into the restore one.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

My preference would actually be to put these in the C# log. When we split across output windows it just becomes harder to tell the order that things occur in. Even when there are timestamps (which I am adding in this PR.)

However to reduce scope I am going to refrain from renaming or moving which output channel we use here.

Also, what isl10n? Is this just a super weird abbreviation? An 'l' then 10 letters then an 'n' to make 'localization'?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

n 'l' then 10 letters then an 'n' to make 'localization'?

Yup!

Copy link
Member

@dibarbetdibarbetJul 18, 2025
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Agreed, lets do the C# window then. Better than a duplicate output window.

constrestoreChannel=vscode.window.createOutputChannel(vscode.l10n.t('.NET NuGet Restore'));
context.subscriptions.push(
vscode.commands.registerCommand('dotnet.restore.project',async(_request):Promise<void>=>{
if(getCSharpDevKit()){
appendLineWithTimestamp(restoreChannel,"Not handling command 'dotnet.restore.project' from C# extension, because C# Dev Kit is expected to handle it.");
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Interestingly, when C#+CDK are loaded together to begin with, I cannot get these lines to run, but then if I unload+reload CDK, restart language server, (but do not reload window), I can get them to run.

I think this is related to some other mechanism unregistering the "dotnet restore" commands when CDK is loaded. The ".NET: Restore all projects" and ".NET: Restore projects" commands are just not there when CDK is loaded.

Thankfully since the last handler is for a language server message, not for a VS Code command, it will get hit regardless of whether CDK is loaded, when the project system says there are unresolved assets.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The general goal and philosophy of the change is: deviate behavior as late as possible, and as little as possible, and make it clear that the deviation is occurring, when the thing we are supposed to do, depends on Dev Kit being loaded or not. I think this is something we should look at doing with other calls togetCSharpDevKit() also.

@RikkiGibson

This comment was marked as resolved.

@RikkiGibsonRikkiGibson marked this pull request as ready for reviewJuly 18, 2025 21:14
@RikkiGibsonRikkiGibson requested a review froma team as acode ownerJuly 18, 2025 21:14
@RikkiGibson
Copy link
MemberAuthor

Unsure what to do with the following failure:https://dev.azure.com/dnceng-public/public/_build/results?buildId=1099482&view=ms.vss-test-web.build-test-results-tab&runId=30068902&resultId=100010&paneView=debug

Expected value: not "dotnet.restore.project"
Received array: [...]

Basically what I am observing in the running product is that these commands aren't available to run when CDK is loaded. If you unload CDK they appear, reload and they disappear. So I am wondering if something about how we are detecting the commands in this context, is out of sync with the VS Code editor.

@dibarbet
Copy link
Member

@RikkiGibson you need to remove the enablement in the package.json to ensure it is enabled in all contexts -

"enablement":"dotnet.server.activationContext == 'Roslyn' || dotnet.server.activationContext == 'OmniSharp'"

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@JoeRobichJoeRobichJoeRobich left review comments

@dibarbetdibarbetAwaiting requested review from dibarbet

At least 1 approving review is required to merge this pull request.

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@RikkiGibson@dibarbet@JoeRobich

[8]ページ先頭

©2009-2025 Movatter.jp