From 14d43e6d6b7a172d735cd1a866385b6a3437e11e Mon Sep 17 00:00:00 2001 From: ta264 Date: Sun, 24 Jan 2021 21:59:29 +0000 Subject: [PATCH] Fixed: Built-in updater for mono version The change to set ExecutingApplication in 26a04c9fd broke mono - it returned the location of the mono executable and not radarr. It seems that there was a change in behaviour in net5.0 which means we can no longer use the same code in both cases. --- src/NzbDrone.Common/EnvironmentInfo/RuntimeInfo.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Common/EnvironmentInfo/RuntimeInfo.cs b/src/NzbDrone.Common/EnvironmentInfo/RuntimeInfo.cs index 56ace4165..5be00f9f3 100644 --- a/src/NzbDrone.Common/EnvironmentInfo/RuntimeInfo.cs +++ b/src/NzbDrone.Common/EnvironmentInfo/RuntimeInfo.cs @@ -23,7 +23,10 @@ namespace NzbDrone.Common.EnvironmentInfo serviceProvider.ServiceExist(ServiceProvider.SERVICE_NAME) && serviceProvider.GetStatus(ServiceProvider.SERVICE_NAME) == ServiceControllerStatus.StartPending; - //Guarded to avoid issues when running in a non-managed process +#if NETCOREAPP + // net5.0 will return Radarr.dll for entry assembly, we need the actual + // executable name (Radarr on linux). On mono this will return the location of + // the mono executable itself, which is not what we want. var entry = Process.GetCurrentProcess().MainModule; if (entry != null) @@ -31,6 +34,12 @@ namespace NzbDrone.Common.EnvironmentInfo ExecutingApplication = entry.FileName; IsWindowsTray = OsInfo.IsWindows && entry.ModuleName == $"{ProcessProvider.RADARR_PROCESS_NAME}.exe"; } +#else + // On mono we need to get the location of the Radarr assembly, not Mono. + // Can't be running tray app in mono. + ExecutingApplication = Assembly.GetEntryAssembly()?.Location; +#endif + } static RuntimeInfo()