Symptoms

It takes very long time to register the add-in in SOLIDWORKS PDM vault using the SOLIDWORKS PDM administration utility. Sometimes the This action cannot be completed because the ‘’ program is not responding. Choose “Switch To” and correct the problem message is displayed multiple times while adding the add-in.

Program is not responding error
Program is not responding error

In some cases unexpected code is executed or random errors appear.

Cause

Too many COM visible classes present in the add-in dll.

When add-in is added to the vault via SOLIDWORKS PDM Administration tool, all public COM visible classes from all dlls will be probed by SOLIDWORKS PDM. It means that instances of all classes will be created regardless the class is add-in or not or is it used or not.

In most cases this issue is caused if Make assembly COM-visible option is checked in the project properties.

COM Visible assembly
COM Visible assembly

This will make all the public classes automatically visible for COM.

Example

  • Create new PDM add-in and add new class (e.g. MyComClass) and display the message box from within its constructor
public class MyComClass
{
    public MyComClass()
    {
        MessageBox.Show("MyComClass");
    }
}

public class PdmAddIn : IEdmAddIn5
{
    ...
}
  • Check Make assembly COM-visible option in the project settings
  • Compile the add-in and add this to the vault using the SOLIDWORKS PDM Administration tool.

As the result it would take more time and the following message will be shown which indicates that an instance of MyComClass was created while adding the add-in to the vault.

Message box in the COM visible class displayed while registering the add-in
Message box in the COM visible class displayed while registering the add-in

Resolution

Do not use the Make assembly COM-visible option unless explicitly required.

Only mark the main add-in class with ComVisible attribute with value set to True

[ComVisible(true)]
public class PdmAddIn : IEdmAddIn5
{
}