Developing application to automate translations

Hi

I am trying to develop an application which will create a translation project, then load the translation memory and process a number of files, producing translated output files. I was going to use FileBasedProject to create a new project, then using the FileBasedTranslationMemory to determine the source/destination languages, and then convert the files.

I found (in the SDK samples) that there's a program in the project automation samples called BatchAnalyze which does pretty much what I want. However, this simple application compiles, but does not run.  When I compile and run (in its original form, it crashes ProjectCreator.cs:50

FileBasedProject newProject = new FileBasedProject(this.GetProjectInfo(srcLocale, trgLocale));

with error:

log4net:ERROR XmlConfigurator: Failed to find configuration section 'log4net' in
the application's .config file. Check your .config file for the <log4net> and <
configSections> elements. The configuration section should look like: <section n
ame="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" /
>

and Managed Debugging Assistant 'PInvokeStackImbalance' occurred
HResult=0x00000000
Message=**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.'

 

I was originally using VS2015, but saw that VS2017 should be used with SDK v5.0 (https://community.sdl.com/developers/language-developers/f/61/p/9856/37952#37952), so I am now using VS2017, but I still see the same issue.

 

I added log4net (v2.08) to the references, and now when I get to ProjectCreator.cs:50, I get a different error

Service 'Sdl.Desktop.Platform.Services.IUserSettingsService' could not be started.

Am now at a bit of a loss. Any ideas?

Cheers
Geoff

Parents Reply Children
  • Hi Romulus

    That addresses the 'PInvokeStackImbalance' issue (which I could disable in the managed exceptions), but I still get the error:
    Service 'Sdl.Desktop.Platform.Services.IUserSettingsService' could not be started.

    That's caught in the try/catch around the ProjectCreator process.Create function. However by disabling the try/catch, It appears that the Sdl.Desktop.Platform.Implementation.Services.ServiceContext.GetLocalService[T]() function may be trying to load log4net v1.2.10 (I had added v2.08), so I'll uninstall v2.08 and try again with 1.2.10 instead.

    Thanks
    Geoff
  • Hi again

    OK - installing log4net v1.2.10 didn't make any difference, so I figured something else must be wrong. I installed the SDK v5.0 onto a different development machine, and opened the solution, disabled the PInvokeStackImbalance, and stepped past the FileBasedProject() function, and onto the AddFiles.

    I can only think that there's something not installed correctly or missing on my other development machine, so I'll close this as verified answer.

    Thanks
    Geoff