internal void AddProvider(string workerDir)
        {
            try
            {
                Dictionary <string, WorkerDescription> descriptionProfiles = new Dictionary <string, WorkerDescription>();
                string workerConfigPath = Path.Combine(workerDir, LanguageWorkerConstants.WorkerConfigFileName);
                if (!File.Exists(workerConfigPath))
                {
                    _logger.LogDebug($"Did not find worker config file at: {workerConfigPath}");
                    return;
                }
                _logger.LogDebug($"Found worker config: {workerConfigPath}");
                string            json              = File.ReadAllText(workerConfigPath);
                JObject           workerConfig      = JObject.Parse(json);
                WorkerDescription workerDescription = workerConfig.Property(LanguageWorkerConstants.WorkerDescription).Value.ToObject <WorkerDescription>();
                workerDescription.WorkerDirectory = workerDir;
                var languageSection = _config.GetSection($"{LanguageWorkerConstants.LanguageWorkersSectionName}:{workerDescription.Language}");
                workerDescription.Arguments = workerDescription.Arguments ?? new List <string>();

                descriptionProfiles = GetWorkerDescriptionProfiles(workerConfig);
                if (ScriptSettingsManager.Instance.IsAppServiceEnvironment)
                {
                    // Overwrite default Description with AppServiceEnv profile
                    // TODO:pgopa delete after ANT78
                    workerDescription = GetWorkerDescriptionFromProfiles(LanguageWorkerConstants.WorkerDescriptionAppServiceEnvProfileName, descriptionProfiles, workerDescription);
                }

                GetDefaultExecutablePathFromAppSettings(workerDescription, languageSection);
                AddArgumentsFromAppSettings(workerDescription, languageSection);

                string workerPath = workerDescription.GetWorkerPath();
                if (string.IsNullOrEmpty(workerPath) || File.Exists(workerPath))
                {
                    _logger.LogDebug($"Will load worker provider for language: {workerDescription.Language}");
                    workerDescription.Validate();
                    _workerProviderDictionary[workerDescription.Language] = new GenericWorkerProvider(workerDescription, workerDir);
                }
                else
                {
                    throw new FileNotFoundException($"Did not find worker for for language: {workerDescription.Language}", workerPath);
                }
            }
            catch (Exception ex)
            {
                _logger?.LogError(ex, $"Failed to initialize worker provider for: {workerDir}");
            }
        }
 internal void AddProvider(string workerDir, ILogger logger)
 {
     try
     {
         string workerConfigPath = Path.Combine(workerDir, LanguageWorkerConstants.WorkerConfigFileName);
         if (!File.Exists(workerConfigPath))
         {
             logger.LogTrace($"Did not find worker config file at: {workerConfigPath}");
             return;
         }
         logger.LogTrace($"Found worker config: {workerConfigPath}");
         string            json              = File.ReadAllText(workerConfigPath);
         JObject           workerConfig      = JObject.Parse(json);
         WorkerDescription workerDescription = workerConfig.Property(LanguageWorkerConstants.WorkerDescription).Value.ToObject <WorkerDescription>();
         workerDescription.WorkerDirectory = workerDir;
         var languageSection = _config.GetSection($"{LanguageWorkerConstants.LanguageWorkersSectionName}:{workerDescription.Language}");
         workerDescription.Arguments = workerDescription.Arguments ?? new List <string>();
         var argumentsSection = languageSection.GetSection($"{LanguageWorkerConstants.WorkerDescriptionArguments}");
         if (argumentsSection.Value != null)
         {
             workerDescription.Arguments.AddRange(Regex.Split(argumentsSection.Value, @"\s+"));
         }
         if (File.Exists(workerDescription.GetWorkerPath()))
         {
             logger.LogTrace($"Will load worker provider for language: {workerDescription.Language}");
             _workerProviderDictionary[workerDescription.Language] = new GenericWorkerProvider(workerDescription, workerDir);
         }
         else
         {
             throw new FileNotFoundException($"Did not find worker for for language: {workerDescription.Language}", workerDescription.GetWorkerPath());
         }
     }
     catch (Exception ex)
     {
         logger?.LogError(ex, $"Failed to initialize worker provider for: {workerDir}");
     }
 }