After Upgrade to Trados Studio 2022, Project Automation API is unable to create Project Package if Termbase exists in Project

Dear Trados Studio Developers Community,

 we have an external app that automates processes between an external system and Trados Studio Using Trados API, especially ProjectAutomation.

The code of this app is working fine when used with Trados Studio 2019.

 We now wanted to update the dependencies in order to be compatible with the Trados Studio 2022 release.

However, once this was done and the API is applied against Trados Studio 2022, we encountered that we are no longer able to create ProjectPackages via API methods.

This error behaviour exists only, if the FileBasedProject contains TDs (Term databases).

 If we run the same code without adding a TD, only TMs, to the project, the process runs fine, and the package is created successfully and can be saved.

 Here is what we do for this specific process (short summary):

  • Create the filebased Project
  • Add TMs and TDs, files,
  • Run batch tasks,
  • Create a manual task in order to generate the translation package
  • Export Project Package

 We were able to identify that we do not receive any return value by the method ProjectPackageCreation  of the class FileBasedProject:

 public ProjectPackageCreation CreateProjectPackage(Guid manualTaskId, string packageName, string comment, ProjectPackageCreationOptions options);

 We also already tried to use the second version of this method in order to logg any output by the eventhandlers, also without any result.

 public static FileBasedProject CreateFromProjectPackage(string projectPackageFilePath, string projectFolder, EventHandler<Core.ProgressEventArgs> statusEventHandler, EventHandler<MessageEventArgs> messageEventHandler, out ProjectPackageImport result);

 Here are code snippets that show what happens once we create the manual task and then invoke the method to create the project package:

 

private void CreateProjectPackage(FileBasedProject createdProject, TradosProjectInfo projectInfo)

        {

            var taskFiles = GetTaskFiles(createdProject);

            ManualTask translate = createdProject.CreateManualTask(

                "Translate",

                "Trados Web Api",

                DateTime.Now.AddDays(7),

                taskFiles);

 

            int count = 0;

            ProjectPackageCreation package = null;

 

            while (count < NumberOfRetries)

            {

                try

                {

                    package = CreateProjectPackage(createdProject, projectInfo, translate);

                    break;

                }

                catch(CreateProjectPackageTradosException ex)

                {

                    count++;

                    if (count == NumberOfRetries)

                        throw ex;

                }

            }

           

            createdProject.SavePackageAs(package.PackageId, projectInfo.PackageFilePath);

        }

 Basically, the existing file based project as well as project metadata are provided for this method.

Then the manual translation task is created and the project package creation is started.

If this provides the package and packaging was successful, we save the project package to the package file path.

 The method that actually should create the project package:

 

private ProjectPackageCreation CreateProjectPackage(FileBasedProject createdProject, TradosProjectInfo projectInfo, ManualTask translate)

        {

            /*

            * THE FILEBASEPROJECT API METHOD CREATEPROJECTPACKAGE DOES NOT RETURN ANYTHING, NOR DOES IT FAIL AND THROWS AN ERROR

            * IF A TERMBASE IS PART OF THE FILEBASEDPROJECT

            */

     ProjectPackageCreation package = createdProject.CreateProjectPackage(

                translate.Id,

                "mypackage",

                "A Package CreatedBy WebApi",

                GetPackageOption(!hasProjectTMs(createdProject)));

 

           //IF A TERMBASE WAS PART OF THE FILEBASED PROJECT, THE CODE DOES NOT CONTINUE HERE, AS WE ARE STUCK IN „CreateProjectPackage“ method).

            bool packageIsCreated = false;

            int counter = 0;

            while (!packageIsCreated)

            {

                counter++;

                switch (package.Status)

                {

                    case PackageStatus.Cancelling:

                    case PackageStatus.InProgress:

                    case PackageStatus.Scheduled:

                    case PackageStatus.NotStarted:

                        packageIsCreated = false;

                        break;

                    case PackageStatus.Cancelled:

                    case PackageStatus.Completed:

                    case PackageStatus.Failed:

                    case PackageStatus.Invalid:

                        packageIsCreated = true;

                        break;

                    default:

                        break;

                }

            }

 

            if (package.Status != PackageStatus.Completed)

            {

               // left out this part, it is only error handling

                throw new CreateProjectPackageTradosException($"Status: {package.Status} | Problem during package creation , Message: {messageText}");

            }

 

            return package;

        }

 If we use the filebased project that has been created via the API, open it in a Trados Studio Instance, the TDs is correctly assigned to the project.

Furthermore it is possible to create a project package with a translation task without an issue, the API for some reason doe not create the package.

 Does anyone know whether in Trados Studio 2022 SR1 some specific dependencies changed for handling MultiTerm TDs?

Or what could possibly be the issue here?

 Please let us know if you require further information (e. g. how we add the Termbases to the FileBasedProject, etc.).

 If this is important, please find listed-below some meta data about our setup:

 TMs and TBs in this process are automatically downloaded from a cloud storage but are placed on the local C drive (not a network drive),

prior to starting the process. The paths should therefore be accessible for Trados.

 We use the following system configuration:

  • Trados Studio Version:
    • Trados Studio 2022 SR1 - 17.1.8.17828
  • NET-Framework-Version:
    • Client:  4.8.03761
    • Full:      4.8.03761
    • Client.  4.0.0.0
  • Also the following Plugin is in use which might has an effect here(?):
    • Sdl.Community.SdlDataProtectionSuite

 The app is compiled with VS Build Option ‘Any CPU’ the app is not specifically build only for x86 platforms.

 This applied during the upgrade in order to be compatible with Trados 2022:

  • Dependencies / dlls were updated to Trados 2022 (also any non-Trados related ones).
  • .NET-Framework was updated to  4.8 in App settings
  • Dependency Version Changes in SR1 were also checked

 Thank you in advance for your feedback and any ideas.



Moved to code blocks.
[edited by: Paul at 7:58 AM (GMT 1) on 27 Oct 2023]
Parents
  • Hi Patrick,

     

    thanks for your reply.

    Please find our answers below.

     

    1. Unfortunately, there is no exception at all. We just call the API method mentioned in our post and do not receive a package object as return value (if the file-based project includes a termbase).
      We also see no exception in the Trados Logs themselves (should they even log anything if Trados is automated via API calls and not used via UI/Client App?)
    2. The case is not about a Trados Studio Plugin. It is an external App / Windows Service that uses the Project Automation API of Trados in order to automate processes between an external app and Trados Studio.
      So this is not a plug-able component for Trados and it is executed outside of Trados Studio only using the Trados Studio API.

     

    I hope those answers still help?

    Which other information could we provide in order for you to investigate this issue?

     

    Thank you in advance for your reply.

Reply
  • Hi Patrick,

     

    thanks for your reply.

    Please find our answers below.

     

    1. Unfortunately, there is no exception at all. We just call the API method mentioned in our post and do not receive a package object as return value (if the file-based project includes a termbase).
      We also see no exception in the Trados Logs themselves (should they even log anything if Trados is automated via API calls and not used via UI/Client App?)
    2. The case is not about a Trados Studio Plugin. It is an external App / Windows Service that uses the Project Automation API of Trados in order to automate processes between an external app and Trados Studio.
      So this is not a plug-able component for Trados and it is executed outside of Trados Studio only using the Trados Studio API.

     

    I hope those answers still help?

    Which other information could we provide in order for you to investigate this issue?

     

    Thank you in advance for your reply.

Children
No Data