2010-03-25 14 views
5

Sto sviluppando un componente aggiuntivo Outlook 2003. Fino ad ora ho usato solo winform per visualizzare un modulo, ma oggi ho aggiunto una finestra WPF per cose più complesse. Dalla finestra di WPF, un'eccezione COM viene generata quando Outlook si chiude.Componente aggiuntivo Outlook 2003 - Ottenere l'eccezione COM all'arresto dell'applicazione dopo aver creato la finestra WPF

Qualcuno sa perché? Devo avviare un thread separato per la finestra WPF nello stato di singolo appartamento.

Qui è l'eccezione:

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: 

migliori saluti,
Oliver Hanappi

risposta

2

È necessario Invoke Shutdown sulla finestra WPF Dispatcher nello stesso thread dopo che la finestra è chiusa.

window.Dispatcher.InvokeShutdown(); 

Un problema simile è stato segnalato in Microsoft Connect

+0

NIZZA. Questo ha funzionato alla grande per me. Aggiornare un'altra risposta che ho dato (sull'avvio di WPF Window in una nuova discussione) per includerla. – BrainSlugs83

Problemi correlati