Rider cannot see all Environmental Variables

Hi 

 

I've added some environmental variables to system level - they're not visible in Rider - (I was resetting rider and whole machine/OS)

The list in Rider is shorter than the one in system settings.

I know I can add those variables in upper window - but why Rider doesn't get system level vars? 

And I want to stress again that IDE was restarted and local system was also restarted. 

 

Thanks Michal

0
7 comments

Hi Michal Szilder

Thanks for contacting us. If you run Rider via Toolbox, please restart also Toolbox after setting a new variable. I double-checked on the latest Rider 2022.1.1 version and it should work. Please let me know if you have another experience. 

Thanks! 

0

When I start Rider 2022.2.1 (not via Toolbox) it does not have access to many environment variables defined in either .bashrc or .zshrc.

0

Ok I wasn't using toolbox at all. Does it change anything when started using toolbox or toolbox is uninstalled?

0

Hi Kris! 

As I can see, you've already contacted us privately. Our team will prepare the answer soon. 

Michal Szilder, if you have Toolbox, you need to restart both Rider and Toolbox to pick up new environment variables. If you don't have it installed, only IDE should be restarted. If there is still an issue, could you please clarify how you add new environment variables? 

Thanks! 

0

Michal Szilder did you manage to fix the issue? If yes please share the HowTo. Because my Rider still cannot see variables defined in .bash_profile

Thanks in advance

0

Hi Slava S

Unfortunately, this is a known issue: Rider can't load interactive shell environment variables. As a workaround, add your environment variable to etc/environment/  and restart Rider. 

I hope this helps! 

0

Note to anyone trying Alexandra Guk's solution, from my experience incorporating it: 

  • You will need to logout to reset your session for this to work in some cases. This allows PAM.so to reapply the environment to pick up the vars.
  • There may be a way to force PAM to reinit, but going through the full login process will avoid a lot of side effects
  • You will need root perms in most default cases

If you lack root perms to change /etc/environment:

  • and are using gnome with an alt shell without scripts:
    - modify the .desktop file created at install
    - add your env exports to the profile according to your shell
    - add `/bin/yourshell -c` before the startup script invocation
    - ex: Exec=/bin/yourshell -c "/home/youruser/.local/share/JetBrains/Toolbox/apps/Rider/ch-0/231.9011.39/bin/rider.sh"
  • not gnome (generic/shell agnostic):
    - create an env file to export your variables
    - modify the rider.sh launch script to source your env file on launch
    - ex: source /path/to/mycustomvars.env

These solutions have the following drawbacks:

- will not survive updates, you'll need to reapply each time you update
- super manual, lots of potential for user error, esp in team scenarios

0

Please sign in to leave a comment.