Error in Visual Studio when using Trados Studio 4 libraries to develop a tool.

Hi!
I'm using Trados Studio 4 libraries to develop a tool, to complement the Studio, by following the sample code at
http://producthelp.sdl.com/SDK/ProjectAutomationApi/2017/html/41728de4-3eca-4ffe-a272-f632ca798c70.htm
I tried VS 2012,2013,2015,2017.

I kept getting the following error messages:
1)
Managed Debugging Assistant 'PInvokeStackImbalance' : 'A call to PInvoke function 'SentinelRMSCore!SentinelRMSCore.Interface.LSAPI::VLSsetFileName' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.'
2)
"Could not load file or assembly 'Sdl.FileTypeSupport.Filters.MicrosoftOffice.Word_2, Version=2.0.0.0, Culture=neutral, PublicKeyToken=c28cdb26c445c888' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)"
" at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName, ObjectHandleOnStack type)\r\n at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName)\r\n at System.RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)\r\n at System.Type.GetType(String typeName, Boolean throwOnError)\r\n at Sdl.Core.PluginFramework.DefaultPluginTypeLoader.LoadType(IPlugin plugin, String typeName)"

Please advise, urgently. Thank you so much!

  • Hi Zara

    1) Disable "PInvokeStackImbalance" under the exceptions settings in Visual Studio. Debug > Windows > Exception Settings > Manage Debug Assistant
    "PinvokeStackImbalance" is a managed debugging assistant exception and it used to be turned off in earlier versions of Visual Studio.
    You can find a discussion about it here:
    community.sdl.com/.../7929

    2) It appears your installation of Trados Studio is corrupt. Can you try running a repair under "Programs and Features"?

  • Hi Jesse,

    Thank you so much for your very quick help!
    For 1), thank you for the reminder, I've just disabled the MDA.
    For 2, your answer made me realise that the compiled program would only work if it's in the same directory as the Studio installation path, and not even if the Studio libraries are copied to another path. So that solved the issues!
    Thank you for your great help!
    Have a wonderful weekend!