To copy something to the clipboard in Windows (at least in .NET as far as I know) it has to be done on a separate thread that is in STA Mode. One example I have used is this.
Thread thread = new Thread(() => Clipboard.SetText(s.Trim()));
thread.SetApartmentState(ApartmentState.STA); //Set the thread to STA
thread.Start();
thread.Join();
Why do I have to do all of that instead of being able to just call:
Clipboard.SetText("text")