Share via


Getting a System.Runtime.InteropServices.COMException when trying to use BitmpaMetadata to extract EXIF/XMP data?

Well if that's the case, it's probably cause you're attempting to use this class from a MTA thread.  In order to fix this, just change the apartment of the thread where this code is running from MTA to STA (either using the [STAThread] Attribute or by setting the ApartmentState member of the thread that you're spinning off to run this code).

 Here's the details of the exception:

 System.Runtime.InteropServices.COMException occurred
  Message="A null reference pointer was passed to the stub. (Exception from HRESULT: 0x800706F4)"
  Source="PresentationCore"
  ErrorCode=-2147023116
  StackTrace:
       at MS.Internal.HRESULT.Check(Int32 hr)
  InnerException:

 

Enjoy!