1 Reply Latest reply on Jan 2, 2018 9:47 AM by Andri Olafsson

    Sample for create Add-in does not work

    Mo Bria

      I try to build my first Add-in for PDM Professional. I use the following sample: 2016 SOLIDWORKS API Help - Creating Add-ins (C#)

      Until point 22 everything works correctly and I think I have done everything correctly.

      At point 23 when I click on the tresor and right click on it an click on the Add-in on the context menu, I receive the following bug:

      "Managed Debugging Assistant 'InvalidMemberDeclaration' has detected a problem in C:\...\notepad.exe" and the following bug which is in German:

      "Fehler beim Bestimmen der Marshallingmethode für die Parameter des "OnCmd"-Members vom Typ "EdmLib.IEdmAddIn5": System.TypeLoadException: Der Typ "EdmLib.EdmCmdData" in der Assembly "TestSolidworks, Version=, Culture=neutral, PublicKeyToken=null" konnte nicht geladen werden.. Mögliche Ursache: Nicht kompatibles MarshalAs-Attribut für einen der Parameter."

      which means something like "Error in defining the marshall method of the parameters of OnCmd Member of type EdmLib.IEdmAddIn5: System.TypeLoadException: The type of EDMLib.EdmCmdData of assembly TestSolidworks, version=, culture=neutral, publickeytoken=null cannot be loaded. Possible reason: Not compatible MarshalAs-Attribut of one of the parameters"

      What have I to change?

        • Re: Sample for create Add-in does not work
          Andri Olafsson

          Hi, I'm experiencing the exact same error.

          I believe the error is related to the .net framework backwards compatability. Although I am not sure, this started happening after I installed Visual Studio 2017 and .net 4.5




          Additional information: The following error occurred while determining how to marshal the parameters of member 'OnCmd' of type 'EdmLib.IEdmAddIn5': System.TypeLoadException:  Could not load type 'EdmLib.EdmCmdData' from assembly 'ReviewReports, Version=, Culture=neutral, PublicKeyToken=null'.  This is most likely due to an incompatible MarshalAs attribute on one of the parameters.