PluginManager.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665
  1. #nullable enable
  2. using System;
  3. using System.Collections.Generic;
  4. using System.IO;
  5. using System.Linq;
  6. using System.Reflection;
  7. using System.Text;
  8. using System.Text.Json;
  9. using MediaBrowser.Common;
  10. using MediaBrowser.Common.Extensions;
  11. using MediaBrowser.Common.Json;
  12. using MediaBrowser.Common.Json.Converters;
  13. using MediaBrowser.Common.Plugins;
  14. using MediaBrowser.Model.Configuration;
  15. using MediaBrowser.Model.Plugins;
  16. using Microsoft.Extensions.DependencyInjection;
  17. using Microsoft.Extensions.Logging;
  18. namespace Emby.Server.Implementations.Plugins
  19. {
  20. /// <summary>
  21. /// Defines the <see cref="PluginManager" />.
  22. /// </summary>
  23. public class PluginManager : IPluginManager
  24. {
  25. private readonly string _pluginsPath;
  26. private readonly Version _appVersion;
  27. private readonly JsonSerializerOptions _jsonOptions;
  28. private readonly ILogger<PluginManager> _logger;
  29. private readonly IApplicationHost _appHost;
  30. private readonly ServerConfiguration _config;
  31. private readonly IList<LocalPlugin> _plugins;
  32. private readonly Version _minimumVersion;
  33. /// <summary>
  34. /// Initializes a new instance of the <see cref="PluginManager"/> class.
  35. /// </summary>
  36. /// <param name="logger">The <see cref="ILogger"/>.</param>
  37. /// <param name="appHost">The <see cref="IApplicationHost"/>.</param>
  38. /// <param name="config">The <see cref="ServerConfiguration"/>.</param>
  39. /// <param name="pluginsPath">The plugin path.</param>
  40. /// <param name="appVersion">The application version.</param>
  41. public PluginManager(
  42. ILogger<PluginManager> logger,
  43. IApplicationHost appHost,
  44. ServerConfiguration config,
  45. string pluginsPath,
  46. Version appVersion)
  47. {
  48. _logger = logger ?? throw new ArgumentNullException(nameof(logger));
  49. _pluginsPath = pluginsPath;
  50. _appVersion = appVersion ?? throw new ArgumentNullException(nameof(appVersion));
  51. _jsonOptions = JsonDefaults.GetOptions();
  52. _jsonOptions.WriteIndented = true;
  53. // We need to use the default GUID converter, so we need to remove any custom ones.
  54. for (int a = _jsonOptions.Converters.Count - 1; a >= 0; a--)
  55. {
  56. if (_jsonOptions.Converters[a] is JsonGuidConverter convertor)
  57. {
  58. _jsonOptions.Converters.Remove(convertor);
  59. break;
  60. }
  61. }
  62. _config = config;
  63. _appHost = appHost;
  64. _minimumVersion = new Version(0, 0, 0, 1);
  65. _plugins = Directory.Exists(_pluginsPath) ? DiscoverPlugins().ToList() : new List<LocalPlugin>();
  66. }
  67. /// <summary>
  68. /// Gets the Plugins.
  69. /// </summary>
  70. public IList<LocalPlugin> Plugins => _plugins;
  71. /// <summary>
  72. /// Returns all the assemblies.
  73. /// </summary>
  74. /// <returns>An IEnumerable{Assembly}.</returns>
  75. public IEnumerable<Assembly> LoadAssemblies()
  76. {
  77. // Attempt to remove any deleted plugins and change any successors to be active.
  78. for (int a = _plugins.Count - 1; a >= 0; a--)
  79. {
  80. var plugin = _plugins[a];
  81. if (plugin.Manifest.Status == PluginStatus.Deleted && DeletePlugin(plugin))
  82. {
  83. UpdateSuccessors(plugin);
  84. }
  85. }
  86. // Now load the assemblies..
  87. foreach (var plugin in _plugins)
  88. {
  89. UpdatePluginSuperceedStatus(plugin);
  90. if (plugin.IsEnabledAndSupported == false)
  91. {
  92. _logger.LogInformation("Skipping disabled plugin {Version} of {Name} ", plugin.Version, plugin.Name);
  93. continue;
  94. }
  95. foreach (var file in plugin.DllFiles)
  96. {
  97. Assembly assembly;
  98. try
  99. {
  100. assembly = Assembly.LoadFrom(file);
  101. }
  102. catch (FileLoadException ex)
  103. {
  104. _logger.LogError(ex, "Failed to load assembly {Path}. Disabling plugin.", file);
  105. ChangePluginState(plugin, PluginStatus.Malfunctioned);
  106. continue;
  107. }
  108. _logger.LogInformation("Loaded assembly {Assembly} from {Path}", assembly.FullName, file);
  109. yield return assembly;
  110. }
  111. }
  112. }
  113. /// <summary>
  114. /// Creates all the plugin instances.
  115. /// </summary>
  116. public void CreatePlugins()
  117. {
  118. _ = _appHost.GetExports<IPlugin>(CreatePluginInstance)
  119. .Where(i => i != null)
  120. .ToArray();
  121. }
  122. /// <summary>
  123. /// Registers the plugin's services with the DI.
  124. /// Note: DI is not yet instantiated yet.
  125. /// </summary>
  126. /// <param name="serviceCollection">A <see cref="ServiceCollection"/> instance.</param>
  127. public void RegisterServices(IServiceCollection serviceCollection)
  128. {
  129. foreach (var pluginServiceRegistrator in _appHost.GetExportTypes<IPluginServiceRegistrator>())
  130. {
  131. var plugin = GetPluginByAssembly(pluginServiceRegistrator.Assembly);
  132. if (plugin == null)
  133. {
  134. _logger.LogError("Unable to find plugin in assembly {Assembly}", pluginServiceRegistrator.Assembly.FullName);
  135. continue;
  136. }
  137. UpdatePluginSuperceedStatus(plugin);
  138. if (!plugin.IsEnabledAndSupported)
  139. {
  140. continue;
  141. }
  142. try
  143. {
  144. var instance = (IPluginServiceRegistrator?)Activator.CreateInstance(pluginServiceRegistrator);
  145. instance?.RegisterServices(serviceCollection);
  146. }
  147. #pragma warning disable CA1031 // Do not catch general exception types
  148. catch (Exception ex)
  149. #pragma warning restore CA1031 // Do not catch general exception types
  150. {
  151. _logger.LogError(ex, "Error registering plugin services from {Assembly}.", pluginServiceRegistrator.Assembly.FullName);
  152. if (ChangePluginState(plugin, PluginStatus.Malfunctioned))
  153. {
  154. _logger.LogInformation("Disabling plugin {Path}", plugin.Path);
  155. }
  156. }
  157. }
  158. }
  159. /// <summary>
  160. /// Imports a plugin manifest from <paramref name="folder"/>.
  161. /// </summary>
  162. /// <param name="folder">Folder of the plugin.</param>
  163. public void ImportPluginFrom(string folder)
  164. {
  165. if (string.IsNullOrEmpty(folder))
  166. {
  167. throw new ArgumentNullException(nameof(folder));
  168. }
  169. // Load the plugin.
  170. var plugin = LoadManifest(folder);
  171. // Make sure we haven't already loaded this.
  172. if (_plugins.Any(p => p.Manifest.Equals(plugin.Manifest)))
  173. {
  174. return;
  175. }
  176. _plugins.Add(plugin);
  177. EnablePlugin(plugin);
  178. }
  179. /// <summary>
  180. /// Removes the plugin reference '<paramref name="plugin"/>.
  181. /// </summary>
  182. /// <param name="plugin">The plugin.</param>
  183. /// <returns>Outcome of the operation.</returns>
  184. public bool RemovePlugin(LocalPlugin plugin)
  185. {
  186. if (plugin == null)
  187. {
  188. throw new ArgumentNullException(nameof(plugin));
  189. }
  190. if (DeletePlugin(plugin))
  191. {
  192. return true;
  193. }
  194. _logger.LogWarning("Unable to delete {Path}, so marking as deleteOnStartup.", plugin.Path);
  195. // Unable to delete, so disable.
  196. return ChangePluginState(plugin, PluginStatus.Deleted);
  197. }
  198. /// <summary>
  199. /// Attempts to find the plugin with and id of <paramref name="id"/>.
  200. /// </summary>
  201. /// <param name="id">The <see cref="Guid"/> of plugin.</param>
  202. /// <param name="version">Optional <see cref="Version"/> of the plugin to locate.</param>
  203. /// <returns>A <see cref="LocalPlugin"/> if located, or null if not.</returns>
  204. public LocalPlugin? GetPlugin(Guid id, Version? version = null)
  205. {
  206. LocalPlugin? plugin;
  207. if (version == null)
  208. {
  209. // If no version is given, return the current instance.
  210. var plugins = _plugins.Where(p => p.Id.Equals(id));
  211. plugin = plugins.FirstOrDefault(p => p.Instance != null);
  212. if (plugin == null)
  213. {
  214. plugin = plugins.OrderByDescending(p => p.Version).FirstOrDefault();
  215. }
  216. }
  217. else
  218. {
  219. // Match id and version number.
  220. plugin = _plugins.FirstOrDefault(p => p.Id.Equals(id) && p.Version.Equals(version));
  221. }
  222. return plugin;
  223. }
  224. /// <summary>
  225. /// Enables the plugin, disabling all other versions.
  226. /// </summary>
  227. /// <param name="plugin">The <see cref="LocalPlugin"/> of the plug to disable.</param>
  228. public void EnablePlugin(LocalPlugin plugin)
  229. {
  230. if (plugin == null)
  231. {
  232. throw new ArgumentNullException(nameof(plugin));
  233. }
  234. if (ChangePluginState(plugin, PluginStatus.Active))
  235. {
  236. UpdateSuccessors(plugin);
  237. }
  238. }
  239. /// <summary>
  240. /// Disable the plugin.
  241. /// </summary>
  242. /// <param name="plugin">The <see cref="LocalPlugin"/> of the plug to disable.</param>
  243. public void DisablePlugin(LocalPlugin plugin)
  244. {
  245. if (plugin == null)
  246. {
  247. throw new ArgumentNullException(nameof(plugin));
  248. }
  249. // Update the manifest on disk
  250. if (ChangePluginState(plugin, PluginStatus.Disabled))
  251. {
  252. UpdateSuccessors(plugin);
  253. }
  254. }
  255. /// <summary>
  256. /// Disable the plugin.
  257. /// </summary>
  258. /// <param name="assembly">The <see cref="Assembly"/> of the plug to disable.</param>
  259. public void FailPlugin(Assembly assembly)
  260. {
  261. // Only save if disabled.
  262. if (assembly == null)
  263. {
  264. throw new ArgumentNullException(nameof(assembly));
  265. }
  266. var plugin = _plugins.FirstOrDefault(p => p.DllFiles.Contains(assembly.Location));
  267. if (plugin == null)
  268. {
  269. // A plugin's assembly didn't cause this issue, so ignore it.
  270. return;
  271. }
  272. ChangePluginState(plugin, PluginStatus.Malfunctioned);
  273. }
  274. /// <summary>
  275. /// Saves the manifest back to disk.
  276. /// </summary>
  277. /// <param name="manifest">The <see cref="PluginManifest"/> to save.</param>
  278. /// <param name="path">The path where to save the manifest.</param>
  279. /// <returns>True if successful.</returns>
  280. public bool SaveManifest(PluginManifest manifest, string path)
  281. {
  282. if (manifest == null)
  283. {
  284. return false;
  285. }
  286. try
  287. {
  288. var data = JsonSerializer.Serialize(manifest, _jsonOptions);
  289. File.WriteAllText(Path.Combine(path, "meta.json"), data, Encoding.UTF8);
  290. return true;
  291. }
  292. #pragma warning disable CA1031 // Do not catch general exception types
  293. catch (Exception e)
  294. #pragma warning restore CA1031 // Do not catch general exception types
  295. {
  296. _logger.LogWarning(e, "Unable to save plugin manifest. {Path}", path);
  297. return false;
  298. }
  299. }
  300. /// <summary>
  301. /// Changes a plugin's load status.
  302. /// </summary>
  303. /// <param name="plugin">The <see cref="LocalPlugin"/> instance.</param>
  304. /// <param name="state">The <see cref="PluginStatus"/> of the plugin.</param>
  305. /// <returns>Success of the task.</returns>
  306. private bool ChangePluginState(LocalPlugin plugin, PluginStatus state)
  307. {
  308. if (plugin.Manifest.Status == state || string.IsNullOrEmpty(plugin.Path))
  309. {
  310. // No need to save as the state hasn't changed.
  311. return true;
  312. }
  313. plugin.Manifest.Status = state;
  314. return SaveManifest(plugin.Manifest, plugin.Path);
  315. }
  316. /// <summary>
  317. /// Finds the plugin record using the assembly.
  318. /// </summary>
  319. /// <param name="assembly">The <see cref="Assembly"/> being sought.</param>
  320. /// <returns>The matching record, or null if not found.</returns>
  321. private LocalPlugin? GetPluginByAssembly(Assembly assembly)
  322. {
  323. // Find which plugin it is by the path.
  324. return _plugins.FirstOrDefault(p => string.Equals(p.Path, Path.GetDirectoryName(assembly.Location), StringComparison.Ordinal));
  325. }
  326. /// <summary>
  327. /// Creates the instance safe.
  328. /// </summary>
  329. /// <param name="type">The type.</param>
  330. /// <returns>System.Object.</returns>
  331. private IPlugin? CreatePluginInstance(Type type)
  332. {
  333. // Find the record for this plugin.
  334. var plugin = GetPluginByAssembly(type.Assembly);
  335. if (plugin?.Manifest.Status < PluginStatus.Active)
  336. {
  337. return null;
  338. }
  339. try
  340. {
  341. _logger.LogDebug("Creating instance of {Type}", type);
  342. var instance = (IPlugin)ActivatorUtilities.CreateInstance(_appHost.ServiceProvider, type);
  343. if (plugin == null)
  344. {
  345. // Create a dummy record for the providers.
  346. // TODO: remove this code, if all provided have been released as separate plugins.
  347. plugin = new LocalPlugin(
  348. instance.AssemblyFilePath,
  349. true,
  350. new PluginManifest
  351. {
  352. Id = instance.Id,
  353. Status = PluginStatus.Active,
  354. Name = instance.Name,
  355. Version = instance.Version.ToString()
  356. })
  357. {
  358. Instance = instance
  359. };
  360. _plugins.Add(plugin);
  361. plugin.Manifest.Status = PluginStatus.Active;
  362. }
  363. else
  364. {
  365. plugin.Instance = instance;
  366. var manifest = plugin.Manifest;
  367. var pluginStr = plugin.Instance.Version.ToString();
  368. bool changed = false;
  369. if (string.Equals(manifest.Version, pluginStr, StringComparison.Ordinal))
  370. {
  371. // If a plugin without a manifest failed to load due to an external issue (eg config),
  372. // this updates the manifest to the actual plugin values.
  373. manifest.Version = pluginStr;
  374. manifest.Name = plugin.Instance.Name;
  375. manifest.Description = plugin.Instance.Description;
  376. changed = true;
  377. }
  378. changed = changed || manifest.Status != PluginStatus.Active;
  379. manifest.Status = PluginStatus.Active;
  380. if (changed)
  381. {
  382. SaveManifest(manifest, plugin.Path);
  383. }
  384. }
  385. _logger.LogInformation("Loaded plugin: {PluginName} {PluginVersion}", plugin.Name, plugin.Version);
  386. return instance;
  387. }
  388. #pragma warning disable CA1031 // Do not catch general exception types
  389. catch (Exception ex)
  390. #pragma warning restore CA1031 // Do not catch general exception types
  391. {
  392. _logger.LogError(ex, "Error creating {Type}", type.FullName);
  393. if (plugin != null)
  394. {
  395. if (ChangePluginState(plugin, PluginStatus.Malfunctioned))
  396. {
  397. _logger.LogInformation("Plugin {Path} has been disabled.", plugin.Path);
  398. return null;
  399. }
  400. }
  401. _logger.LogDebug("Unable to auto-disable.");
  402. return null;
  403. }
  404. }
  405. private void UpdatePluginSuperceedStatus(LocalPlugin plugin)
  406. {
  407. if (plugin.Manifest.Status != PluginStatus.Superceded)
  408. {
  409. return;
  410. }
  411. var predecessor = _plugins.OrderByDescending(p => p.Version)
  412. .FirstOrDefault(p => p.Id.Equals(plugin.Id) && p.IsEnabledAndSupported && p.Version != plugin.Version);
  413. if (predecessor != null)
  414. {
  415. return;
  416. }
  417. plugin.Manifest.Status = PluginStatus.Active;
  418. }
  419. /// <summary>
  420. /// Attempts to delete a plugin.
  421. /// </summary>
  422. /// <param name="plugin">A <see cref="LocalPlugin"/> instance to delete.</param>
  423. /// <returns>True if successful.</returns>
  424. private bool DeletePlugin(LocalPlugin plugin)
  425. {
  426. // Attempt a cleanup of old folders.
  427. try
  428. {
  429. Directory.Delete(plugin.Path, true);
  430. _logger.LogDebug("Deleted {Path}", plugin.Path);
  431. }
  432. #pragma warning disable CA1031 // Do not catch general exception types
  433. catch
  434. #pragma warning restore CA1031 // Do not catch general exception types
  435. {
  436. return false;
  437. }
  438. return _plugins.Remove(plugin);
  439. }
  440. private LocalPlugin LoadManifest(string dir)
  441. {
  442. Version? version;
  443. PluginManifest? manifest = null;
  444. var metafile = Path.Combine(dir, "meta.json");
  445. if (File.Exists(metafile))
  446. {
  447. try
  448. {
  449. var data = File.ReadAllText(metafile, Encoding.UTF8);
  450. manifest = JsonSerializer.Deserialize<PluginManifest>(data, _jsonOptions);
  451. }
  452. #pragma warning disable CA1031 // Do not catch general exception types
  453. catch (Exception ex)
  454. #pragma warning restore CA1031 // Do not catch general exception types
  455. {
  456. _logger.LogError(ex, "Error deserializing {Path}.", dir);
  457. }
  458. }
  459. if (manifest != null)
  460. {
  461. if (!Version.TryParse(manifest.TargetAbi, out var targetAbi))
  462. {
  463. targetAbi = _minimumVersion;
  464. }
  465. if (!Version.TryParse(manifest.Version, out version))
  466. {
  467. manifest.Version = _minimumVersion.ToString();
  468. }
  469. return new LocalPlugin(dir, _appVersion >= targetAbi, manifest);
  470. }
  471. // No metafile, so lets see if the folder is versioned.
  472. // TODO: Phase this support out in future versions.
  473. metafile = dir.Split(Path.DirectorySeparatorChar, StringSplitOptions.RemoveEmptyEntries)[^1];
  474. int versionIndex = dir.LastIndexOf('_');
  475. if (versionIndex != -1)
  476. {
  477. // Get the version number from the filename if possible.
  478. metafile = Path.GetFileName(dir[..versionIndex]) ?? dir[..versionIndex];
  479. version = Version.TryParse(dir.AsSpan()[(versionIndex + 1)..], out Version? parsedVersion) ? parsedVersion : _appVersion;
  480. }
  481. else
  482. {
  483. // Un-versioned folder - Add it under the path name and version it suitable for this instance.
  484. version = _appVersion;
  485. }
  486. // Auto-create a plugin manifest, so we can disable it, if it fails to load.
  487. manifest = new PluginManifest
  488. {
  489. Status = PluginStatus.Restart,
  490. Name = metafile,
  491. AutoUpdate = false,
  492. Id = metafile.GetMD5(),
  493. TargetAbi = _appVersion.ToString(),
  494. Version = version.ToString()
  495. };
  496. return new LocalPlugin(dir, true, manifest);
  497. }
  498. /// <summary>
  499. /// Gets the list of local plugins.
  500. /// </summary>
  501. /// <returns>Enumerable of local plugins.</returns>
  502. private IEnumerable<LocalPlugin> DiscoverPlugins()
  503. {
  504. var versions = new List<LocalPlugin>();
  505. if (!Directory.Exists(_pluginsPath))
  506. {
  507. // Plugin path doesn't exist, don't try to enumerate sub-folders.
  508. return Enumerable.Empty<LocalPlugin>();
  509. }
  510. var directories = Directory.EnumerateDirectories(_pluginsPath, "*.*", SearchOption.TopDirectoryOnly);
  511. foreach (var dir in directories)
  512. {
  513. versions.Add(LoadManifest(dir));
  514. }
  515. string lastName = string.Empty;
  516. versions.Sort(LocalPlugin.Compare);
  517. // Traverse backwards through the list.
  518. // The first item will be the latest version.
  519. for (int x = versions.Count - 1; x >= 0; x--)
  520. {
  521. var entry = versions[x];
  522. if (!string.Equals(lastName, entry.Name, StringComparison.OrdinalIgnoreCase))
  523. {
  524. entry.DllFiles.AddRange(Directory.EnumerateFiles(entry.Path, "*.dll", SearchOption.AllDirectories));
  525. if (entry.IsEnabledAndSupported)
  526. {
  527. lastName = entry.Name;
  528. continue;
  529. }
  530. }
  531. if (string.IsNullOrEmpty(lastName))
  532. {
  533. continue;
  534. }
  535. var manifest = entry.Manifest;
  536. var cleaned = false;
  537. var path = entry.Path;
  538. if (_config.RemoveOldPlugins)
  539. {
  540. // Attempt a cleanup of old folders.
  541. try
  542. {
  543. _logger.LogDebug("Deleting {Path}", path);
  544. Directory.Delete(path, true);
  545. cleaned = true;
  546. }
  547. #pragma warning disable CA1031 // Do not catch general exception types
  548. catch (Exception e)
  549. #pragma warning restore CA1031 // Do not catch general exception types
  550. {
  551. _logger.LogWarning(e, "Unable to delete {Path}", path);
  552. }
  553. if (cleaned)
  554. {
  555. versions.RemoveAt(x);
  556. }
  557. else
  558. {
  559. if (manifest == null)
  560. {
  561. _logger.LogWarning("Unable to disable plugin {Path}", entry.Path);
  562. continue;
  563. }
  564. ChangePluginState(entry, PluginStatus.Deleted);
  565. }
  566. }
  567. }
  568. // Only want plugin folders which have files.
  569. return versions.Where(p => p.DllFiles.Count != 0);
  570. }
  571. /// <summary>
  572. /// Changes the status of the other versions of the plugin to "Superceded".
  573. /// </summary>
  574. /// <param name="plugin">The <see cref="LocalPlugin"/> that's master.</param>
  575. private void UpdateSuccessors(LocalPlugin plugin)
  576. {
  577. // This value is memory only - so that the web will show restart required.
  578. plugin.Manifest.Status = PluginStatus.Restart;
  579. // Detect whether there is another version of this plugin that needs disabling.
  580. var predecessor = _plugins.OrderByDescending(p => p.Version)
  581. .FirstOrDefault(
  582. p => p.Id.Equals(plugin.Id)
  583. && p.IsEnabledAndSupported
  584. && p.Version != plugin.Version);
  585. if (predecessor == null)
  586. {
  587. return;
  588. }
  589. if (predecessor.Manifest.Status == PluginStatus.Active && !ChangePluginState(predecessor, PluginStatus.Superceded))
  590. {
  591. _logger.LogError("Unable to disable version {Version} of {Name}", predecessor.Version, predecessor.Name);
  592. }
  593. }
  594. }
  595. }