Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7935599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:58:20+00:00 2026-06-03T21:58:20+00:00

I have a simple x86-targeting .NET 3.5 console program that calls methods on COM

  • 0

I have a simple x86-targeting .NET 3.5 console program that calls methods on COM objects in an ActiveX DLL via interop. In my registry, the ActiveX DLL has a ThreadingModel of Apartment. When the .NET program is running in an STA thread, everything works fine. In an MTA thread, some of the COM methods run fine, others give me:

System.InvalidCastException: Unable to cast COM object of type ‘MyComTypeClass’ to interface type ‘_MyComType’. This operation failed because the QueryInterface call on the COM component for the interface with IID ‘{[omitted]}’ failed due to the following error: Error loading type library/DLL. (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY)).

If I switch the ActiveX DLL’s ThreadingModel to Free or Both, the .NET program works in an MTA thread, but I want to keep the ThreadingModel at Apartment.

This same .NET program with the same ActiveX DLL and interop assembly works fine on multiple other machines (WinXP 32-bit, Win7 64) using both threading models. The exception only occurs on one PC (Win7 64) and only in an MTA thread. Anyone know why?

Similar questions have been asked without solutions, hoping 3rd time’s a charm:

COM Exception – TYPE_E_CANTLOADLIBRARY?

TYPE_E_CANTLOADLIBRARY when using a COM object on a separate thread on Windows 2003 x64 only

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T21:58:22+00:00Added an answer on June 3, 2026 at 9:58 pm

    Using an STA object from an MTA thread requires marshalling. Standard marshalling requires a type library. The error you are getting means the type library could not be loaded.

    So I would guess that the type library is not registered correctly. Try unregistering and re-registering the DLL, otherwise try registering the type library directly using REGTLB.exe

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very simple program that consists of a .NET 2.0 exe (Program.exe)
I have a simple byte array I've filled with a x86 -program. Which I
Hi I have a simple browser that sends a request to yahoo.com which the
I have a simple program that adds 1+1 until it reaches a million, and
I have a simple little command-line program, written in C#, running under .NET 4.0,
I have simple win service, that executes few tasks periodically. How should I pass
I have a simple program written in C and Objective-C. It consists of a
I have a simple Sinatra app that I will be hosting in tomcat as
I have a simple form UI that has a slot for a button, starting
I was compiling a .NET application targeting x86-64; however, the application references a 32-bit

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.