One of our Add-Ins is missing

Prompted by 2 queries in a week about missing Add-in DLL’s I thought a quick post of the subject may be useful.

One of the problems that I have seen many times during the development and use of EA extensions is the missing Add-In DLL.

If you look at the Manage EA Add-Ins window in EA you may see an entry, as listed in the screenshot below, in the status column indicating that something is missing.

Manage EA Addins windows indicates a missing DLL

Manage EA Addins windows indicates a missing DLL

There is a error code 8000401f3 which indicates that the application failed to create an instance of a COM object using a Class which is not registered on the machine. Hence EA is unable to load the AddIn.

Having seen this issue numerous times I developed my EA Installation Inspector. This program emulates the process that EA may perform in loading your Add-in (Caveat – I don’t have insight to how EA code or how it does stuff in detail works so it’s my guess but seems to work so far).
This program provides more information about the status of the AddIn as illustrated in the screenshot below.

EA Installation Inspector illustrating a missing DLL

EA Installation Inspector illustrating a missing DLL

In this screenshot the purple line indicates that the DLL has not been registered, and hence is unknown to windows. Read the documentation supplied with the AddIn for more information.

Two steps to installing an Add-In

To be able to use your Add-In (DLL/Class) it needs to be known by:

  • EA as an Add-In
  • Windows as a class that can be loaded

I’ll look at these in turn

How does EA know about your Add-In

EA knows about AddIns through registry keys located within the HKCU\Software\Sparx Systems\EAAddins… as illustrated in the screenshot below. The value associated with any of these keys needs to be accurate as it references the class defined in you DLL with the format Assembly.ClassName

EA Add-In registry key

EA Add-In registry key

This list of keys matches the list of AddIns shown in the manage Add-Ins window.

How does Windows know about your Add-In DLL

To be able to load your class EA will make calls to Windows, hence windows needs to know about your class as well, and your DLL (Class) must be registered with windows in a specific manner.

The registration of your class may be performed in different ways. Typically it can be done manually using Regasm or performed as part of your installation by your installer. The registration process should create keys in relevant places in the registry so that when a request is made to load your class the appropriate DLL can be found. There are different versions of RegAsm depending on which .NET framework is being used.

The EA manual indicates that the version of RegAsm to use is that provided with .Net 3.5 with the example

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe “C:\Program Files\MyCompany\EAAddin\EAAddin.dll” /codebase

I suspect, but not tested, that you should use the Regasm supplied with the framework you are using.

The problem as I see it is that with the co-existence of 32-bit and 64-bit programs the location of this information is crucial. Now I’m not a windows expert but I know that by working through the trail from the EA AddIn key,a slow process, a class can be registered with keys in the wrong place. So this is where EA Installation Inspector helps. It follows the trail through the registry from the EA AddIn key to finding the DLL file that contains the class that will be loaded.

So how to resolve

Typically when EA can’t find a file then keys have not been registered correctly. EA Installation Inspector will hopefully indicate the error condition and provide an indication of what is wrong e.g. DLL file missing, keys in wrong location.

To check I will usually then manually register the DLL and rerun the installation inspector to check if the situation has improved. So far this has usually worked and leads me to check out what settings are missing or incorrectly set either in the IDE I am using or in the installer definition.

Here are some checks that you can make which may help resolve your missing DLL within an IDE.

  • Ensure that the DLL you are building is compatible with working with a 32-bit application. I always build my DLL’ 32-bit.
  • With IDE’s check setting
  • some of the defaults are geared towards 64-bit systems – e.g. default framework, default build configurations
  • check the setting Register for COM interop

For installers it is usually the case of accurately checking the definitions – usually against a know good installer.

Conclusion

Hopefully this information has been useful in finding your Add-In. However, if not I’m always interested to know what other issues exists (and hopefully solve them), let me know

Adrian

Advertisements

5 thoughts on “One of our Add-Ins is missing

  1. Pingback: More exploring scripts – looking at application interoperability | EXploring EA

  2. ph

    What to do if DLL is NOT SET (VisioImport.Addin) and i try to add it with regsvr (32 & 64bit path). But it does not work

    Reply
    1. exploringea Post author

      Hi

      I’m not quite sure what you mean by not set – so if I assume you have downloaded and checked with the installation inspector. And you see the entry – VisioImport.Addin – which indicates that the registry entry for EA is configured correctly.

      So we need to ensure that the DLL is registered with windows so that EA can find it.
      I use RegAsm and I normally create a batch file, so I can double check the entry before I run it.

      So my batch file would, for example contain:

      “C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe “C:\Program Files\MyCompany\EAAddin\EAAddin.dll” /codebase”

      then I open a command window WITH administration privileges and run the batch file.
      And see something similar to
      ———————————–
      C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe EAAddin.dll /codebase
      Microsoft (R) .NET Framework Assembly Registration Utility 2.0.50727.5483
      Copyright (C) Microsoft Corporation 1998-2004. All rights reserved.

      RegAsm : warning RA0000 : Registering an unsigned assembly with /codebase can cause your assembly to interfere with other applications that may be installed on the same computer. The /codebase switch is intended to be used only with signed assemblies. Please give your assembly a strong name and re-register it.
      Types registered successfully
      ———————————–
      The important response here is that the Types are registered successfully.
      If you rerun the installation inspector I would expect to see a complete entry.
      If you open EA and select menu “Extensions | Mange Add-ins” you should see the addin listed.
      If there is an error then check the error code for example 0x800401f3 means that “Invalid class string” which means that EA could find the class (this should not be the case if it is correctly displayed in the Installation Inspector)

      I hope this helps – if not what do you see? A screen shot from installation inspector would be useful – this can be obtained from the “Copy .. to clipboard” button which grabs an image of the app screen.

      Reply
  3. ph

    I tried with 32bit and 64bit RegAsm, as well as with 32 and 64bit Regsvr32



    this leads to

    best regards

    Reply
    1. adrianlincoln

      Hi
      I have not used the visioimporter so just downloaded from the sparx site and installed by running the exe supplied which worked fine and created all the relevant registry entries.
      It all seems to work fine for me, although I did need to enable the AddIn under “Extensions | Manage addins” and then restart EA, so that it picked up the relevant information.

      What I didn’t realise was that it is a TypeLib, and they work differently from the normal .NET assembly DLL’s covered in my post.

      So, as your screenshot illustrates, Installation Inspector does not present the relevant information as it is not a .NET assembly, and since l know we are not looking for theses types of libraries it is no surprise; hence a DLL value being not set.

      However, I you open the registry using regedit and then a find (and find again F3) for the GUID for VisioImporter “77957BB1-AC6B-4A0B-BA36-6AA79E974C1C” – you should see the various entries, and importantly the entry that contains a sub-entry for InprocServer32 with a key to the relevant file.

      On a positive note I have seen the VisionImporter AddIn work following the simple install (don’t forget you may need to run the exe as admin), and if it doesn’t I would contact Sparx support as it is their product.

      Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s