Error in project creation when performing GetTranslationProviderConfiguration() on 2022

Hello community!

I have an app made to create Studio projects and I'm updating it to 2022 (from 2021).

Sadly I get an error and it would be nice if someone could give me a hint on where to look for this error. I know it seems a parse date error from a non valid string.

I suspect studio 2022 expects me to set some date on the newly created project.

my code (we're inside function "CREA"):

ProjectInfo infoProj = ImpostaProgetto();
FileBasedProject newProject = new FileBasedProject(infoProj);
newProject.Save();

ProjectFile[] myFiles = newProject.AddFolderWithFiles(myParams.SourceFilesFolder, true);
AutomaticTask scanFiles = newProject.RunAutomaticTask(newProject.GetSourceLanguageFiles().GetIds(), AutomaticTaskTemplateIds.Scan);

newProject.Save();

//the following line throws the error!
TranslationProviderConfiguration tmConfig = newProject.GetTranslationProviderConfiguration();
newProject.Credentials.AddCredential(this.serveraddress, "user=" + this.myParams.username + ";password=" + this.myParams.password + ";type=CustomUser");

Function "ImpostaProgetto"

public ProjectInfo ImpostaProgetto()
   //SourceL and TargetL = Language from: new Language(CultureInfo.GetCultureInfo("[string language]"))
   //all other params are strings 
   {
       ProjectInfo info = new ProjectInfo
       {
           Name = this.myParams.nomeProgetto,
           Description = myParams.descrizione,
           LocalProjectFolder = this.myParams.projectFolder,
           SourceLanguage = myParams.sourceL
       };


   Language[] trgLangs = new Language[] { myParams.targetL };
   info.TargetLanguages = trgLangs;
   return info;
   }

The error:

System.ArgumentNullException
  HResult=0x80004003
  Message=String reference not set to an instance of a String.
Parameter name : s
  Source=mscorlib
  StackTrace:
   at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles)
   at Sdl.LanguagePlatform.TranslationMemoryApi.IdentityInfoCacheCredentialStore.ToUserCredentials(TranslationProviderCredential translationProviderCredential)
   at Sdl.LanguagePlatform.TranslationMemoryApi.IdentityInfoCacheCredentialStore.AddCredential(Uri uri, TranslationProviderCredential credential)
   at Sdl.LanguagePlatform.TranslationMemoryApi.TranslationProviderCredentialStore.AddCredential(Uri uri, TranslationProviderCredential credential)
   at Sdl.ProjectAutomation.FileBased.ProjectCredentials.AddCredential(Uri uri, String credential)
   at TK_projectCreator.ProjectCreator.Crea() in C:\Users\enrico\Desktop\progetti\VS2017 AppCreator\TK_projectCreator\TK_projectCreator\MyCustomTradosStudio.cs:line 323
   at TK_projectCreator.Applicazione.Main(String[] args) in C:\Users\enrico\Desktop\progetti\VS2017 AppCreator\TK_projectCreator\TK_projectCreator\MyCustomTradosStudio.cs:line 161

The project seems valid and created correctly:

Screenshot of Trados Studio debug window showing a null reference error for CurrentUser and several other properties within the FileBasedProject class.

I would like to have a hint on where to look to fix this, based on the trace maybe, since I couldn't find any wrong string in my settings.

Trados 2022 - 17.0.0.11594

Visual Studio 2022 17.2.0

Also I get this warning in building:
Referenced assembly 'C:\Program Files (x86)\Trados\Trados Studio\Studio17\Sdl.DesktopEditor.Control.dll' targets a different processor than the application.

but this seems unrelated.

Thank to anyone reading and contributing!

-- Enrico



Generated Image Alt-Text
[edited by: Trados AI at 1:35 PM (GMT 0) on 5 Mar 2024]
emoji
Parents Reply Children
No Data