none
SxS error: App -> COM\old style COM -> Assembly COM RRS feed

  • Question

  • Hi,

    we are trying to make our application 100% sxs. We have one problem left:

    If the sxs application calls an old style COM component in the bin subdirectory and this COM component calls an assembly COM, no class could be created unless the class was created once in the application component before.

    Sample app manifest:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> 
      <assemblyIdentity name="AppId" 
                        version="1.0.2.0" 
                        publicKeyToken="195be5ea560121c5" 
                        processorArchitecture="MSIL"/>

     

      <file name="AppName.exe" hashalg="SHA1"/>    

      <dependency>

        <dependentAssembly>

          <assemblyIdentity name="bin"

                            version="1.0.0.0"

                            type="win32"

                            processorArchitecture="x86"

                            language="*"/>

        </dependentAssembly>

      </dependency>

      <dependency>

        <dependentAssembly>

          <assemblyIdentity name="CPTypes"

                      version="1.0.11.0"

                      publicKeyToken="015dc0059e410dd9"

                      processorArchitecture="x86"/>

        </dependentAssembly>

      </dependency>

    </assembly>


    A COM component in the bin directory create a COM class exported by "CPTypes" assembly
    We tried a lot and read a lot of documentation. Any idea?

    Thanks a lot.

    • Edited by T01 Wednesday, March 17, 2010 2:53 PM
    Tuesday, March 16, 2010 8:54 AM

All replies

  • Did you verify that your assembly CPTypes is properly registered for COM on your machine? (like here or here)
    Or do you use reg-free COM?

    -Karel
    Tuesday, March 16, 2010 4:33 PM
    Moderator

  • Thanks for your answer and links.

    We use reg-free COM. The whole application is working sxs. We tested it on a clean XP and Vista machine. CPTypes has an embedded manifest.

    If we call all CPTypes classes with 

    C#: Type.GetTypeFromCLSID(Id)
    C++: CoCreateInstance(Id)

    in the main component (exe) once and do nothing with these classes, the whole application is initialized fine.

    First we thought it is something about loading the assembly (CPTypes) to be ready for old COM style components. But we have to create an instance of every single class.

    If we do not do this workaround, no old style COM component could create an assemby COM class (from CPTypes).

    sxstrace.exe log at application startup reports no error.


    - T01

    Tuesday, March 16, 2010 5:38 PM
  • Hi,

    Does the embedded manifest of CPTypes support reg-free? the outside manifest will be ignored if the com dll already has an embedded manifest.


    Sincerely,
    Eric
    MSDN Subscriber Support in Forum
    If you have any feedback of our support, please contact msdnmg@microsoft.com.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Friday, March 19, 2010 2:15 AM
  • Hi,

    I'm writing to check the issue status, please feel free to let us know if you have any concern.


    Sincerely,
    Eric
    MSDN Subscriber Support in Forum
    If you have any feedback of our support, please contact msdnmg@microsoft.com.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Wednesday, March 24, 2010 4:47 AM
  • Hi,

    Sorry for my late answer. Yes, all components have embedded manifests.

    We made a change to all components, set the Architectur to x86, to support "so called x64 installation". Because we hat some components x86 and some MSIL, I hat a little hope, that this may fix it. -- Negative. 

    Sincerely,

    T01

    Wednesday, March 24, 2010 5:15 AM
  • The sxs manifest stuff is generated by mt.exe:

    mt.exe -managedassemblyname:CPTypes.dll -out:CPTypes.manifest

    clrClass & clrSurrogate tags are ok and the manifest is embedded by a post build cmd:

    mt.exe -manifest "$(ProjectDir)$(InputName).manifest" -outputresource:"$(TargetPath)";#1
    sn.exe -R "$(TargetPath)" $(ProjectDir)signkey.snk

    Since our applications have a lot of components, I try to find a little time this weekend to write a simple test application.

    T01

     

    Thursday, March 25, 2010 9:19 AM
  • What's the HRESULT value that you get from CoCreateInstance when old style COM component tries to create COM class from CPTypes?

    What happens if you register the CPTypes.dll using regasm? Does it work fine? 

    Thursday, March 25, 2010 3:02 PM
  • Registration of CPTypes.dll fixes it all. We do this at the moment in our setups  (with all managed components, witch export COM).

    If the managed component is not registered or a class is not once created in EXE component: CoCreateInstance() in old style COM component -> 0x80040154 (class not registered).

    Sincerely,

    T01

     

    Thursday, March 25, 2010 5:26 PM
  • Hello

    Regfree COM component requires a special manifest like the below. It appears that you are not having it in your COM dll. Please walk through the article http://msdn.microsoft.com/en-us/library/ms973913.aspx to learn how to add it.

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <assembly xmlns="urn:schemas-microsoft-com:asm.v1"
      manifestVersion="1.0">

    <assemblyIdentity
       type="win32"
       name="SideBySide.X"
       version="1.0.0.0" />

    <file name = "SideBySide.dll">

    <comClass
        clsid="{[CLSID_SideBySideClass]}"
        threadingModel = "Apartment" />

    <typelib tlbid="{[LIBID_SideBySide]}"
           version="1.0" helpdir=""/>

    </file>

    <comInterfaceExternalProxyStub
        name="ISideBySideClass"
        iid="{[IID_ISideBySideClass]}"
        proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"
        baseInterface="{00000000-0000-0000-C000-000000000046}"
        tlbid = "{[LIBID_SideBySide]}" />

    </assembly>


    Regards,
    Jialiang Ge
    MSDN Subscriber Support in Forum
    If you have any feedback of our support, please contact msdnmg@microsoft.com.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Monday, March 29, 2010 9:33 AM
    Moderator
  •  

    All old style COM components are placed in a subdirectory "bin". All classes and interfaces of all these components are described in one external manifest file "bin.manifest".

    SxS is working with the described workaround "Post: Tuesday, March 16, 2010 5:38 PM". I'm still wondering why 100% sxs is working fine with this workaround.

    But may be, you showed in the right direction. I am not sure, whether we use the "comInterfaceExternalProxyStub" tag in the right way. We do not use automation, but we hat some STA/MTA errors, with we do not have, when we register everything.

    I need a little time to analyse this.

    Thanx a lot.

    Tuesday, March 30, 2010 11:57 AM
  • Hi,

    How about the analysis result? please feel free to let us know if you have any concern.


    Sincerely,
    Eric
    MSDN Subscriber Support in Forum
    If you have any feedback of our support, please contact msdnmg@microsoft.com.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Tuesday, April 6, 2010 2:08 AM