diff --git a/src/NzbDrone.Common/EnvironmentInfo/RuntimeInfo.cs b/src/NzbDrone.Common/EnvironmentInfo/RuntimeInfo.cs index 0dc395c0a..5f6eff146 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.PROWLARR_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() diff --git a/src/NzbDrone.Host/Bootstrap.cs b/src/NzbDrone.Host/Bootstrap.cs index a5892d1b4..ce7bddd66 100644 --- a/src/NzbDrone.Host/Bootstrap.cs +++ b/src/NzbDrone.Host/Bootstrap.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using System.Reflection; using System.Text; using System.Threading; @@ -22,7 +23,13 @@ namespace Prowlarr.Host { try { - Logger.Info("Starting Prowlarr - {0} - Version {1}", Assembly.GetCallingAssembly().Location, Assembly.GetExecutingAssembly().GetName().Version); + Logger.Info("Starting Prowlarr - {0} - Version {1}", +#if NETCOREAPP + Process.GetCurrentProcess().MainModule.FileName, +#else + Assembly.GetCallingAssembly().Location, +#endif + Assembly.GetExecutingAssembly().GetName().Version); if (!PlatformValidation.IsValidate(userAlert)) {