none
TLBEXP warning about IPictureDisp RRS feed

  • Question

  • Hi,

    I'm working on a C# library that is to be used as a COM component. A Picture property of type IPictureDisp is exposed.

    During TLBEXP I get the warning message "TlbExp : warning TX0013116F: Type library exporter warning processing 'Easymap.AddIn.COM.IImageElement.get_Picture(#0), Easymap.AddIn'. Warning: Type library exporter could not find the type library for 'stdole.IPictureDisp'.  IUnknown was substituted for the interface."

    My project has a reference to stdole.dll and the exported typelib has an importlib("stdole2.tlb") statement as well. Everything works but my interface is not strongly typed. So the corresponding typelib seems to be there but the warning comes nevertheless.

    Does anyone have an explanation/resolution for this?

    Thanks,
    Thomas

    • Moved by Leo Liu - MSFT Tuesday, February 14, 2012 6:04 AM Moved for better support. (From:Visual C# General)
    Monday, February 13, 2012 10:11 AM

Answers

  • Set the "Embed Interop Types" for stdole to false.  Doing so has solved my error with exposing the StdPicture as a return value to my C# com object.

    No more  "Warning: Type library exporter could not find the type library for 'stdole.IPictureDisp'.  IUnknown was substituted for the interface."  :)  I think it is because the stdole.tlb gets referenced as a com interop wrapper and is not available to the tlbexp process and thus can not find the actual tlb.  Setting the embed to false must do something to allow the tlbexp to locate the source tlb and extract the information correctly.

    • Edited by Redline99 Thursday, March 27, 2014 3:02 AM
    • Marked as answer by thomas_schmidt Tuesday, July 8, 2014 7:20 AM
    Thursday, March 27, 2014 2:57 AM

All replies

  • Hello Thomas,

    1. One possible cause of this is that TLBEXP.EXE was not able to locate STDOLE2.TLB at runtime.

    2. Check to ensure that STDOLE2.TLB is located in the windows system32 folder.

    - Bio.


    Please visit my blog : http://limbioliong.wordpress.com/

    Monday, February 13, 2012 2:58 PM
  • Hi Bio,

    thanks for your reply.

    Doesn't look so, stdole2.tlb is in system32 and syswow64. I verified with procmon that access to the tlb succeeded.

    Thomas

    Tuesday, February 14, 2012 8:30 AM
  • Hi Thomas,

    Could you please show us the command when you use TlbExp?

    I'd like to suggest use Rsgasm.exe instead of TlbExp, this is because Tlbexp.exe generates a type library but does not register it. This is in contrast to the Assembly Registration tool (Regasm.exe), which both generates and registers a type library. To generate and register a type library with COM, use Regasm.exe.


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, February 16, 2012 7:42 AM
  • Paul,

    here's my command plus the result:

    T:\thomas\tlb>tlbexp Easymap.AddIn.dll /out:out.tlb /win32

    Microsoft (R) .NET Framework Assembly to Type Library Converter 4.0.30319.1
    Copyright (C) Microsoft Corporation.  All rights reserved.

    TlbExp : warning TX0013116F : Type library exporter warning processing 'Easymap.AddIn.COM.IImageElement.get_Picture(#0), Easymap.AddIn'. Warning: Type library exporter could not find the type library for 'stdole.IPictureDisp'.  IUnknown was substituted for the interface.
    Assembly exported to 'T:\thomas\tlb\out.tlb'

    Thanks,

    Thomas

    Thursday, February 16, 2012 12:29 PM
  • Hello Thomas,

    1. Unfortunately, I could not re-create the problem described in the OP.

    2. Here is my very simple sample code that I used :

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Runtime.InteropServices;
    using stdole;
    
    namespace Easymap
    {
        [ComVisible(true)]
        [Guid("9E8FFA0B-E628-4a02-A3E3-8AFEC39903C6")]
        [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
        public interface IImageElement
        {
            IPictureDisp Picture
            {
                get;
            }
        }
    
        [ComVisible(true)]
        [Guid("6FD316AE-17C5-4897-89F0-D0FB95B36979")]
        [ClassInterface(ClassInterfaceType.None)]
        public class AddIn : IImageElement
        {
            public IPictureDisp Picture
            {
                get
                {
                    return null;
                }
            }
    
        }
    }
    

    3. The referenced stdole interop assembly is located at : "C:\Program Files (x86)\Microsoft.NET\Primary Interop Assemblies\stdole.dll" on my machine.

    4. I could run tlbexp.exe with no problems.

    5. As an alternative, I also substituted "IPictureDisp" with "stdole.Picture" with no problems :

    public interface IImageElement
    {
        stdole.Picture Picture
        {
            get;
        }
    }
    
    ...
    ...
    ...
    
    public stdole.Picture Picture
    {
        get
        {
            return null;
        }
    }
    

    6. Both versions produced the same resultant IDL :

    // Generated .IDL file (by the OLE/COM Object Viewer)
    // 
    // typelib filename: <could not determine filename>
    
    [
      uuid(1D61DD33-4B5D-41F2-8352-C814B5567371),
      version(1.0)
    ]
    library Easymap
    {
        // TLib :     // TLib : mscorlib.dll : {BED7F4EA-1A96-11D2-8F08-00A0C9A6186D}
        importlib("mscorlib.tlb");
        // TLib : OLE Automation : {00020430-0000-0000-C000-000000000046}
        importlib("stdole2.tlb");
    
        // Forward declare all types defined in this typelib
        interface IImageElement;
    
        [
          odl,
          uuid(9E8FFA0B-E628-4A02-A3E3-8AFEC39903C6),
          version(1.0),
          oleautomation,
            custom({0F21F359-AB84-41E8-9A78-36D110E6D2F9}, "Easymap.IImageElement")    
    
        ]
        interface IImageElement : IUnknown {
            [propget]
            HRESULT _stdcall Picture([out, retval] Picture** pRetVal);
        };
    
        [
          uuid(6FD316AE-17C5-4897-89F0-D0FB95B36979),
          version(1.0),
            custom({0F21F359-AB84-41E8-9A78-36D110E6D2F9}, "Easymap.AddIn")
        ]
        coclass AddIn {
            interface _Object;
            [default] interface IImageElement;
        };
    };
    
    - Bio.


    Please visit my blog : http://limbioliong.wordpress.com/

    Thursday, February 16, 2012 1:15 PM
  • I have essentially this same problem. How did you solve yours?

    Jeff

    Monday, August 6, 2012 9:06 PM
  • I didn't solve it (yet), but I suspect it has something to do with my Interface returning stdole.IPictureDisp and my project referencing a local copy of stdole.dll.

    Thomas

    Monday, August 13, 2012 12:24 PM
  • Set the "Embed Interop Types" for stdole to false.  Doing so has solved my error with exposing the StdPicture as a return value to my C# com object.

    No more  "Warning: Type library exporter could not find the type library for 'stdole.IPictureDisp'.  IUnknown was substituted for the interface."  :)  I think it is because the stdole.tlb gets referenced as a com interop wrapper and is not available to the tlbexp process and thus can not find the actual tlb.  Setting the embed to false must do something to allow the tlbexp to locate the source tlb and extract the information correctly.

    • Edited by Redline99 Thursday, March 27, 2014 3:02 AM
    • Marked as answer by thomas_schmidt Tuesday, July 8, 2014 7:20 AM
    Thursday, March 27, 2014 2:57 AM