-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash 'Unable to cast object of type 'System.__ComObject' to type 'ITfThreadMgr'.' #6463
Comments
Could you add the demo ? |
This crash happened in our company's project, I can't disclose it, it's a once bug found by QA, we can't reproduce this problem at present |
A sample/minimal repro will be required to check this further. |
The comment in the WPF code suggests this might be due to IME configuration issues which might be challenging to reproduce on other machines.
Yes, Cicero is a text services framework that deals with IMEs. |
Is there any way we can catch this exception so far? Or is there any Workaround that can ignore this exception? |
@jim-jiang-github You can disable it by How to Disable Thread Input Manager? See https://social.msdn.microsoft.com/Forums/en-US/b464ecfa-1673-4f06-bba0-bf3eacaae9fc/how-do-you-turn-off-the-automation-features-of-windows-speech-recognition?forum=netfxbcl
string keyPath = @"Software\Microsoft\CTF";
using (RegistryKey key = Registry.CurrentUser.OpenSubKey(keyPath, true))
{
key.SetValue("Disable Thread Input Manager", 1);
} Why it is not the good ideas? Because the IME can not work or work well after disable Thread Input Manager. |
Thank you very much, I will try this solution. |
Can you tell us which input methods you enabled or installed? Which OS is this? |
I don't think so. IME has a hundred ways to crash applications. |
@lindexi If the IME is valid but does not implement ITfThreadMgr then that is probably for WPF to deal with. |
@miloush Sorry, I means that we should not catch it. Because it can crash the application in any code which call the IME. Such as my call stack:
See my Chinese blog: https://blog.lindexi.com/post/WPF-%E8%A2%AB%E8%BE%93%E5%85%A5%E6%B3%95%E5%B8%A6%E5%B4%A9%E8%BF%9B%E7%A8%8B.html |
We installed Microsoft Chinese input, but we are not sure whether the Chinese input method was enabled when crash happened. |
@lindexi so do you have a repro? I tried to type into a TextBox using Microsoft Pinyin and nothing happened. |
@miloush It's hard to give you a repro... Unless I find a user's computer for you remotely |
@lindexi which input method at least? |
@miloush As my blog says, the Sogou input (搜狗输入法) may crash the application. |
@lindexi I have only one idea, how can |
@kant2002 Doesn't |
If you implement properly, you usually implement 2 interfaces (IID), one for |
According to the Windows SDK, ITfThreadMgr2 does not implement ITfThreadMgr (They do not share the same vtbl). It seems that even though ITfThreadMgr2 does not implement ITfThreadMgr, you can call QueryInterface with ITfThreadMgr2 on a ITfThreadMgr pointer. So if the pointer returned by TF_CreateThreadMgr is ITfThreadMgr2 it could cause this type of exception. I don't know if this is the case here because it would be very weird since TF_CreateThreadMgr returns ITfThreadMgr according to the SDK. I'm not setup to try it since it looks like it requires specific input but if anyone can try to cast everything to ITfThreadMgr2 before using the instance of the COM object it would be great. |
I find the other call stack break the application
|
I found another crash error info here. And stack: |
Hi,
And
According to previuse version off application i have made update of WPF Material Design. |
@Norc89 What is your IME ? |
We are using TabTipAutomation to connect Virtual keyboard with our system.
And check if virtualApp is running. |
@Norc89 This is an interesting way, because I never thought about Virtual keyboard. |
Yes we have touch application, this is the reason why we user virtual keyboard. |
@Norc89 Sorry, I can not reproduce it by virtual keyboard. I think I need to try more devices and systems. |
Does you have in mind any work around for this ? Because error happen on production machines after some time of use. It's not possible to reproduce it in office. |
@Norc89 Sorry I don't know how to fix this isseus except to change the IME |
@lindexi |
@jim-jiang-github Do you mean call the CoInitialize twice without call the UnCoInitialize? |
Yes. Alternatively, you can reproduce this issue by making multiple calls to CoInitialize in the code. |
Windows 10 Pro 19043.1645
)Problem description:
Unknown cause.
1.We used WebView2 (1.3.153.51) in our project, We are using WebView2 when the crash happens. I'm not sure if it has anything to do with this.
2.Is it possible that the problem is caused by the Chinese input ?
Actual behavior:
App crash at Dispatcher.GetMessagePump()
It looks like the ‘threadManager’ value is of the wrong type?
Expected behavior:
Minimal repro:
The text was updated successfully, but these errors were encountered: