dotnet / aspire

An opinionated, cloud ready stack for building observable, production ready, distributed applications in .NET
https://learn.microsoft.com/dotnet/aspire
MIT License
3.66k stars 417 forks source link

IDE Certificate Expires When Visual Studio is Open For a Long Time #5548

Open jdasilva-olo opened 2 weeks ago

jdasilva-olo commented 2 weeks ago

Is there an existing issue for this?

Describe the bug

If Visual Studio is left running for more than 1 week (7 days), it appears that after midnight the certificate served by the IDE will expire and DCP will not be able to connect. Apparently, I leave Visual Studio open a lot because I've hit this a few times over the last couple of months. Restarting Visual Studio fixes the problem.

Expected Behavior

This is not a high priority but a small quality of life issue. It would be nice if the resolution were more obvious (like adding a "did you try restarting your IDE" or something similar) or even better if there was some way for Visual Studio to auto-refresh the cert even if I have to ack it in a dialog.

It can be a little difficult to spot when running tests especially because it retries for a while.

Steps To Reproduce

Any Aspire project will do, but you need to leave the IDE open for over 7 days.

Exceptions (if any)

Aspire.Hosting.Dcp.dcpctrl.IdeExecutableRunner: Error: failed to connect to IDE run session notification endpoint, retrying... {"error": "tls: failed to verify certificate: x509: certificate has expired or is not yet valid: current time 2024-09-05T00:36:00-04:00 is after 2024-09-05T03:57:22Z"}

From ProcExp Properties: image

.NET Version info

.NET SDK: Version: 8.0.400 Commit: 36fe6dda56 Workload version: 8.0.401 MSBuild version: 17.11.3+0c8610977

Runtime Environment: OS Name: Windows OS Version: 10.0.19045 OS Platform: Windows RID: win-x64 Base Path: C:\Program Files\dotnet\sdk\8.0.400\

.NET workloads installed: Configured to use workload sets when installing new manifests. [aspire] Installation Source: SDK 8.0.400, VS 17.11.35219.272 Manifest Version: 8.1.0/8.0.100 Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.1.0\WorkloadManifest.json Install Type: FileBased

Host: Version: 8.0.8 Architecture: x64 Commit: 08338fcaa5

.NET SDKs installed: 3.1.426 [C:\Program Files\dotnet\sdk] 5.0.104 [C:\Program Files\dotnet\sdk] 5.0.214 [C:\Program Files\dotnet\sdk] 5.0.408 [C:\Program Files\dotnet\sdk] 6.0.133 [C:\Program Files\dotnet\sdk] 6.0.425 [C:\Program Files\dotnet\sdk] 8.0.400 [C:\Program Files\dotnet\sdk]

.NET runtimes installed: Microsoft.AspNetCore.All 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.33 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.33 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.12 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.33 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found: arm64 [C:\Program Files\dotnet] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\arm64\InstallLocation] x86 [C:\Program Files (x86)\dotnet] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables: Not set

global.json file: Not found

Learn more: https://aka.ms/dotnet/info

Download .NET: https://aka.ms/dotnet/download

Anything else?

image

davidfowl commented 2 weeks ago

@karolz-ms @vijayrkn

maddymontaquila commented 2 weeks ago

Quick crazy question - why are you leaving VS open for 7 days?! Just by accident or is there a use case?! I agree we should either extend the cert life or have a reasonable error. I don't know if I've ever gone a day without restarting VS ๐Ÿคฃ

jdasilva-olo commented 2 weeks ago

๐Ÿ˜† So when I've got something I'm working on over a period of time (and my time is split with other tasks) I typically just don't close it or reboot unless something acts up. I do sleep my machine. That said, I didn't realize how long that could be until this came up. There are probably times I've had VS instances and browser tabs that went almost all the way from one Windows update to another. I've got a Windows Terminal instance that's from 8/23 at the moment.

maddymontaquila commented 2 weeks ago

๐Ÿ˜† So when I've got something I'm working on over a period of time (and my time is split with other tasks) I typically just don't close it or reboot unless something acts up. I do sleep my machine. That said, I didn't realize how long that could be until this came up. There are probably times I've had VS instances and browser tabs that went almost all the way from one Windows update to another. I've got a Windows Terminal instance that's from 8/23 at the moment.

Thank you for sharing lol!! I guess this makes sense! We're gonna either extend the cert lifespan or fix the error so thank you for finding this and filing๐Ÿ˜Š

enemyss commented 4 days ago

Just ran into same issue, in my case I'm using Microsoft Dev Box and working mostly in 1 solution, so I almost never close VS ๐Ÿ˜