SideBySide Registration-Free COM fail while loading

3

i'm trying to create a C# COM Server which is used by a Delphi App without a COM-Registration.

The process is descried on a ms blog - Registration-Free Activation of .NET-Based Components: A Walkthrough

I created the necessarily manifest files and i linked them to the assemblies.

The App Manifest:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <assemblyIdentity
    type="win32"
    name="Vorg"
    version="1.0.0.0" />
  <dependency>
    <dependentAssembly>
      <assemblyIdentity
        type="win32"
        name="Microsoft.Windows.Common-Controls"
        version="6.0.0.0"
        publicKeyToken="6595b64144ccf1df"
        language="*"
        processorArchitecture="x86"/>
    </dependentAssembly>
  </dependency>
  <dependency>
    <dependentAssembly>
                <assemblyIdentity
                            type="win32"
                            name="Vorg.WpfClient"
                            version="1.0.0.0" />
    </dependentAssembly>
  </dependency>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel
          level="asInvoker"
          uiAccess="false"/>
        </requestedPrivileges>
    </security>
  </trustInfo>
</assembly>

and the assembly manifest:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <assemblyIdentity type="win32" name="Vorg.WpfClient" version="1.0.0.0" />
    <clrClass
        clsid="{69A72676-8EA7-3C38-BFBC-F0DFE745C329}"
        progid="Vorg.WpfClient"
        threadingModel="Both"
        name="KundM.Vorg.WpfClient.VorgComClient">
    </clrClass>
</assembly>

those are working fine (i think). sxs does not report any errors. clsid is also correct for the com-class. but when starting the app, it is crashing by an ole exception 0x8013101b.

removing the manifests and running the app results of curse in a class not found exception. having the com-class registered the app starts normal without any errors.

the exception maybe says something like "wrong framework versions".

i tried to specify the runtime in the class manifest. but that didn't solve the problem.

what causes the exception?

how can i solve that problem?

c#
.net
delphi
com
asked on Stack Overflow May 8, 2012 by Bernd Ott

1 Answer

3

Solved.

The program Fuslogvw.exe gave me the right direction. this tool shows the loading process of assemblies.

to enable it you need to create a reg key.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fusion dword ForceLog=1

the report is generated there showed me this (sorry german framework):

LOG: DisplayName = vorg.wpfclient, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
 (Fully-specified)
===
LOG: Diese Bindung startet im default-Load-Kontext.
LOG: Der Assembly-Download wurde durchgeführt. Datei-Setup wird begonnen: E:\work\VOrg\bin\vorg.wpfclient.dll.
LOG: Die von der Quelle ausgeführte Setup-Phase beginnt.
LOG: Der Assemblyname ist: Vorg.WpfClient, Version=1.0.0.0, Culture=neutral, PublicKeyToken=174d633867192b66.
WRN: Der Vergleich des Assemblynamens führte zum Konflikt: PUBLIC KEY TOKEN.
ERR: Der Assemblyverweis entsprach nicht der gefundenen Assemblydefinition.
ERR: Das Setup der Assembly konnte nicht abgeschlossen werden (hr = 0x80131040). Die Suche wurde beendet.

i did not specified the public key token in the manifests. now i do! the schemafile for manifests from microsoft is wrong! it shows version and some other attributes as optional.

i also specified the runtime within the com manifest. it is also possible to specify the framework version by a app.config file.

answered on Stack Overflow May 9, 2012 by Bernd Ott

User contributions licensed under CC BY-SA 3.0