internal static IReadOnlyCollection <IOTelExtension> TryLoadPlugins(JsonConfigurationSource pluginsConfig) { if (pluginsConfig == null) { return(ArrayHelper.Empty <IOTelExtension>()); } var targetFramework = FrameworkDescription.Instance.TargetFramework; Log.Debug("Executing plugins configuration: {0}", pluginsConfig); Log.Information("Trying to load plugins with target framework '{0}'.", targetFramework); string[] pluginFiles; try { // TODO: Here additional metadata could be loaded (eg: for security and integrity) // instead of just string path pluginFiles = pluginsConfig.GetValue <JToken>($"['{targetFramework}']").ToObject <string[]>(); } catch (ArgumentException ex) { Log.Warning(ex, "Could not parse list of plugin paths. Invalid plugin configuration provided."); return(ArrayHelper.Empty <IOTelExtension>()); } if (pluginFiles == null || !pluginFiles.Any()) { Log.Information("Skipping plugins load. Could not find any plugins with target framework '{0}'.", targetFramework); return(ArrayHelper.Empty <IOTelExtension>()); } var loadedPlugins = TryLoadPlugins(pluginFiles); Log.Information("Successfully loaded '{0}' plugin(s).", property: loadedPlugins.Count); return(loadedPlugins); }