Vscode: Unable to drag and drop files from Explorer to VSCode when running as different user

Created on 23 Nov 2017  Â·  54Comments  Â·  Source: microsoft/vscode

  • VSCode Version: Code 1.18.1 (929bacba01ef658b873545e26034d1a8067445e9, 2017-11-16T18:32:36.023Z)
  • OS Version: Windows_NT x64 10.0.15063
  • Extensions:

Extension|Author (truncated)|Version
---|---|---
npm-intellisense|chr|1.3.0
path-intellisense|chr|1.4.2
vscode-mocha|Com|0.1.1
vscode-eslint|dba|1.4.3
vscode-npm-script|eg2|0.3.3
auto-close-tag|for|0.5.3
code-runner|for|0.8.4
rest-client|hum|0.16.1
search-node-modules|jas|1.2.0
prettify-json|moh|0.0.3
cpptools|ms-|0.14.2
csharp|ms-|1.13.1
sublime-keybindings|ms-|3.0.3
vscode-arduino|vsc|0.2.10
nodejs-extension-pack|wad|0.1.9
JavaScriptSnippets|xab|1.5.0

(1 theme extensions excluded)


Steps to Reproduce:

  1. Open VSCode. Open an Explorer Window.
  2. Try to drag and drop a file into the editor window.
  3. A "no drop" cursor appears.


Reproduces without extensions: Yes/No

electron upstream upstream-issue-linked workbench-run-as-admin

Most helpful comment

+1 same issue

All 54 comments

@chengkiang are you running VS Code as admin?

@bpasero I tried running both as admin and regular user but it doesn't seem to make a difference. I remember I could drag and drop in older versions...

@chengkiang can you record a screencast and share it of how this works for you?

@bpasero Here is a screencast of the issue.
vscode-nodrop

@chengkiang yeah weird. I have only seen that happening if the user that runs VS Code does not have permissions to open the file that is being dragged. Does this happen with any file?

@bpasero Yeah, it rejects whatever file I drag to it. I did more experiments, and found that opening VS Code by clicking on the pinned taskbar icon lets me drag and drop without issues. This seems to happen only if I run it from the command line.

I tried the same with Sublime Text and it does not appear to have this issue, either.

@chengkiang maybe from the command line you execute it as admin because the command line is running as admin?

+1 same issue

+1 same issue

Executing it from a tool like Find and Run Robot may also end up in this state. I believe it is the context of execution that enables or disables the drag-drop capabilities. This may be an issue with the parent application as well rather than a vs code issue.

Agree, on clean Windows OS, everything works fine.

+1 same issue - with clean Windows 10 installation. As admin and no

Windows 10, when I run VSC as administrator mode, I have the same problem.
As normal mode, no drag and drop file problem, but a lot of other problems occurs, such as:
Python intellisense only work under administrator mode.....

+1 same issue. Clean Windows - logged in as administrator.
Cannot drag and drop when running vscode as admin. Only when running as normal user.

I can't drag and drop neither as administrator or as normal account.

Same here, I am unable to drag and drop, neither as admin nor as regular user, I am on windows 10.

Any progress on this issue??

+1 same issue

same issue .

I switch from install version to portable.
I can't open vscode If don't run as admin . But run as admin come to this issue.

Win10, Run VSC as Admin, Drag & Drop doesn't work. Ready to provide more diagnostic info.

Same issue, isolated to portable version, ran as admin or not

+1 Same issue. Win10, Run VSC as Admin, Drag & Drop doesn't work. I can provide more details if needed too.

+1 Same issue. Win10, Run VSC as Admin, Drag & Drop doesn't work.

+1 Same issue here when running VSC as admin

+1 Same issue, Win 10, run as admin.

Same problem also when admin, work fine when not.
Edit: win 10 also

Same problem here.
No Drag&Drop when I run VS Code as admin.
When VS Code is running with my normal privileges, everything works fine.

Same issue. Windows 10, running VSCode as admin

Same issue. Windows 10, run as admin.

Same problem - regardless how how VSCode is started.

Same problem here.
Win10, running VSCode as admin.
Drag & Drop doesn't work but File > Open, yes.

+1 Same issue, Win 10, run as admin.

Wow. Surprised to see this issue persists. Ran as admin, same here. Weird because it works on my instructor's vid.

+1 Same issue here. Running VS Code as Administrator. Not possible to drag-and-drop files from Explorer into an open VS Code instance. My user account is Administrator (has Administrator privileges).

We have no other option unfortunately, because we need to run our solution in Visual Studio 2015 as Administrator, too, and our website projects are deployed to our local IIS instance.

Everyone please upvote this Electron issue that is the root cause it seems: https://github.com/electron/electron/issues/12460

You can't really achieve this "safely" in Windows. In the NT days, everything in terms of processes on the same machine ran with the same security token and had all the same privileges. UAC (in Vista) changed this by allowing processes with different integrity levels to run on the same machine.

This requires defense against elevation of privilege attacks, see Mandatory Integrity Control: http://msdn.microsoft.com/en-us/library/bb625957.aspx

MIC prevents a user process from accessing protected locations like Program Files or the HKLM registry hive, see http://technet.microsoft.com/en-us/magazine/2007.06.uac.aspx

In regards to the drag and drop issue, the technology preventing it is User Interface Privilege Isolation http://msdn.microsoft.com/en-us/library/aa480152.aspx#appcomp_topic21

UIPI blocks Windows messages being sent from process with a lower MIC level to one running at a higher MIC level. Drag-and-drop is implemented via Windows messages.

If you try and drag-and-drop a file from Windows Explorer (it runs in Medium integrity mode) to Electron running elevated (high MIC integrity mode), the Windows messages are blocked and drag-and-drop doesn’t work.

Technically, experiments can be made with ChangeWindowMessageFilterEx, but this will expose the security integrity of Electron. https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-changewindowmessagefilterex

Thanks @SharePointRadi for the very detailed and substantiated analysis!
To verify your statements I tried to open files in an instance of Notepad++ running in Admin mode.

Result:

  • Drag&Drop does NOT work in Notepad++ either!
  • Opening a file via Windows Explorer's context menu DOES work in NP++ if there is an instance of it running in Admin mode. This fails in VS Code.

Establishing the latter in VS Code / Electron would be a great help for everyday work.

+1 Same issue, Win 10, run as admin.

+1 Same Issue Here!!!!!!. That is make me crazy bro.

win 10, vscode 1.40.2. and admin used!

I recently switched from linux to windows and I'm currently facing this annoying issue too.

Same problem. Win 10, Electron.js 6

I have same issue only when Run As Admin

Version: 1.41.0 (user setup)
Commit: 9579eda04fdb3a9bba2750f15193e5fafe16b959
Date: 2019-12-11T18:37:42.077Z
Electron: 6.1.5
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Windows_NT x64 10.0.17134

This does not repro on the latest atom.io editor FWIW. I have tried Run as Admin and non-elevated with the same result.

this is happening with me only I open project from cmd with command 'code .' , open project from VS code shortcut your problem will be solved automatically

I have the same problem running Windows 10 and as Administrator. I can't drag and drop files into the file explorer inside VS Code

Fixed !

  • Uninstall the bul**hit "user" version
  • Install the "system" version of VS Code.

Right click to the vs code and click pin to taskbar if you wanna use it (drag and drop)

Same thing here when I launch VS Code from the new PowerToys app "Run". Disabling "always run as administrator" inside PowerToys fixes the issue.

It seems to be something about running VS Code as admin.

I've same issue on the Windows 10 and also after opening VS Code as Administrator

Facing Same Issue, it worked in previous version.

Here's the step on how I fix this issue:

  • Navigate to where your vs code is installed. Usually is on this path:
    C:\Users\[user]\AppData\Local\Programs\Microsoft VS Code.
    Make sure to update [user] with your correct user name.
  • Right-click on Code.exe and select Properties.
  • Navigate to the Security tab and select the Advanced button on the bottom.
  • It will open a modal called:
    Advanced Security Settings for Code.exe
    By default, the value of _Owner_ is the Administrator click on the Change link to change it.
  • It will open another modal called:
    Select User or Group
    On the Enter the object name to select field, just type your user name.
  • Click on OK, Apply, and thenOK* again.
  • Close and re-open vs code. The Drag-and-Drop files should work now.

Happy to help the community ✌

@genesisneo Not OK...

As was mentioned before, this issue happens due different permissions for VSCode and explorer.
FIX:
1. Do not uninstall VSCode from computer(_if don't want to destroy your cfg_)
2. Download ZIP version of VSCode(_portable version_)
3. Unzip it to your USER folder(_C:\Users\$userName_)

Now you can create shortcut of _Code.exe_ and move wherever you want.
VSCode will use existing cfg files, so you don't need to configure it again.

+1 same issue, ubuntu 20.04 LTS, vscode version 1.50

Was this page helpful?
0 / 5 - 0 ratings