WPF crash while querying interface on ITfMessagePump. How can I debug it?

  windows, wpf

I’m getting random crashes when WPF (.NET 4.8) tries to get ahold of the Text Service Framework message pump, which I haven’t been able to get much info on.

Here’s the source of the function that’s trying to cast it. I’ve tried disabling it by turning off support for it but there’s no way.

How can I debug this? WPF works alright and renders fine until it just stops here (I guess the Text Service Framework interface loads and eventually stops working).

>   KernelBase.dll!RaiseException() Unknown
    combase.dll!SendReport(HRESULT error, unsigned int cchMax, const wchar_t * message, unsigned short pSid, void * pExceptionObject, IUnknown *) Line 433  C++
    combase.dll!RoOriginateErrorW(HRESULT error, unsigned int cchMax, const wchar_t * message) Line 569 C++
    [Inline Frame] combase.dll!OriginateErrorUsingFormattedResource(HRESULT) Line 83    C++
    combase.dll!CRIFTable::GetPSClsidHelper(const _GUID & riid, bool suppressErrorOrigination, _GUID * pclsid, CRIFTable::tagRIFEntry * * ppEntry) Line 1816    C++
    [Inline Frame] combase.dll!CRIFTable::GetPSClsidAndObject(const _GUID &) Line 1656  C++
    combase.dll!GetPSFactoryInternal(unsigned long dwContext, const _GUID & riid, IPSFactoryBuffer * * ppFactory) Line 2492 C++
    combase.dll!GetPSFactory(const _GUID & riid, IPSFactoryBuffer * * ppFactory) Line 2611  C++
    combase.dll!CStdWrapper::CreateIFaceEntry(const _GUID & riid, void * pServer, IFaceEntry * * ppEntry) Line 1097 C++
    combase.dll!CrossCtxQIFn(void * pv) Line 1513   C++
    combase.dll!EnterForCallback(tagRPCOLEMESSAGE * pMessage, CPolicySet * pPS, HRESULT(*)(void *) pfnCallback, void * pv, const _GUID & riid, unsigned long) Line 2073 C++
    combase.dll!SwitchForCallback(CPolicySet * pPS, HRESULT(*)(void *) pfnCallback, void * pv, const _GUID & riid, unsigned long iMethod, IUnknown * pUnk) Line 1705    C++
    combase.dll!CStdWrapper::CrossCtxQI(CPolicySet * pPS, const _GUID & riid, IFaceEntry * * ppEntry) Line 3524 C++
    combase.dll!CStdWrapper::InternalQI(const _GUID & riid, void * * ppv, int pWrapperEntry, int) Line 2296 C++
    combase.dll!CStdWrapper::QueryInterface(const _GUID & riid, void * * ppv) Line 2391 C++
    [Managed to Native Transition]  
    WindowsBase.dll!System.Windows.Threading.Dispatcher.GetMessagePump()    Unknown
    WindowsBase.dll!System.Windows.Threading.Dispatcher.GetMessage(ref System.Windows.Interop.MSG msg, System.IntPtr hwnd, int minMessage, int maxMessage)  Unknown
    WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame frame)   Unknown
    PresentationFramework.dll!System.Windows.Application.RunDispatcher(object ignore)   Unknown
    PresentationFramework.dll!System.Windows.Application.RunInternal(System.Windows.Window window)  Unknown
    MyApp.exe!MyApp.UI.App.Main()   Unknown
    [Native to Managed Transition]  
    mscoreei.dll!_CorExeMain() Unknown
    mscoree.dll!_CorExeMain_Exported() Unknown
    kernel32.dll!BaseThreadInitThunk() Unknown
    ntdll.dll!RtlUserThreadStart() Unknown

Source: Windows Questions