Error creating COM component

G

greg

I am trying to create an instance of a 3rd party COM component, and I'm
getting an error.

I've opened a ticket with this vendor as well, but I want to approach it
from the C# .NET side to make sure I'm not missing anything. I did recently
upgrade the product we are using to a newer version, I'm wondering if that
has anything to do. I did re-add the references to DOCSObjects however.

I try to create an instance of the object as follows,

DocAppObj = new Hummingbird.DM.Extensions.Interop.DOCSObjects.Application();


Which produces this runtime error :


Creating an instance of the COM component with CLSID
{1CF0DE77-8CAE-11D1-82A2-0060083F9B01} from the IClassFactory failed due to
the following error: 80004002.
System.InvalidCastException was unhandled
Message="Creating an instance of the COM component with CLSID
{1CF0DE77-8CAE-11D1-82A2-0060083F9B01} from the IClassFactory failed due to
the following error: 80004002."
Source="MECTS3"


Any ideas?

Thanks,
Greg
 
A

Ashutosh Bhawasinka

Try to use this COM component from a VC++ application first...if it
works then proceed to .Net!
Also from VC++ first try to create the COM object by directly using
CoCreateInstance(Ex) then try going the IClassFactory way by calling
CoGetClassObject then calling the CreateInstance on the IClassFactory!

This way you will at-least be able to find out where the problem is.

Thanks & Regards,
Ashutosh
 
A

Ashutosh Bhawasinka

80004002 is a generic error - Interface not supported....I didn't pay
attention to it before posting the last message!!! So, only you
component provider can help here!!!
 
J

Jialiang Ge [MSFT]

Good morning Greg. Nice to see you again.

Apart from the possibility that the problem is caused by the component
vendor, (for example, they possibly did not handle the inheritance
relationship rightly or did not apply "Binary Compatibility" when releasing
the new version), another possible cause is related to "re-adding" the COM
component to our project. To double confirm that the error is not caused by
the .NET side, may I suggest re-adding the component based on the following
steps though I understand you already tried doing them:

1. Create a new C# project for test.
2. Add reference to the updated version of the COM component. Be sure that
the TypeLib version is new.
3. Call the code
DocAppObj = new Hummingbird.DM.Extensions.Interop.DOCSObjects.Application();

If this test does not throw the error, I intend to think that the problem
is on the .NET side. You may want to do these steps to your real project:

1. Clean the project (Build menu -> Clean <project>)
2. Remove all the references to the COM component and, the components that
were replied on if any, from the References node
3. Add the references again as we did in the above test project.

Best Regards,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/default.aspx?target=assistance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

greg

Thanks. I created a new project, added the reference as you suggested, and
typed in just 2 lines of code to create the new instance of the object, it
gave the same error.

I will follow up with the vendor.

Thanks,
Greg

"Jialiang Ge [MSFT]" said:
Good morning Greg. Nice to see you again.

Apart from the possibility that the problem is caused by the component
vendor, (for example, they possibly did not handle the inheritance
relationship rightly or did not apply "Binary Compatibility" when releasing
the new version), another possible cause is related to "re-adding" the COM
component to our project. To double confirm that the error is not caused by
the .NET side, may I suggest re-adding the component based on the following
steps though I understand you already tried doing them:

1. Create a new C# project for test.
2. Add reference to the updated version of the COM component. Be sure that
the TypeLib version is new.
3. Call the code
DocAppObj = new Hummingbird.DM.Extensions.Interop.DOCSObjects.Application();

If this test does not throw the error, I intend to think that the problem
is on the .NET side. You may want to do these steps to your real project:

1. Clean the project (Build menu -> Clean <project>)
2. Remove all the references to the COM component and, the components that
were replied on if any, from the References node
3. Add the references again as we did in the above test project.

Best Regards,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/default.aspx?target=assistance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top