WinFormsComInterop icon indicating copy to clipboard operation
WinFormsComInterop copied to clipboard

Windows.Forms.Clipboard.ContainsText crashes with ComWrappers

Open jaedan opened this issue 3 years ago • 0 comments

Calling Clipboard.ContainsText() crashes with this call stack:

System.InvalidCastException
  HResult=0x80004002
  Message=Unable to cast object of type 'WinFormsComInterop.IExternalObject' to type 'System.Runtime.InteropServices.ComTypes.IDataObject'.
  Source=System.Private.CoreLib
  StackTrace:
   at System.StubHelpers.InterfaceMarshaler.ConvertToManaged(IntPtr& ppUnk, IntPtr itfMT, IntPtr classMT, Int32 flags)
   at Interop.Ole32.OleGetClipboard(IDataObject& data)
   at System.Windows.Forms.Clipboard.GetDataObject(Int32 retryTimes, Int32 retryDelay) in /_/src/System.Windows.Forms/src/System/Windows/Forms/Clipboard.cs:line 146
   at System.Windows.Forms.Clipboard.ContainsText() in /_/src/System.Windows.Forms/src/System/Windows/Forms/Clipboard.cs:line 227

jaedan avatar Dec 30 '22 21:12 jaedan