diff --git a/backend/src/Squidex.Infrastructure/Translations/ResourcesLocalizer.cs b/backend/src/Squidex.Infrastructure/Translations/ResourcesLocalizer.cs index 9950f7028..e4503a47f 100644 --- a/backend/src/Squidex.Infrastructure/Translations/ResourcesLocalizer.cs +++ b/backend/src/Squidex.Infrastructure/Translations/ResourcesLocalizer.cs @@ -28,15 +28,26 @@ namespace Squidex.Infrastructure.Translations this.resourceManager = resourceManager; #if DEBUG - if (File.Exists(MissingFileName)) - { - var missing = File.ReadAllLines(MissingFileName); + missingTranslations = new HashSet(); - missingTranslations = new HashSet(missing); - } - else + for (var i = 0; i < 3; i++) { - missingTranslations = new HashSet(); + lock (LockObject) + { + try + { + if (File.Exists(MissingFileName)) + { + var missing = File.ReadAllLines(MissingFileName); + + missingTranslations = new HashSet(missing); + } + } + catch (IOException) + { + continue; + } + } } #endif } @@ -171,11 +182,21 @@ namespace Squidex.Infrastructure.Translations if (translation == null) { #if DEBUG - lock (LockObject) + for (var i = 0; i < 3; i++) { - if (!missingTranslations.Add(key)) + lock (LockObject) { - File.AppendAllLines(MissingFileName, new[] { key }); + try + { + if (!missingTranslations.Add(key)) + { + File.AppendAllLines(MissingFileName, new[] { key }); + } + } + catch (IOException) + { + continue; + } } } #endif