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

can't copy and paste anything #16982

Closed
XuehaoSun opened this issue Apr 1, 2024 · 42 comments · Fixed by #17006
Closed

can't copy and paste anything #16982

XuehaoSun opened this issue Apr 1, 2024 · 42 comments · Fixed by #17006
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Tag-Fix Doesn't match tag requirements Product-Terminal The new Windows Terminal. Resolution-External For issues that are outside this codebase

Comments

@XuehaoSun
Copy link

XuehaoSun commented Apr 1, 2024

Windows Terminal version

1.19.10821.0

Windows build number

22631.3296

Other Software

No response

Steps to reproduce

Use the right mouse button or CTRL+c or CTRL+v to copy and paste.

It will expire at random intervals.
During this period the copy and paste functionality of other software works fine.
The copy and paste function returns to normal after about ten minutes of inactivity.

Frequency of occurrence: Every few hours.

Expected Behavior

copy paste behavior

Actual Behavior

No response

@XuehaoSun XuehaoSun added Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Apr 1, 2024
Copy link

github-actions bot commented Apr 1, 2024

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@cosmolai
Copy link

cosmolai commented Apr 1, 2024

I got the same issue. It happens sporadically. It's annoying.

In my case, paste is working to terminal if copying text from other application. But copy text does not work in terminal.

@pmmccorm
Copy link

pmmccorm commented Apr 1, 2024

Ditto. Incredibly annoying. Paste works. Copy does not (either through Ctrl+Ins or with auto-copy selection).

@hteeyeoh
Copy link

hteeyeoh commented Apr 2, 2024

I got the same issue on my side even i remove all the key bindings just remain ctrl + c/v for copy paste it still not working..
My current Windows Terminal Version: 1.19.10573.0

@hoesheng
Copy link

hoesheng commented Apr 2, 2024

I'm facing the same issue as well with version 1.19.10573.0

@cmellazchy
Copy link

cmellazchy commented Apr 2, 2024

I have exactly the same issue as described in the original post. It severely affects my productivity.

Windows Terminal version
1.19.10573.0

Windows build number
22631.3296

@zadjii-msft
Copy link
Member

zadjii-msft commented Apr 2, 2024

Wait, just to clarify - when y'all are pasting, are you seeing the same, seemingly random text from VsCode? Or is that just a red herring?

We did some work recently around here - in preview 1.19 it looks like we started merging stuff:

For additional info: What are you running in the Terminal? CMD / PowerShell / WSL? Vim?

@zadjii-msft zadjii-msft added Product-Terminal The new Windows Terminal. Severity-Blocking We won't ship a release like this! No-siree. labels Apr 2, 2024
@zadjii-msft zadjii-msft added this to the Terminal v1.21 milestone Apr 2, 2024
@zadjii-msft zadjii-msft removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Apr 2, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Tag-Fix Doesn't match tag requirements label Apr 2, 2024
@cmellazchy
Copy link

cmellazchy commented Apr 2, 2024

@zadjii-msft My bad, just to clarify I see the same behavior as OP (quoted below). The VSCode part is not true in my case.

Use the right mouse button or CTRL+c or CTRL+v to copy and paste.

It will expire at random intervals.
During this period the copy and paste functionality of other software works fine.
The copy and paste function returns to normal after about ten minutes of inactivity.

Frequency of occurrence: Every few hours.

I am sure that both copy and paste are affected. When I select the text in terminal and try to copy, the selection gets reset when I press CTRL + C but I do not see the text I've copied in Windows Clipboard history. This happens to me in both PowerShell and WSL from what I've observed. (PowerShell 7.4.1 and WSL 2 with Ubuntu)

I have had this issue for over a week now.

@XuehaoSun
Copy link
Author

XuehaoSun commented Apr 2, 2024

Windows Terminal version

1.19.10821.0

Windows build number

22631.3296

Other Software

No response

Steps to reproduce

Use the right mouse button or CTRL+c or CTRL+v to copy and paste.

It will expire at random intervals. During this period the copy and paste functionality of other software works fine. The copy and paste function returns to normal after about ten minutes of inactivity.

Frequency of occurrence: Every few hours.

Expected Behavior

copy paste behavior

Actual Behavior

No response

Hi guys, I need to update some information:

  1. powershell v7.4.1, but when the bug occurs, all windows including cmd and powershell will have this issue.
  2. Regarding the vscode part, I haven't been able to reproduce it recently. This may be an accident, or I accidentally copied it at work, but I have no impression. If no one else has encountered it then please ignore it.
  3. This is a strange discovery: I noticed that all the people who commented here work at Intel, or at least use Intel's email address. Is this a coincidence? Maybe it's a problem with Intel's work computer environment?
    I found that when the bug appeared, I keep pressing ctrl+v multiple times quickly, the task manager showed that the CPU usage of a process named it-agent would increase, but after I killed this process, the copy and paste function returned to normal immediately! I don’t know if this is a random event. Can anyone help me verify this?
    image

@zadjii-msft
Copy link
Member

@XuehaoSun if this ultimately does come down to it being an Intel-specific thing, then I'm definitely going to give you an award for the best bug investigator of the week. I would have never figured that out 😅


Though, @kvietmeier did report something just like this over in #16994, and they have a storagenet.org email on their commits. Maybe theirs was a different root cause after all?

@cmellazchy
Copy link

cmellazchy commented Apr 2, 2024

Update: killing the it-agent fixes the issue temporarily for me as others described.


@XuehaoSun Great find on the Intel work emails!
This bug happened to me twice in the last 30 minutes. I do not believe it's related to the it-agent process, at least in my case.
My observations were the same the both times. When the bug happened, I wasn't able to copy anything from the terminal or paste into it.

  1. I was ready with my task manager, but I did not notice any CPU/Mem usage increase for the it-agent process when I spammed Ctrl+V.
  2. I have tried ending the process by clicking on End task in the context menu, but it looks like the process gets restarted almost immediately. This didn't resolve the issue for me.

I waited for a while the first time it happened and kept trying to paste every minute and finally after 5-10 mins, I was able to copy/paste. But then it happened again after 15 mins or so, and then again, I just waited, and it worked.

I'll do more observations as it happens and will update if I see anything different.

@kvietmeier
Copy link

I work for Intel - but my GitHub predates that and uses my personal email as the ID/Login.

@zadjii-msft
Copy link
Member

👀

@atkassen
Copy link

atkassen commented Apr 2, 2024

3. This is a strange discovery: I noticed that all the people who commented here work at Intel, or at least use Intel's email address. Is this a coincidence? Maybe it's a problem with Intel's work computer environment?
I found that when the bug appeared, I keep pressing ctrl+v multiple times quickly, the task manager showed that the CPU usage of a process named it-agent would increase, but after I killed this process, the copy and paste function returned to normal immediately! I don’t know if this is a random event. Can anyone help me verify this?
image

I have tried this and see the same thing.

@cmellazchy
Copy link

cmellazchy commented Apr 2, 2024

Update: killing the it-agent temporarily fixes the issue for me as others described.


@atkassen, @XuehaoSun - So, just to confirm, are you saying that the copy/paste issue got resolved when you have killed this process? If so, can you please verify this again and also list the exact steps you've followed to kill it? I had the chance to try this multiple times today when the issue started happening but killing this process didn't work for me as described in my earlier comment #16982 (comment).


I was digging just now and found another Intel internal discussion of an employee reporting exactly the same issue posted earlier this week. I don't believe this is a coincidence now.

Just to summarize the behavior for me:

  1. Copy/paste in windows terminal starts getting affected.
  2. Until the issue is resolved
    • Copying from a different application (eg: notepad, browser) and pasting in Windows terminal - WORKS
    • Copying from Windows terminal - DOES NOT WORK
  3. Check back after some time to see that the issue is resolved, and all the actions work.
  4. The same flow repeats after a couple of minutes.

So, I believe paste in terminal is still working fine because it looks like the issue is that when you try to copy from Windows terminal, it doesn't go to clipboard in the first place. Pasting from different applications works for me during the time the issue is in effect.

@murrayma-intel
Copy link

murrayma-intel commented Apr 2, 2024

I also work for Intel, and I'm also seeing this on my work PC. If I kill it-agent through the task manager and quickly copy & paste something in the terminal, it works again very briefly until it-agent starts again. Once it's restarted, I can continue pasting the existing clipboard contents into the terminal, but once I copy a new selection it breaks again.

I need to be pretty quick for it to work though, if I'm too slow and it-agent restarts before I can make a selection, I can't do a successful copy & paste.

@microsoft microsoft deleted a comment Apr 2, 2024
@hteeyeoh
Copy link

hteeyeoh commented Apr 3, 2024

Wait, just to clarify - when y'all are pasting, are you seeing the same, seemingly random text from VsCode? Or is that just a red herring?

We did some work recently around here - in preview 1.19 it looks like we started merging stuff:

For additional info: What are you running in the Terminal? CMD / PowerShell / WSL? Vim?

My issue also occurs on the windows terminal only. VSCode so far dont have any issue for me.

@XuehaoSun
Copy link
Author

XuehaoSun commented Apr 3, 2024

I also work for Intel, and I'm also seeing this on my work PC. If I kill it-agent through the task manager and quickly copy & paste something in the terminal, it works again very briefly until it-agent starts again. Once it's restarted, I can continue pasting the existing clipboard contents into the terminal, but once I copy a new selection it breaks again.

I need to be pretty quick for it to work though, if I'm too slow and it-agent restarts before I can make a selection, I can't do a successful copy & paste.

@cmellazchy
My operation is the same as this, although it-agent will still start automatically after killing it, at least for a short period of time (about tens of seconds) I can copy and paste.
It is precisely because of the automatic startup of it-agent that I cannot completely avoid this issue.

@zadjii-msft
Copy link
Member

We can work on merging #17006, but in the meantime: someone who works at Intel should probably raise this issue with your IT department, so they can figure out whatever is going on with it-agent

@akantak
Copy link

akantak commented Apr 3, 2024

For any Intel IT guy who takes a look here, I've submitted an issue RITM12576849.
EDIT: and INC13540763

@atkassen
Copy link

atkassen commented Apr 3, 2024

(From IT) To disable the services that start it-agent:

  1. Press Win+R and type in msconfig; hit enter
  2. Go to the "Services" tab
  3. Disable "IT Cloud Service" and "Updater Utility Service Components Controller"
  4. Click apply, close the window, and reboot

@rjszuster
Copy link

Disabling "IT Cloud Service" is enough to get the "it-agent" process to not start.

@filefi
Copy link

filefi commented Apr 4, 2024

facing the same issue as well with version 1.19.10573.0 and 1.20.10822.0. also tried the lastest release, still doesn't works.

@timocafe
Copy link

timocafe commented Apr 4, 2024

same issue, any copy/past from/to any terminal are 1/2 broken, Intel employee, I am

@akantak
Copy link

akantak commented Apr 4, 2024

I tried a workaround from @atkassen, for now, it looks promising. Not sure if it 100% helps, so trying to escalate the issue.

@zadjii-msft
Copy link
Member

@filefi If you're not an Intel employee, mind filing a new thread? I think at this point, we've got critical mass in this thread to suggest that everyone here was hitting the same issue with it-agent. (unless of course you have some other process like it-agent or "IT Cloud Service" messing with your clipboard as well. )

@Wee-Free-Scot
Copy link

Disabling "IT Cloud Service" is enough to get the "it-agent" process to not start.

I can confirm this is a successful workaround for the copy/paste issues for me.

  1. I used msconfig to disable "IT Cloud Service" but did not reboot like it wants.
  2. I then used Task Manager -> Services to stop the "IT Cloud Service" service (which kills the it-agent process without restarting it).

If I understand correctly, step (2) fixes the issue up to the next reboot and step (1) makes the fix permanent even after reboot.

@cmellazchy
Copy link

cmellazchy commented Apr 4, 2024

For anyone working at Intel and visiting this thread, I DO NOT recommend disabling any IT background services as it might lead to unintended side effects. Relevant Teams at Intel were already made aware of this issue, and they are working to get it resolved.

@XuehaoSun
Copy link
Author

Hi, @zadjii-msft
In view of the warning from IT, please delete this issue, thanks.

@XuehaoSun XuehaoSun changed the title can't copy and paste anything - Intel Employee thread can't copy and paste anything Apr 5, 2024
@murrayma-intel
Copy link

I don't think we should delete the entire issue because IT doesn't like the workaround. Until there's a resolution (either on the Intel IT side or on the Terminal side) we should keep this open so other Intel employees hitting this can find this issue and avoid opening duplicates.

@filefi
Copy link

filefi commented Apr 5, 2024

copy and paste functionality works properly today since my computer updated to Win11 23H2 22631.3374 last night. I don't know if it is related to this issue.

@zadjii-msft
Copy link
Member

Yea, I'm not going to be deleting this thread. It's been highly active - if we delete this, inevitably, another thread will get filed, and folks will once again come to the same conclusion.

That being said, obviously, disabling services from your IT department will probably make them mad at you. They should probably fix their tool, so folks don't need to disable it to be productive any more 😉

@zadjii-msft zadjii-msft added Resolution-External For issues that are outside this codebase and removed Severity-Blocking We won't ship a release like this! No-siree. labels Apr 5, 2024
@PhMajerus
Copy link

PhMajerus commented Apr 10, 2024

@zadjii-msft Just a wild guess, but does Terminal by any chance OpenClipboard + CloseClipboard for each type of data (text + HTML + RTF) when copying, instead of opening once, calling SetClipboardData several time and closing only when all clipboard formats are set?

My guess is Intel's tool registers itself as a clipboard format listener (AddClipboardFormatListener or SetClipboardViewer) to spy on the clipboard, for example to avoid people copying sensitive data by mistake.
So when you CloseClipboard after setting a first format, their process gets notified and takes over the clipboard for inspection, takes a while to decide if the clipboard should be allowed or emptied, and Terminals's immediate next call to OpenClipboard to store the next format fails because the clipboard is still open by their watcher process.

How does Terminal handle a failed OpenClipboard? Delay and retry, or silent failure?
Making sure Terminal performs a copy (in all formats) in a single OpenClipboard + CloseClipboard transaction if it doesn't could greatly reduce the failed copy operations.

@lhecker
Copy link
Member

lhecker commented Apr 10, 2024

The current implementation uses the WinRT clipboard APIs and not those Win32 APIs.

As it turns out, the WinRT API does exactly what you suspected (I apologize for the low DPI):
image

#17006 on the other hand does what you'd actually expect:
image

I do feel once again validated in my previous statements when it comes to this overall topic. I think I'll spare myself any further comments, however...


FYI The above images where generated with an absolutely amazing tool that @wdscxsj showed me recently: API Monitor

@murrayma-intel
Copy link

I'm no longer able to reproduce this issue, I think Intel IT must have pushed a fix.

Is anyone else from Intel still seeing this?

@cmellazchy
Copy link

I've received information that this issue has been resolved. I also haven't encountered this issue after a whole day of using the terminal.

@Wee-Free-Scot
Copy link

Minimal testing indicates this is no longer an issue for me as well.

github-merge-queue bot pushed a commit that referenced this issue Apr 10, 2024
In the spirit of #15360 this implements the copy part.
The problem is that we have an issue accessing the clipboard while
other applications continue to work just fine. The major difference
between us and the others is that we use the WinRT clipboard APIs.
So, the idea is that we just use the Win32 APIs instead.

The feel-good side-effect is that this is (no joke) 200-1000x faster,
but I suspect no one will notice the -3ms difference down to <0.01ms.

The objective effect however is that it just works.

This may resolve #16982.

## Validation Steps Performed
* Cycle through Text/HTML/RTF-only in the Interaction settings
* Paste the contents into Word each time
* Text is plain and HTML/RTF are colored ✅
@cosmolai
Copy link

I haven't encountered this issue couple days.

@sunwin123
Copy link

I encounter this issue for many days, still annoyed now.
What is the actual reason of this issue?

DHowett pushed a commit that referenced this issue Apr 22, 2024
In the spirit of #15360 this implements the copy part.
The problem is that we have an issue accessing the clipboard while
other applications continue to work just fine. The major difference
between us and the others is that we use the WinRT clipboard APIs.
So, the idea is that we just use the Win32 APIs instead.

The feel-good side-effect is that this is (no joke) 200-1000x faster,
but I suspect no one will notice the -3ms difference down to <0.01ms.

The objective effect however is that it just works.

This may resolve #16982.

* Cycle through Text/HTML/RTF-only in the Interaction settings
* Paste the contents into Word each time
* Text is plain and HTML/RTF are colored ✅

(cherry picked from commit 5f3a857)
Service-Card-Id: 92308708
Service-Version: 1.20
@m2021acct
Copy link

m2021acct commented May 3, 2024

I'm reading this because i was experiencing the same issue. Reading this through made me smile a bit, being the guy in charge of installing "it-agent" for some folks certainly sparked my interest. For those with "it-agent" related issues, please know this software is part of the DLP Suite handling data loss prevention for your business, and there seem to be an issue with their agent inspecting copy/paste operations. Don't kill the process! Please ask your IT Security team to create a ticket and address this bug with the vendor, Proofpoint. Best Regards, the "it-agent" installer. =]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Tag-Fix Doesn't match tag requirements Product-Terminal The new Windows Terminal. Resolution-External For issues that are outside this codebase
Projects
None yet
Development

Successfully merging a pull request may close this issue.