madskristensen / Tweakster

A Visual Studio extension
Apache License 2.0
239 stars 23 forks source link

Restart command does not reload environment variables #123

Open TheBlubb14 opened 10 months ago

TheBlubb14 commented 10 months ago

Describe the bug When executing the restart command in visual studio from File -> Restart -> Restart then the environment variables from my windows 10 machine are not reloaded/updated. If I start visual studio, then change some environment variables I can not read the updated values. This is fine as i can use the restart command to restart visual studio to load the updated environment values. But I will still get the old values from when I inital started visual studio.

To Reproduce Steps to reproduce the behavior:

  1. Create a new .Net 8 console project.
  2. Paste the following code
    Console.WriteLine($"Hello {Environment.GetEnvironmentVariable("TWEAKSTER")}");
  3. Run the application. It should print Hello
  4. Leave visual studio open and create a new a new environment variable with the following powershell command
  5. Run the application. It should again print Hello
  6. Click on the restart command in visual studio from File -> Restart -> Restart
  7. Run the application. It prints Hello. But expected is Hello world
  8. Close visual studio manually and open it again.
  9. Now the application will print Hello world
  10. You can remove the environment variable again with
    [Environment]::SetEnvironmentVariable('TWEAKSTER', $null, 'User')

Expected behavior The environment variables should be reloaded if the restart command is executed.