How to resolve PDM API incompatible MarshalAs when attempting to debug add-ins

Hello,

I am trying to debug my pdm API add-in but when the code enters the OnCmd method the debugger crashes with the error below:

InvalidMemberDeclaration was detected

Message: 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 'pdmAddinVS2012, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. This is most likely due to an incompatible MarshalAs attribute on one of the parameters.

I have no idea what this means.

I run the add-in via notepad.exe and the debugger works OK and hits the breakpoint I set in the GetAddInInfo method, but when the code proceeds to the OnCmd method it throws the error above.

I have tried this on both win7 and win10, on both VS2012 and VS2015. I am running the pdm admin tool and Visual Studio "as admin", I cleared out the plugins folder, etc.

has anyone dealt with this problem before?

SolidworksApi macros