the question is 8 years old, but many still need the solution.
As mentioned by the others, that Clipboard must be called from the main thread or [STAThread].
Well, I use this workaround every single time. May be it can be an alternative.
public static void SetTheClipboard()
{
Thread t = new Thread(() => {
Clipboard.SetText("value in clipboard");
});
t.SetApartmentState(ApartmentState.STA);
t.Start();
t.Join();
await Task.Run(() => {
// use the clipboard here in another thread. Also can be used in another thread in another method.
});
}
The clipboard value is created in t thread.
The key is : The thread t apartment is set to STA state.
Later you can use the clipboard value in other threads as you like.
Hope you can get the point.