Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot properly run multiple instances of VS Code within separate RDP sessions #132872

Open
NGLocanovic opened this issue Sep 10, 2021 · 8 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug chromium Issues and items related to Chromium remote-desktop upstream Issue identified as 'upstream' component related (exists outside of VS Code) windows VS Code on Windows issues

Comments

@NGLocanovic
Copy link

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.60.0
  • OS Version: Windows Server (different Versions)

Hello,
we are facing the following problem when using VS Code on our client's server:
If two collegues are connected onto the client's server (each with his/her own session), only one person can open VS Code. If the other person tries to launch VS Code, the window opens in the session of the first person.

This happens with all installers (including ZIP)

The image shows that we connect with the same windows user.
Is there a solution to this problem?

Steps to Reproduce:

  1. Install VS Code onto a Microsoft Server (Don't know if this problem also occurs on the local machine)
  2. connect with different RDP Sessions using the same Windows User account (see image)
  3. Run VS Code in the first session and let it open
  4. Run VS Code in the second session

image
image
image

@NGLocanovic
Copy link
Author

NGLocanovic commented Oct 11, 2021

Is there anything you need, to further track down the problem?

@emagii
Copy link

emagii commented Oct 18, 2021

Connecting using RDP is not really the same as handling of virtual desktops.
Virtual desktops is something you have on your own machine and RDP is not involved.
Why do you merge it?
Will the solution to both problems be the same or similar?

@deepak1556 deepak1556 added the windows VS Code on Windows issues label Oct 18, 2021
@deepak1556
Copy link
Collaborator

Yes the root issue is the default singleton instance nature of the application for both, will have to see what can be done for these scenarios.

@deepak1556 deepak1556 added confirmation-pending electron Issues and items related to Electron upstream Issue identified as 'upstream' component related (exists outside of VS Code) upstream-issue-pending Issues that are caused by chromium but have not been reported due to pending minimal repro labels Oct 18, 2021
@emagii
Copy link

emagii commented Oct 18, 2021

you can easily start a instance by "Code -n" so this is supported.
The trick is to detect if there is a running instance in the current desktop.
My current workaround is to have a shortcut on the desktop which runs "code -n".
If I right click on a file and choose "Open with Code" and it switches virtual desktop,
then I will just close the file, go back to the original virtual desktop and double click on the short-cut.
Now I have an open window, and "Open with Code" will open in the correct virtual desktop.

There must be a routine which checks if there is an open instance when parsing the switches
This needs to be able to differentiate between applications in this virtual desktop and others..

@theplow-kwak
Copy link

You can use this command "C:\Program Files\Microsoft VS Code\Code.exe" --user-data-dir=C:\temp%CLIENTNAME%

@YaswanthDasamandam
Copy link

"C:\Program Files\Microsoft VS Code\Code.exe" --user-data-dir=C:\temp%CLIENTNAME%
This is very useful , But it does not work with "open with code" is there any work around it

@deepak1556 deepak1556 added bug Issue identified by VS Code Team member as probable bug and removed upstream-issue-pending Issues that are caused by chromium but have not been reported due to pending minimal repro labels Dec 8, 2022
@ian-cameron
Copy link

Reproducing this now. Just to provide some context in case it helps. I had been stumped by this for months, but this issue has pointed me to what is happening-

I try to use VS Code to view application log files on a Windows server. I wanted to use Code because of its live updates, and it formats the logs nicely. Also it makes it easy to search for strings. Way better than Notepad for this. I connect with RDP and open logs by right-clicking and "Open with Code." That works if I'm the only RDP session. The issue is that we often disconnect our RDP sessions, or have multiple sessions open concurrently. I might have one connected from home and a different session connected from the office. If I leave Code open in my session 1 from home, then come into the office and connect to the same server in session 2. I'll browse to the log file and open it with code in session 2. Nothing happens. If I go back home and look at session 1, I see the log is opened in that session.

I didn't realize it was opening in the other session before I saw this issue. I am commenting to confirm this and to follow the issue. Very unique problem, I'm sure others have it too.

@deepak1556 deepak1556 added chromium Issues and items related to Chromium and removed electron Issues and items related to Electron confirmation-pending labels Dec 12, 2023
@DevPaulLiu
Copy link

DevPaulLiu commented Apr 10, 2024

Meet this same issue, @theplow-kwak's workaround works for me, "C:\Program Files\Microsoft VS Code\Code.exe" --user-data-dir=C:\temp%CLIENTNAME% not sure why. Probably a bug when VSCode startup with remote desktop sessions, it may didn't use current remote session, by default it open in the first remote session.
Most apps works well, including notepad, paint, IE, Offices apps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug chromium Issues and items related to Chromium remote-desktop upstream Issue identified as 'upstream' component related (exists outside of VS Code) windows VS Code on Windows issues
Projects
None yet
Development

No branches or pull requests

8 participants