microsoft / vscode-dotnettools

This is a feedback repository to capture issues logged for the C# Dev Kit and related extensions from Visual Studio Code
Other
229 stars 12 forks source link

Logging into C# Dev Kit causes 401 with individual license #1512

Open kroppt opened 1 month ago

kroppt commented 1 month ago

Type: Bug

  1. Install C# Dev Kit
  2. Open a solution with C# Dev Kit running
  3. Log into C# Dev Kit with an individual license
  4. See error logged under "C# Dev Kit": 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 ""'
  5. The language server does not function

The following did not help:

Extension version: 1.10.18 VS Code version: Code 1.94.0 (d78a74bcdfad14d5d3b1b782f87255d802b57511, 2024-10-02T13:08:12.626Z) OS version: Windows_NT x64 10.0.22631 Modes:

System Info |Item|Value| |---|---| |CPUs|AMD Ryzen 9 7950X 16-Core Processor (32 x 4492)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off| |Load (avg)|undefined| |Memory (System)|63.74GB (52.09GB free)| |Process Argv|--crash-reporter-id a10ff85b-4c8a-4979-96cf-e564dec7cc0f| |Screen Reader|no| |VM|0%|
A/B Experiments ``` vsliv368cf:30146710 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscod805:30301674 binariesv615:30325510 vsaa593:30376534 py29gd2263:31024239 c4g48928:30535728 azure-dev_surveyone:30548225 962ge761:30959799 pythongtdpath:30769146 welcomedialog:30910333 pythonnoceb:30805159 asynctok:30898717 pythonmypyd1:30879173 h48ei257:31000450 pythontbext0:30879054 accentitlementsc:30995553 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 dsvsc021:30996838 9c06g630:31013171 a69g1124:31058053 dvdeprecation:31068756 dwnewjupytercf:31046870 impr_priority:31102340 nativerepl1:31139838 refactort:31108082 pythonrstrctxt:31112756 flighttreat:31134774 wkspc-onlycs-t:31132770 wkspc-ranged-t:31151552 cf971741:31144450 autoexpandse:31146404 iacca2:31150323 5fd0e150:31146321 ```
Li-su0 commented 4 weeks ago

Try these methods here; they can help alleviate your urgent needs. 1384

kroppt commented 4 weeks ago

Try these methods here; they can help alleviate your urgent needs. 1384

Thank you for the suggestion. Yes, I worked with only the C# extension, which does not need login. I disabled C# Dev Kit until this problem is fixed.

AyrtonAlbuquerque commented 2 weeks ago

I'm also having this problem but on Ubuntu only. In my windows 11 setup it works fine but in the Ubuntu this error occurs.

arunchndr commented 6 days ago

@AndreyTretyak would you please take a look? Related is https://github.com/microsoft/vscode-dotnettools/issues/1384

kroppt commented 5 days ago

I just tested this with the latest VSCode 1.95.0, C# 2.50.27, and C# Dev Kit 1.11.14.

The error shows up in the C# Dev Kit logs, but the behavior is a bit different. The LSP functionality appears to be working, but it's not clear whether the C# extension is falling back to Omnisharp or sticking with C# Dev Kit (somehow). It seems like it's working with the C# Dev Kit LSP.

C# logs:

Using dotnet configured on PATH
Dotnet path: C:\Program Files\dotnet\dotnet.exe
Activating C# + C# Dev Kit...
waiting for named pipe information from server...
[stdout] {"pipeName":"\\\\.\\pipe\\bab8c11a"}
received named pipe information from server
attempting to connect client to server...
client has connected to server
[Info  - 8:06:16 PM] [Program] Language server initialized
[Info  - 8:06:18 PM] [WorkspaceProjectFactoryService] Project --snip--.csproj loaded by C# Dev Kit
[Info  - 8:06:18 PM] [WorkspaceProjectFactoryService] Project --snip--.csproj loaded by C# Dev Kit

C# Dev Kit logs:

Starting Spawn .NET server...
Starting opening a solution...
Starting processing the solution file "--snip--.sln" in Dev Kit server...
Using preinstalled .NET runtime at "C:\Program Files\dotnet\dotnet.exe" to load Dev Kit processes.
Found installed dotnet location "C:\Program Files\dotnet\dotnet.exe" to load projects.
.NET server started and IPC established in 695ms
Completed Spawn .NET server (1042ms)
Completed processing the solution file "--snip--.sln" in Dev Kit server (1458ms)
Starting restoring NuGet packages...
Selected configuration: <Default>, active configuration: Debug|Any CPU
Completed opening a solution (1468ms)
Starting command: "dotnet.exe" restore --snip--.sln --interactive...
Completed command: "dotnet.exe" restore --snip--.sln --interactive (539ms)
Completed restoring NuGet packages (542ms)
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 (42ms)

If it helps, I noticed the Microsoft Authentication logs show the following:

2024-10-29 20:06:17.201 [info] Getting sessions for all scopes...
2024-10-29 20:06:17.201 [info] Got 5 sessions for all scopes...
2024-10-29 20:06:18.524 [info]  for undefined
2024-10-29 20:06:18.524 [info] [--snip--/.default VSCODE_TENANT:organizations email offline_access openid profile] Got 1 sessions

Even though things are currently "working", I'd rather keep this open until we know it's fixed.