Trying to run C#, C# Dev Kit on MacBook Pro Version 11.7.10, visual studio code Version 1.90.2 (Universal)

G 20 Reputation points
2024-09-20T08:42:53.33+00:00

Hi. I started to learn C# and trying to run it on visual studio code. Does not work. When I press F5, i get a pop up window with "Internal error in the debugger. Open 'launch.json' or Cancel", launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": ".NET Core Attach",
            "type": "coreclr",
            "request": "attach"
        },

        {
            // Use IntelliSense to find out which attributes exist for C# debugging
            // Use hover for the description of the existing attributes
            // For further information visit https://github.com/dotnet/vscode-csharp/blob/main/debugger-launchjson.md
            "name": ".NET Core Launch (console)",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "build",
            // If you have changed target frameworks, make sure to update the program path.
            "program": "${workspaceFolder}/bin/Debug/net8.0/TestApp2.dll",
            "args": [],
            "cwd": "${workspaceFolder}",
            // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
            "console": "internalConsole",
            "stopAtEntry": false
        },
        {
            "name": ".NET Core Attach",
            "type": "coreclr",
            "request": "attach"
        }
    ]
}

Output for C# shows:

[ERROR] The debugger cannot be installed. The debugger requires macOS 12 (Monterey) or newer.
Using dotnet configured on PATH
Dotnet path: /usr/local/share/dotnet/dotnet
Activating C# + C# Dev Kit + C# IntelliCode...
waiting for named pipe information from server...
[stdout] {"pipeName":"/var/folders/jz/xnz4fzzx0fq7j0qtn2h6pf_r0000gn/T/0dd48324.sock"}
received named pipe information from server
attempting to connect client to server...
client has connected to server
[Info  - 16:27:21] [Program] Language server initialized
[Info  - 16:27:39] [WorkspaceProjectFactoryService] Project /Users/Giedre/Documents/TestApp2/TestApp2.csproj loaded by C# Dev Kit

Output for C# Dev Kit:

Starting Spawn .NET server...
Starting opening a solution...
Starting processing the solution file "/Users/Giedre/Documents/TestApp2/TestApp2.sln" in Dev Kit server...
Using preinstalled .NET runtime at "/usr/local/share/dotnet/dotnet" to load Dev Kit processes.
Found installed dotnet location "/usr/local/share/dotnet/dotnet" to load projects.
.NET server started and IPC established in 5624ms
Completed Spawn .NET server (9303ms)
Completed processing the solution file "/Users/Giedre/Documents/TestApp2/TestApp2.sln" in Dev Kit server (12778ms)
Starting restoring NuGet packages...
Selected configuration: <Default>, active configuration: Debug|Any CPU
Completed opening a solution (12797ms)
Starting command: "dotnet" restore /Users/Giedre/Documents/TestApp2/TestApp2.sln --interactive...
Completed command: "dotnet" restore /Users/Giedre/Documents/TestApp2/TestApp2.sln --interactive (9678ms)
Completed restoring NuGet packages (9682ms)
IdeBenefitsSource: Failed to fetch entitlements. Error: 'Error: Request to https://api.subscriptions.visualstudio.microsoft.com/Me/Entitlements/IDEBenefits?api-version=2023-03-26&caller=vscode failed with status code: 401 and response ""'
IdeBenefitsSource: Failed to fetch entitlements. Error: 'Error: Request to https://api.subscriptions.visualstudio.microsoft.com/Me/Entitlements/IDEBenefits?api-version=2023-03-26&caller=vscode failed with status code: 401 and response ""'
IdeBenefitsSource: Failed to fetch entitlements. Error: 'Error: Request to https://api.subscriptions.visualstudio.microsoft.com/Me/Entitlements/IDEBenefits?api-version=2023-03-26&caller=vscode failed with status code: 401 and response ""'
IdeBenefitsSource: Failed to fetch entitlements. Error: 'Error: Request to https://api.subscriptions.visualstudio.microsoft.com/Me/Entitlements/IDEBenefits?api-version=2023-03-26&caller=vscode failed with status code: 401 and response ""'
IdeBenefitsSource: Failed to fetch entitlements. Error: 'Error: Request to https://api.subscriptions.visualstudio.microsoft.com/Me/Entitlements/IDEBenefits?api-version=2023-03-26&caller=vscode failed with status code: 401 and response ""'
IdeBenefitsSource: Failed to fetch entitlements. Error: 'Error: Request to https://api.subscriptions.visualstudio.microsoft.com/Me/Entitlements/IDEBenefits?api-version=2023-03-26&caller=vscode failed with status code: 401 and response ""'
Starting Query for all projects...
Completed Query for all projects (67ms)
Reporting build results to C# extension.
No problems found in the build
Reporting build results to C# extension.
No problems found in the build

When I put command dotnet run, it works, terminal shows "Hello, World!"

But Run & Debug is not working. I get the same pop up message: "Internal error in the debugger. Open 'launch.json' or Cancel".

I .Net 8.0 downloaded.

What to do..? :/

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,834 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,902 questions
Visual Studio Debugging
Visual Studio Debugging
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Debugging: The act or process of detecting, locating, and correcting logical or syntactical errors in a program or malfunctions in hardware. In hardware contexts, the term troubleshoot is the term more frequently used, especially if the problem is major.
999 questions
0 comments No comments
{count} votes

Accepted answer
  1. Tianyu Sun-MSFT 30,561 Reputation points Microsoft Vendor
    2024-09-20T13:48:12.75+00:00

    Hello @G,

    Thank you for taking time to post this issue in Microsoft Q&A forum.

    I see that the error says

    [ERROR] The debugger cannot be installed. The debugger requires macOS 12 (Monterey) or newer.

    Looks like you are using macOS 11?

    Please kindly refer to this ticket: [macOS 11 x64] Cannot compile or debug with VSCode for C# Program:

    The issue is that the debugger now builds on macOS 12 machines as macOS 11 is deprecated for Azure Pipeline Build Agents. See https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops&tabs=yaml#software

    The workaround would be to use an older version of the C# Extension starting from v2.33.17 or before or update your macOS to macOS 12.

    Also .NET 8 only supports macOS 12+ …

    Sincerely,

    Tianyu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.