Ask the Expert

I'm in COM DLL hell -- please help

I am developing an ASP.NET application that uses a COM component. I use the COM component by registering in the development machine using regsvr32, then go to add reference and, under COM tab, point to the COM component reference there. I have an issue regarding the same. Whenever I create a new version of COM DLL, I need to unregister the previous entry and restart the machine before registering the new version to make it work properly, and if I don't, I will get an error says 'Query Interface Failed' for the COM component! Is this the right way to work with the COM component, and is there any way to deal with this issue I'm having?
You're suffering the well-known DLL hell problem. When the CCW (COM Callable Wrapper) is created (when you add a reference to the COM DLL, that's what's happening), the .NET assembly that makes it up uses the COM GUID to locate the corresponding component. If you register a new version, there will be a conflict, and the CCW will no longer be able to query inside the new COM dll, because of Vtable address mismatches and all sort of incompatibilty issues that made this problem so unfortunately usual in the "old" COM days. Unless you compile the DLL with binary compatibility enabled, and use exactly the same GUID each time (and pray for it to work in the meantime), this is unavoidable.

This was first published in July 2003

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: