A strange problem with importing TLB 
Author Message
 A strange problem with importing TLB

Hi,

I have a big application (MyApp) that allows to drive itself with COM/OLE.
I want to drive this application from my .net project therefore
I'm trying to import the app's TLB to an assembly. But when I try to do so
both in the Visual Studio or with TlbImp utility I get the error:
-
TlbImp error: System.TypeLoadException - Could not load type
MyApp.TroubleItemClass from
 assembly MyApp, Version=2.0.0.0.
-

I've looked to the IDL file for the MyApp but I cannot find anything
that would give my any clue. The coclass definition looks to be
very usual:

 [
  object,
  uuid(7050cef4-b11e-4529-ad83-2d58179aaca1),
  dual,
  helpstring("ITroubleItem Interface"),
  pointer_default(unique)
 ]
 interface ITroubleItem: IParentItem
 {
  ...
 }

 [ uuid(bbe29841-6541-4e99-beb5-b94dd698978b) , noncreatable]
 coclass TroubleItem
 {
   [default] interface ITroubleItem;
 };

I've found in the Internet that it could be a problem if the parent
interfaces
are declared in another library but it is not my case as all interfaces
that relate to TroubleItem are declared in MyApp.IDL.

Also I've updated my .net platform to SP2, but it didn't help.

I've tried to change the name of the TroubleItem coclass and change
the uuid of it but it doesn't help either.

If I remove the definition of the TroubleItem coclass from MyApp.IDL
then the TlbImp produces the assembly without any errors, but
I need this coclass and I cannot understand what is wrong with it.

Does anybody has any clue about a possible solution?
If it is any well-known problem a solution for which is
described, can I have a URL in that case, please?
Is there any way how I can track the problem to the core?

Thanks,
--------

Software developer         007 8462 357139
Delcam plc                  www.delcam.com



Fri, 29 Apr 2005 13:28:05 GMT  
 A strange problem with importing TLB
Hello Dmitriym

I am not very clear about why you mark the TroubleItem with noncreatable,
which causes COM object can not be instantiated by CoCreateInstace() etc.
However, I suspect it is the issue, please try removing it and import again.

Hope this help.

Best regards,

Lion Shi [MS]
MCSE, MCSD
Microsoft Support Engineer

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.  2001 Microsoft Corporation. All rights
reserved.
--------------------

    Subject: A strange problem with importing TLB
    Date: Mon, 11 Nov 2002 09:28:05 +0400
    Lines: 64
    X-Priority: 3
    X-MSMail-Priority: Normal
    X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
    X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000

    Newsgroups:
microsoft.public.dotnet.languages.CSharp,microsoft.public.dotnet.languages.v
b
    NNTP-Posting-Host: 62.76.42.6
    Path: cpmsftngxa08!tkmsftngp01!tkmsftngp08
    Xref: cpmsftngxa08 microsoft.public.dotnet.languages.vb:74273
microsoft.public.dotnet.languages.csharp:106875
    X-Tomcat-NG: microsoft.public.dotnet.languages.csharp

    Hi,

    I have a big application (MyApp) that allows to drive itself with
COM/OLE.
    I want to drive this application from my .net project therefore
    I'm trying to import the app's TLB to an assembly. But when I try to do
so
    both in the Visual Studio or with TlbImp utility I get the error:
    -
    TlbImp error: System.TypeLoadException - Could not load type
    MyApp.TroubleItemClass from
     assembly MyApp, Version=2.0.0.0.
    -

    I've looked to the IDL file for the MyApp but I cannot find anything
    that would give my any clue. The coclass definition looks to be
    very usual:

     [
      object,
      uuid(7050cef4-b11e-4529-ad83-2d58179aaca1),
      dual,
      helpstring("ITroubleItem Interface"),
      pointer_default(unique)
     ]
     interface ITroubleItem: IParentItem
     {
      ...
     }

     [ uuid(bbe29841-6541-4e99-beb5-b94dd698978b) , noncreatable]
     coclass TroubleItem
     {
       [default] interface ITroubleItem;
     };

    I've found in the Internet that it could be a problem if the parent
    interfaces
    are declared in another library but it is not my case as all interfaces
    that relate to TroubleItem are declared in MyApp.IDL.

    Also I've updated my .net platform to SP2, but it didn't help.

    I've tried to change the name of the TroubleItem coclass and change
    the uuid of it but it doesn't help either.

    If I remove the definition of the TroubleItem coclass from MyApp.IDL
    then the TlbImp produces the assembly without any errors, but
    I need this coclass and I cannot understand what is wrong with it.

    Does anybody has any clue about a possible solution?
    If it is any well-known problem a solution for which is
    described, can I have a URL in that case, please?
    Is there any way how I can track the problem to the core?

    Thanks,
    --------

    Software developer         007 8462 357139
    Delcam plc                  www.delcam.com



Mon, 02 May 2005 11:17:22 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. #import problem in VC++.NET (tlb is created after the DLL)

2. #import with EMBEDDED_IDL results in all types in my own tlb

3. Importing mscolib.tlb

4. Howto Import com dll referencing a tlb?

5. a simple question on raw method with #import Mylib.tlb

6. importing dll vs tlb

7. Import .tlb or .dll?

8. Importing MS Access TLB file

9. import type from tlb

10. #import *.tlb chokes

11. #import <mshtml.tlb>

12. Receiving events from imported tlb

 

 
Powered by phpBB® Forum Software