question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Crash 'Unable to cast object of type 'System.__ComObject' to type 'ITfThreadMgr'.'

See original GitHub issue
  • .NET Core Version: 3.1
  • Windows version: (Windows 10 Pro 19043.1645)
  • Does the bug reproduce also in WPF for .NET Framework 4.8?: Unknow
  • Is this bug related specifically to tooling in Visual Studio (e.g. XAML Designer, Code editing, etc…)? No.
  • Security issues and bugs should be reported privately, learn more via our responsible disclosure guidelines.

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()

image

It looks like the ‘threadManager’ value is of the wrong type?

image

Expected behavior:

Minimal repro:

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:33 (22 by maintainers)

github_iconTop GitHub Comments

2reactions
ThomasGoulet73commented, Jun 23, 2022

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.

1reaction
jim-jiang-githubcommented, May 7, 2023

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to cast COM object of type 'System.__ComObject' ...
Unable to cast COM object of type 'System.__ComObject' to interface type 'IFabricKeyValueStoreReplica8'. This operation failed because the ...
Read more >
VS2015: Unable to cast COM object of type 'System. ...
This is usually caused by a mismatch between the service code + nuget packages and the software version of the cluster.
Read more >
Unable to cast COM object of type 'System.__ComObject' ...
Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.VisualStudio.Shell.Interop.IVsDesignTimeAssemblyResolution'.
Read more >
Unable to cast COM object of type 'System ComObject'
In this video I will show you how to solve the following error: Unable to cast COM object of type ' System. __ComObject...
Read more >
Unable to cast object of type 'Wisej.Web.Form ...
This problem occurs with all systems (winforms, wpf, asp.net) and all frameworks. Try to delete /bin and /obj, and .vs after closing the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found