SDL SDK Api PreTranslateFiles randomly fails

I am stumped.

I have a very basic SDK app, that requires an SDL Project file path and a target language; then attempts to run the "PreTranslateFiles" task.

namespace Sdl.Sdk.PreTranslateFiles
{
    using System;
    using System.Globalization;
    using Sdl.Core.Globalization;
    using Sdl.ProjectAutomation.Core;
    using Sdl.ProjectAutomation.FileBased;
    public class PreTranslateFiles
    {
        public void Create(
            string SdlProjectFilepath,
            string SdlTargetLanguage
        )
        {
            FileBasedProject ThisSdlProjectObject = new FileBasedProject(SdlProjectFilepath);
            this.RunAutomaticTask(ThisSdlProjectObject, SdlTargetLanguage);
            ThisSdlProjectObject.Save(); 
        }
        private void RunAutomaticTask(FileBasedProject ThisSdlProject, string TargetLanguageCode)
        {
            ProjectFile[] targetFiles = ThisSdlProject.GetTargetLanguageFiles(new Language(CultureInfo.GetCultureInfo(TargetLanguageCode)));
            AutomaticTask preTranslate = ThisSdlProject.RunAutomaticTask(targetFiles.GetIds(), AutomaticTaskTemplateIds.PreTranslateFiles);            
        }
    }
}

However, for reasons that I cannot figure out, the "PreTranslateFiles" task randomly fails to run, which results in the error message "Index was outside the bounds of the array"; if/when attempting to run the "AnalyzeFiles".

My tests (run in batches of 20 reps) are based on an SDL Project; which have files already converted to translatable format and are copied to target languages.

  • Test 1, set up using a template: resulted in 15% failure rate
  • Test 2, same as Test 1: resulted in 25% failure rate
  • Test 3, same as Test 1&2: resulted in 45% failure rate
  • Test 4, reset SDL program and user settings to default, set up using a template: resulted in 55% failure rate
  • Test 5, set up without using a template: resulted in 20% failure rate

I have also monitored the %USERPROFILE%\AppData\Local\Temp directory, and noticed that the SDL randomly-generated .zip, .tmp files and directories are not created when the task fails.

I added a couple of real-time protection exclusion rules to:

  •  %USERPROFILE%\AppData\Local\Temp
  • C:\Program Files (x86)\SDL\*

...but this did not change anything.

Has anyone had any experience like this, or have any clue why the "PreTranslateFiles" task would decide to randomly fail?

Thanks in advance

Parents Reply Children
No Data