TradosTM Anonymizer gives an error message ("Error querying translation_memories! String was not recognized as a valid DateTime.") when loading a TM into memory

Hello,

A client of ours would like to have sensitive data removed from their TM between translation jobs, so I tried out Trados Data Protection Suite plugin to anonymize a TM in Studio versions 2024, 2022 SR2 CU11 and 2021 SR2 CU12, but got an error when trying to load the TM by clicking on the Load checkbox in the TradosTM Anonymizer UI.

To get a better glimpse of the error, I cloned the Sdl-Community GitHub repo, built the SdlDataProtectionStuite plugin with minor changes and used Visual Studio's Attach to Process to get a proper error stack:

System.Exception
  HResult=0x80131500
  Message=Error querying translation_memories!  String was not recognized as a valid DateTime.
  Source=Sdl.Community.SdlDataProtectionSuite
  StackTrace:
   at Sdl.Community.SdlDataProtectionSuite.SdlTmAnonymizer.Services.SqliteTmService.GeTranslationMemories() in C:\Git\Sdl-Community\SDLDataProtectionSuite\SDLDataProtectionSuite\SdlTmAnonymizer\Services\SqliteTMService.cs:line 86
   at Sdl.Community.SdlDataProtectionSuite.SdlTmAnonymizer.Services.TmService.GetTranslationUnitsFromLocalTm(ProgressDialogContext context, TmFile tmFile) in C:\Git\Sdl-Community\SDLDataProtectionSuite\SDLDataProtectionSuite\SdlTmAnonymizer\Services\TmService.cs:line 797
   at Sdl.Community.SdlDataProtectionSuite.SdlTmAnonymizer.Services.TmService.LoadTranslationUnits(ProgressDialogContext context, TmFile tmFile, TranslationProviderServer translationProvider, LanguageDirection providerLanguageDirection) in C:\Git\Sdl-Community\SDLDataProtectionSuite\SDLDataProtectionSuite\SdlTmAnonymizer\Services\TmService.cs:line 73
   at Sdl.Community.SdlDataProtectionSuite.SdlTmAnonymizer.Services.SystemFieldsService.GetUniqueFileBasedSystemFields(ProgressDialogContext context, TmFile tm) in C:\Git\Sdl-Community\SDLDataProtectionSuite\SDLDataProtectionSuite\SdlTmAnonymizer\Services\SystemFieldsService.cs:line 29
   at Sdl.Community.SdlDataProtectionSuite.SdlTmAnonymizer.ViewModel.SystemFieldsViewModel.<>c__DisplayClass37_0.<SelectTm>b__0() in C:\Git\Sdl-Community\SDLDataProtectionSuite\SDLDataProtectionSuite\SdlTmAnonymizer\ViewModel\SystemFieldsViewModel.cs:line 162
   at Sdl.Community.SdlDataProtectionSuite.SdlTmAnonymizer.Controls.ProgressDialog.ProgressDialog.<>c__DisplayClass19_0.<Execute>b__0(Object s, DoWorkEventArgs e) in C:\Git\Sdl-Community\SDLDataProtectionSuite\SDLDataProtectionSuite\SdlTmAnonymizer\Controls\ProgressDialog\ProgressDialog.xaml.cs:line 132
   at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)
   at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)

Apparently the SqLiteConnection class uses a default date format which is not compatible with our TMs which use local culture information (Finnish). It was sufficient to adjust the connection string in Sdl.Community.SdlDataProtectionSuite\SdlTmAnonymizer\Services\SqliteTMService.cs, lines 771-779 so that it now uses the system current culture as a parameter. Maybe not a fix for all cases, but seems to work in our environment.

private static string GetConnectionString(string databasePath, string password)
{
	if (!string.IsNullOrEmpty(password))
	{
		return "Data Source=\"" + databasePath + "\";Version=3;New=False;DateTimeFormat=CurrentCulture;Password" + password;
	}

	return "Data Source=\"" + databasePath + "\";Version=3;New=False;DateTimeFormat=CurrentCulture";
}

The project file still had some references to Studio 2024 Beta and there were a few conflicts with reference assemblies, so if you could review the code and maybe fix some remaining issues with .dll conflicts etc and publish a working version of the plugin at your convenience, I'd be grateful. If it's more convenient, I can also post the same information to the Sdl-Community GitHub site.

Best,
Mikko