我正在开发outlook 2003外接程序。到目前为止,我只使用winforms来显示一个表单,但今天我添加了一个WPF窗口来显示更复杂的内容。由于WPF窗口的原因,当outlook关闭时将引发COM异常。
有人知道为什么吗?我需要在单单元状态下为WPF窗口启动一个单独的线程。
以下是例外情况:
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:
谨致问候,