0

I have a line of code that sets text to the clipboard:

Clipboard.SetDataObject(clipBoardExceptions);

When I try to set this data object to also persist after the application exits I get an error that the clipboard can't open:

Clipboard.SetDataObject(clipBoardExceptions, true);

Produces:

the second arg: {"OpenClipboard Failed (0x800401D0 (CLIPBRD_E_CANT_OPEN))"}

This exception was originally thrown at this call stack: 
System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(int, System.IntPtr)
in Marshal.cs System.Windows.Clipboard.Flush() 
System.Windows.Clipboard.CriticalSetDataObject(object, bool) 
System.Windows.Clipboard.SetDataObject(object, bool)
rickster26ter1
  • 373
  • 3
  • 10
  • I think It was a bug and you needed to try several times check [this](https://stackoverflow.com/questions/68666/clipbrd-e-cant-open-error-when-setting-the-clipboard-from-net) – Mike93041 Jan 06 '23 at 17:13

0 Answers0