Outlook 2003 add-in - Getting COM exception on application shutdown after creating WPF window

Posted by Oliver Hanappi on Stack Overflow See other posts from Stack Overflow or by Oliver Hanappi
Published on 2010-03-25T16:59:43Z Indexed on 2010/05/09 6:18 UTC
Read the original article Hit count: 655

Filed under:
|
|
|
|

Hi!

I'm developing an outlook 2003 add-in. Until now I used only winforms to display one form, but today I've added a WPF window for more complex stuff. DUe to the WPF window, a COM exception is being thrown when outlook shuts down.

Does anybody know why? I need to start a separate thread for the WPF window in single apartment state.

Here is the exception:

System.Runtime.InteropServices.InvalidComObjectException was unhandled
  Message="COM object that has been separated from its underlying RCW cannot be used."
  Source="PresentationCore"
  StackTrace:
       at System.Windows.Input.TextServicesContext.StopTransitoryExtension()
       at System.Windows.Input.TextServicesContext.Uninitialize(Boolean appDomainShutdown)
       at System.Windows.Input.TextServicesContext.TextServicesContextShutDownListener.OnShutDown(Object target)
       at MS.Internal.ShutDownListener.HandleShutDown(Object sender, EventArgs e)
  InnerException: 

Best Regards,
Oliver Hanappi

© Stack Overflow or respective owner

Related posts about vsto

Related posts about .NET