solidworks-api icon indicating copy to clipboard operation
solidworks-api copied to clipboard

Cannot get localized strings because ConfigureServices is overridden

Open brinkdinges opened this issue 4 years ago • 6 comments

I have just updated SolidDna in a project from 1.0.1.9 to 1.0.1.13, the latest version. Now I get an exception early when starting up the add-in. I narrowed it down to the fact that no LocalizationManager is ever set up, so getting a localized string in a SolidDna wrapper fails.

ConfigureServices in my add-in is being called and it's been empty for three years. I now see that on May 13th, this method went from abstract to virtual. Setting the LocalizationManager happens in the virtual base method ConfigureServices within SolidDna.

Should we keep setting up the LocalizationManager in this method? What if another user overrides this method and then has no LocalizationManager?

brinkdinges avatar Jul 04 '20 15:07 brinkdinges

I've been trying to update to the latest version of SolidDna (1.01.13) because the earlier versions (1.01.10 and earlier) don't accept the 2020 interop files and regasm fails. However, 1.01.13 registers OK with the 2020 interops, but crashes on opening swx. This happens, so far as I can tell, in the ConnectedToSolidworks method.

The method successfully creates the taskpane object and gains access to the mswApp, but crashes before any windows show in SolidWorks.

Could this be related to the issue you describe above?

2021-11-05 06_34_39-Helmtool Utilities (Debugging) - Microsoft Visual Studio

dhozen avatar Nov 05 '21 11:11 dhozen

You should use the same DLL version as SolidDna uses so your project compiles and can be registered. It has no influence on how your app runs. See my explanation here.

If you have a ConfigureServices method in your add-in, delete it so it is not overridden with an empty method.

Have you tried a try-catch around your code in ConnectedToSolidWorks? That should give us a hint and hopefully, an exception message.

brinkdinges avatar Nov 05 '21 13:11 brinkdinges

Thanks Brink! Commenting out the whole "ConfigureServices" method fixed it.

And thanks for the DLL version explanation...

-Jason S.

dhozen avatar Nov 05 '21 15:11 dhozen

Rather thanks Peter :^) Komt u uit Nederland?

dhozen avatar Nov 05 '21 15:11 dhozen

Awesome, you're welcome. And yes, that's where I'm from ;)

brinkdinges avatar Nov 07 '21 17:11 brinkdinges

Ik heb in Zaandam een jaar gewoond (1968). Spreek een beetje, maar heb veel vergeten. Danke nog een keer...

dhozen avatar Nov 07 '21 17:11 dhozen