Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C# Debugging #4599

Closed
Nightfall333 opened this issue Jun 6, 2021 · 9 comments
Closed

C# Debugging #4599

Nightfall333 opened this issue Jun 6, 2021 · 9 comments

Comments

@Nightfall333
Copy link

When i try to run my code, it says that I need an extension. It then takes me to a list of extensions. I tried them all and none of them work.

@superman-lopez
Copy link

@Nightfall333 You have installed the "C# for Visual Studio Code" extension, and it's enabled?

@WardenGnaw
Copy link
Contributor

The "Error "You don't have an extension of ..." with debugger extension" Dialog comes from VSCode.

Potentially a duplicate of microsoft/vscode#123881

@WardenGnaw
Copy link
Contributor

WardenGnaw commented Jun 11, 2021

Actually, still hitting this on 1.57.

VS Code Version
Version: 1.57.0 (user setup)
Commit: b4c1bd0a9b03c749ea011b06c6d2676c8091a70c
Date: 2021-06-09T17:18:42.354Z
Electron: 12.0.9
Chrome: 89.0.4389.128
Node.js: 14.16.0
V8: 8.9.255.25-electron.0
OS: Windows_NT x64 10.0.19043

@isidorn @weinand Is there something we are missing in our package.json?

Repro steps:

  1. Install .NET 5
  2. Run dotnet new console
  3. Open VS Code in this folder
  4. F5 the Program.cs file

Expected:
See configuration options

Actual:

Error:
image
Installed Extensions
image

Extension Author (truncated) Version
csharp ms- 1.23.12
remote-wsl ms- 0.56.5
cpptools ms- 1.4.1
powershell ms- 2021.5.1

Side note:
"Create launch.json" shows the debug configurations.
image

@isidorn
Copy link
Contributor

isidorn commented Jun 22, 2021

@WardenGnaw sorry for the slow response I was on vacation the previous week.
Your extension needs to say that it is interested in the C# language in your package.json
Here's an example how mock debug is doing that https://github.com/microsoft/vscode-mock-debug/blob/main/package.json#L135

Can you please try that and let me know how it goes?
Thanks!

@WardenGnaw
Copy link
Contributor

sorry for the slow response I was on vacation the previous week.

No worries! I hope you had a wonderful vacation!


Was there a change recently that required this? I thought the debugger language was covered by the breakpoints section of the package.json.

Can you please try that and let me know how it goes?

That resolved the prompt, thanks for the suggestion for a quick fix 😃

@isidorn
Copy link
Contributor

isidorn commented Jun 22, 2021

The breakpoints section only controls if breakpoint can be set in a file or not. It is not even part of the debuggers contribution because we wanted to keep this separate.

We always had a debuggers.languages contribution and we treated it as a way for extension to notify VS Code that they are interested in a language. VS Code would use this knowledge when user tries to debug without a launch.json. For example if the user has a python file and presses F5 we would pick the Python debugger to start debugging and figure out what to do even though there is no launch.json.

Last milestone there was a change which broke C# - sorry about that! C# seems to have been using an approach that an F5 on a C# file would have to generate launch configs, even though C# never mentioned that it is interested in C# files.
This was working until last milestone, but we made our requirements stronger that in order to support debugging with no launch.json the debug extension now has to specify it supports a language.
This has improved the scenario where a user has no C# extension, the user has a .cs file and presses F5. Now we will prompt the user properly to install the C# extension. Which I think is a very nice flow for new users.

I hope this clarifies why we changed this.

@weinand
Copy link

weinand commented Jun 22, 2021

@isidorn If a user has the C# extension installed, it does not make a lot of sense to show this dialog:

121737078-40306b00-caad-11eb-844c-4869c0c42654

Yes, I understand that the missing "debuggers.languages" contribution prevents us from knowing whether one of the installed debugging extensions will work for C# files.

How can we fix this?
I see these options:

  • since our change will break all debugging extensions that lack the "debuggers.languages" contribution, we will have to make sure that all debugger extensions add a proper "debuggers.languages" contribution before we can release the new feature. This means that we cannot ship the feature in this milestone.
  • if we don't want to wait until all debuggers have been updated, we could either:
    • use the breakpoints contribution in a debugger's package.json as a strong indication for whether the debugger can handle the file type, or
    • show a debugger Quickpick to let the user select one of his debugger extensions, and only if there is none let the user search on the Marketplace.

@weinand
Copy link

weinand commented Jun 23, 2021

I've created microsoft/vscode#126962 for discussing the general issue behind this.

@JoeRobich
Copy link
Member

Closing as resolved.

@JoeRobich JoeRobich closed this as not planned Won't fix, can't repro, duplicate, stale Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants