diff --git a/azure-pipelines.yml b/azure-pipelines.yml index c8ce15467..d8277ea50 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -115,10 +115,6 @@ stages: artifact: WindowsCoreTests displayName: Publish Windows Test Package condition: and(succeeded(), eq(variables['osName'], 'Windows')) - - publish: '$(testsFolder)/net462/linux-x64/publish' - artifact: LinuxTests - displayName: Publish Linux Mono Test Package - condition: and(succeeded(), eq(variables['osName'], 'Windows')) - publish: '$(testsFolder)/net5.0/linux-x64/publish' artifact: LinuxCoreTests displayName: Publish Linux Test Package @@ -278,14 +274,6 @@ stages: tarCompression: 'gz' includeRootFolder: false rootFolderOrFile: $(artifactsFolder)/macos/net5.0 - - task: ArchiveFiles@2 - displayName: Create Linux Mono tar - inputs: - archiveFile: '$(Build.ArtifactStagingDirectory)/Lidarr.$(buildName).linux.tar.gz' - archiveType: 'tar' - tarCompression: 'gz' - includeRootFolder: false - rootFolderOrFile: $(artifactsFolder)/linux-x64/net462 - task: ArchiveFiles@2 displayName: Create Linux Core tar inputs: @@ -433,16 +421,10 @@ stages: - powershell: Set-Service SCardSvr -StartupType Manual displayName: Enable Windows Test Service condition: and(succeeded(), eq(variables['osName'], 'Windows')) - - bash: | - wget https://github.com/acoustid/chromaprint/releases/download/v1.4.3/chromaprint-fpcalc-1.4.3-linux-x86_64.tar.gz - sudo tar xf chromaprint-fpcalc-1.4.3-linux-x86_64.tar.gz --strip-components=1 --directory /usr/bin - chmod a+x _tests/fpcalc - displayName: Install fpcalc - condition: and(succeeded(), eq(variables['testName'], 'LinuxCore')) - bash: | chmod a+x _tests/fpcalc displayName: Make fpcalc Executable - condition: and(succeeded(), eq(variables['osName'], 'Mac')) + condition: and(succeeded(), or(eq(variables['osName'], 'Mac'), eq(variables['testName'], 'LinuxCore'))) - bash: find ${TESTSFOLDER} -name "Lidarr.Test.Dummy" -exec chmod a+x {} \; displayName: Make Test Dummy Executable condition: and(succeeded(), ne(variables['osName'], 'Windows')) @@ -466,18 +448,6 @@ stages: condition: and(succeeded(), eq(dependencies.Prepare.outputs['setVar.backendNotUpdated'], '0')) strategy: matrix: - mono520: - testName: 'Mono 5.20' - artifactName: LinuxTests - containerImage: ghcr.io/servarr/testimages:mono-5.20 - mono610: - testName: 'Mono 6.10' - artifactName: LinuxTests - containerImage: ghcr.io/servarr/testimages:mono-6.10 - mono612: - testName: 'Mono 6.12' - artifactName: LinuxTests - containerImage: ghcr.io/servarr/testimages:mono-6.12 alpine: testName: 'Musl Net Core' artifactName: LinuxMuslCoreTests @@ -652,21 +622,6 @@ stages: condition: and(succeeded(), eq(dependencies.Prepare.outputs['setVar.backendNotUpdated'], '0')) strategy: matrix: - mono520: - testName: 'Mono 5.20' - artifactName: LinuxTests - containerImage: ghcr.io/servarr/testimages:mono-5.20 - pattern: 'Lidarr.*.linux.tar.gz' - mono610: - testName: 'Mono 6.10' - artifactName: LinuxTests - containerImage: ghcr.io/servarr/testimages:mono-6.10 - pattern: 'Lidarr.*.linux.tar.gz' - mono612: - testName: 'Mono 6.12' - artifactName: LinuxTests - containerImage: ghcr.io/servarr/testimages:mono-6.12 - pattern: 'Lidarr.*.linux.tar.gz' alpine: testName: 'Musl Net Core' artifactName: LinuxMuslCoreTests diff --git a/build.sh b/build.sh index 7a6950a81..b19b65c93 100755 --- a/build.sh +++ b/build.sh @@ -150,11 +150,6 @@ PackageMacOS() PackageFiles "$folder" "$framework" "osx-x64" - if [ "$framework" = "net462" ]; then - echo "Adding Startup script" - cp macOS/Lidarr $folder - fi - echo "Removing Service helpers" rm -f $folder/ServiceUninstall.* rm -f $folder/ServiceInstall.* @@ -339,7 +334,6 @@ then PackageTests "net5.0" "linux-x64" PackageTests "net5.0" "linux-musl-x64" PackageTests "net5.0" "osx-x64" - PackageTests "net462" "linux-x64" if [ "$ENABLE_BSD" = "YES" ]; then PackageTests "net5.0" "freebsd-x64" @@ -379,7 +373,6 @@ then Package "net5.0" "linux-musl-arm64" Package "net5.0" "linux-arm" Package "net5.0" "osx-x64" - Package "net462" "linux-x64" if [ "$ENABLE_BSD" = "YES" ]; then Package "net5.0" "freebsd-x64" diff --git a/src/Directory.Build.props b/src/Directory.Build.props index ac2aa5127..b5fa98a9e 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -6,7 +6,6 @@ AnyCPU true win-x64;win-x86;osx-x64;linux-x64;linux-musl-x64;linux-arm;linux-arm64;linux-musl-arm64 - win-x64:net462;win-x86:net462;osx-x64:net462;linux-arm:net462;linux-arm64:net462;linux-musl-x64:net462;linux-musl-arm64:net462 $(MSBuildThisFileDirectory)..\ @@ -88,22 +87,12 @@ $(MSBuildProjectName.Replace('Lidarr','NzbDrone')) - - - - all - runtime; build; native; contentfiles; analyzers - - - - - diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index e8efeb5ec..4cf15bc72 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -1,11 +1,4 @@ - - - full - - - - diff --git a/src/Libraries/Mono/System.Diagnostics.Tracing.dll b/src/Libraries/Mono/System.Diagnostics.Tracing.dll deleted file mode 100644 index 3c7819569..000000000 Binary files a/src/Libraries/Mono/System.Diagnostics.Tracing.dll and /dev/null differ diff --git a/src/Libraries/Mono/System.Globalization.Extensions.dll b/src/Libraries/Mono/System.Globalization.Extensions.dll deleted file mode 100644 index 8c0861579..000000000 Binary files a/src/Libraries/Mono/System.Globalization.Extensions.dll and /dev/null differ diff --git a/src/Libraries/Mono/System.Numerics.Vectors.dll b/src/Libraries/Mono/System.Numerics.Vectors.dll deleted file mode 100755 index 10205772c..000000000 Binary files a/src/Libraries/Mono/System.Numerics.Vectors.dll and /dev/null differ diff --git a/src/Libraries/Mono/System.Runtime.InteropServices.RuntimeInformation.dll b/src/Libraries/Mono/System.Runtime.InteropServices.RuntimeInformation.dll deleted file mode 100644 index e55b5eb23..000000000 Binary files a/src/Libraries/Mono/System.Runtime.InteropServices.RuntimeInformation.dll and /dev/null differ diff --git a/src/Libraries/Mono/System.Text.Encoding.CodePages.dll b/src/Libraries/Mono/System.Text.Encoding.CodePages.dll deleted file mode 100644 index 414770bc0..000000000 Binary files a/src/Libraries/Mono/System.Text.Encoding.CodePages.dll and /dev/null differ diff --git a/src/Libraries/Mono/System.Threading.Overlapped.dll b/src/Libraries/Mono/System.Threading.Overlapped.dll deleted file mode 100644 index c06475843..000000000 Binary files a/src/Libraries/Mono/System.Threading.Overlapped.dll and /dev/null differ diff --git a/src/Libraries/Mono/readme.txt b/src/Libraries/Mono/readme.txt deleted file mode 100644 index f1251a98f..000000000 --- a/src/Libraries/Mono/readme.txt +++ /dev/null @@ -1,3 +0,0 @@ -Copied from mono/4.5/Facades of the mono 5.4 release. -These are the mono version of the dotnet Core TypeForwardedTo assemblies. -Using these assemblies is no longer necessary once we reach mono 5.18 as minimum version \ No newline at end of file diff --git a/src/Lidarr.Api.V1/Lidarr.Api.V1.csproj b/src/Lidarr.Api.V1/Lidarr.Api.V1.csproj index b43412c2f..9b598f5a4 100644 --- a/src/Lidarr.Api.V1/Lidarr.Api.V1.csproj +++ b/src/Lidarr.Api.V1/Lidarr.Api.V1.csproj @@ -1,6 +1,6 @@  - net462;net5.0 + net5.0 diff --git a/src/Lidarr.Http/Lidarr.Http.csproj b/src/Lidarr.Http/Lidarr.Http.csproj index b1d77e5cf..1f1519bde 100644 --- a/src/Lidarr.Http/Lidarr.Http.csproj +++ b/src/Lidarr.Http/Lidarr.Http.csproj @@ -1,6 +1,6 @@  - net462;net5.0 + net5.0 diff --git a/src/NzbDrone.Api.Test/Lidarr.Api.Test.csproj b/src/NzbDrone.Api.Test/Lidarr.Api.Test.csproj index bc92d3f18..0411360b6 100644 --- a/src/NzbDrone.Api.Test/Lidarr.Api.Test.csproj +++ b/src/NzbDrone.Api.Test/Lidarr.Api.Test.csproj @@ -1,6 +1,6 @@  - net462;net5.0 + net5.0 diff --git a/src/NzbDrone.Automation.Test/Lidarr.Automation.Test.csproj b/src/NzbDrone.Automation.Test/Lidarr.Automation.Test.csproj index 7308a14d9..cec2bcd67 100644 --- a/src/NzbDrone.Automation.Test/Lidarr.Automation.Test.csproj +++ b/src/NzbDrone.Automation.Test/Lidarr.Automation.Test.csproj @@ -1,6 +1,6 @@  - net462;net5.0 + net5.0 diff --git a/src/NzbDrone.Common.Test/Lidarr.Common.Test.csproj b/src/NzbDrone.Common.Test/Lidarr.Common.Test.csproj index 09840b2ce..e8a5ddbce 100644 --- a/src/NzbDrone.Common.Test/Lidarr.Common.Test.csproj +++ b/src/NzbDrone.Common.Test/Lidarr.Common.Test.csproj @@ -1,6 +1,6 @@  - net462;net5.0 + net5.0 diff --git a/src/NzbDrone.Common/Composition/ContainerBuilderBase.cs b/src/NzbDrone.Common/Composition/ContainerBuilderBase.cs index 81858b813..093e25eb1 100644 --- a/src/NzbDrone.Common/Composition/ContainerBuilderBase.cs +++ b/src/NzbDrone.Common/Composition/ContainerBuilderBase.cs @@ -1,17 +1,14 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Reflection; +using System.Runtime.InteropServices; +using System.Runtime.Loader; using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Common.Messaging; using TinyIoC; -#if NETCOREAPP -using System.IO; -using System.Runtime.InteropServices; -using System.Runtime.Loader; -#endif - namespace NzbDrone.Common.Composition { public abstract class ContainerBuilderBase @@ -27,12 +24,6 @@ namespace NzbDrone.Common.Composition assemblies.Add(OsInfo.IsWindows ? "Lidarr.Windows" : "Lidarr.Mono"); assemblies.Add("Lidarr.Common"); -#if !NETCOREAPP - foreach (var assembly in assemblies) - { - _loadedTypes.AddRange(Assembly.Load(assembly).GetTypes()); - } -#else var startupPath = AppDomain.CurrentDomain.BaseDirectory; foreach (var assemblyName in assemblies) @@ -42,14 +33,12 @@ namespace NzbDrone.Common.Composition AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(ContainerResolveEventHandler); RegisterSQLiteResolver(); -#endif Container = new Container(new TinyIoCContainer(), _loadedTypes); AutoRegisterInterfaces(); Container.Register(args); } -#if NETCOREAPP private static Assembly ContainerResolveEventHandler(object sender, ResolveEventArgs args) { var resolver = new AssemblyDependencyResolver(args.RequestingAssembly.Location); @@ -86,7 +75,6 @@ namespace NzbDrone.Common.Composition var mappedName = OsInfo.IsLinux && libraryName == "sqlite3" ? "libsqlite3.so.0" : libraryName; return NativeLibrary.Load(mappedName, assembly, dllImportSearchPath); } -#endif private void AutoRegisterInterfaces() { diff --git a/src/NzbDrone.Common/EnvironmentInfo/PlatformInfo.cs b/src/NzbDrone.Common/EnvironmentInfo/PlatformInfo.cs index 0a0ac17c9..5c28231fe 100644 --- a/src/NzbDrone.Common/EnvironmentInfo/PlatformInfo.cs +++ b/src/NzbDrone.Common/EnvironmentInfo/PlatformInfo.cs @@ -26,21 +26,8 @@ namespace NzbDrone.Common.EnvironmentInfo static PlatformInfo() { -#if NETCOREAPP _platform = PlatformType.NetCore; _version = Environment.Version; -#else - if (Type.GetType("Mono.Runtime") != null) - { - _platform = PlatformType.Mono; - _version = GetMonoVersion(); - } - else - { - _platform = PlatformType.DotNet; - _version = GetDotNetVersion(); - } -#endif } public static PlatformType Platform => _platform; diff --git a/src/NzbDrone.Common/EnvironmentInfo/RuntimeInfo.cs b/src/NzbDrone.Common/EnvironmentInfo/RuntimeInfo.cs index 564a3977c..e7fe98dd9 100644 --- a/src/NzbDrone.Common/EnvironmentInfo/RuntimeInfo.cs +++ b/src/NzbDrone.Common/EnvironmentInfo/RuntimeInfo.cs @@ -23,7 +23,6 @@ namespace NzbDrone.Common.EnvironmentInfo serviceProvider.ServiceExist(ServiceProvider.SERVICE_NAME) && serviceProvider.GetStatus(ServiceProvider.SERVICE_NAME) == ServiceControllerStatus.StartPending; -#if NETCOREAPP // net5.0 will return Lidarr.dll for entry assembly, we need the actual // executable name (Lidarr on linux). On mono this will return the location of // the mono executable itself, which is not what we want. @@ -34,11 +33,6 @@ namespace NzbDrone.Common.EnvironmentInfo ExecutingApplication = entry.FileName; IsWindowsTray = OsInfo.IsWindows && entry.ModuleName == $"{ProcessProvider.LIDARR_PROCESS_NAME}.exe"; } -#else - // On mono we need to get the location of the Lidarr assembly, not Mono. - // Can't be running tray app in mono. - ExecutingApplication = Assembly.GetEntryAssembly()?.Location; -#endif } static RuntimeInfo() diff --git a/src/NzbDrone.Common/Extensions/DictionaryExtensions.cs b/src/NzbDrone.Common/Extensions/DictionaryExtensions.cs index 0c32d49c7..dc9c20b5a 100644 --- a/src/NzbDrone.Common/Extensions/DictionaryExtensions.cs +++ b/src/NzbDrone.Common/Extensions/DictionaryExtensions.cs @@ -6,14 +6,6 @@ namespace NzbDrone.Common.Extensions { public static class DictionaryExtensions { -#if !NETCOREAPP - public static TValue GetValueOrDefault(this IReadOnlyDictionary dictionary, TKey key, TValue defaultValue = default(TValue)) - { - TValue value; - return dictionary.TryGetValue(key, out value) ? value : defaultValue; - } -#endif - public static Dictionary Merge(this Dictionary first, Dictionary second) { if (first == null) diff --git a/src/NzbDrone.Common/Http/Dispatchers/ManagedHttpDispatcher.cs b/src/NzbDrone.Common/Http/Dispatchers/ManagedHttpDispatcher.cs index 0a52a62a6..c1179d4a2 100644 --- a/src/NzbDrone.Common/Http/Dispatchers/ManagedHttpDispatcher.cs +++ b/src/NzbDrone.Common/Http/Dispatchers/ManagedHttpDispatcher.cs @@ -34,19 +34,10 @@ namespace NzbDrone.Common.Http.Dispatchers { var webRequest = (HttpWebRequest)WebRequest.Create((Uri)request.Url); - if (PlatformInfo.IsMono) - { - // On Mono GZipStream/DeflateStream leaks memory if an exception is thrown, use an intermediate buffer in that case. - webRequest.AutomaticDecompression = DecompressionMethods.None; - webRequest.Headers.Add("Accept-Encoding", "gzip"); - } - else - { - // Deflate is not a standard and could break depending on implementation. - // we should just stick with the more compatible Gzip - //http://stackoverflow.com/questions/8490718/how-to-decompress-stream-deflated-with-java-util-zip-deflater-in-net - webRequest.AutomaticDecompression = DecompressionMethods.GZip; - } + // Deflate is not a standard and could break depending on implementation. + // we should just stick with the more compatible Gzip + //http://stackoverflow.com/questions/8490718/how-to-decompress-stream-deflated-with-java-util-zip-deflater-in-net + webRequest.AutomaticDecompression = DecompressionMethods.GZip; webRequest.Method = request.Method.ToString(); webRequest.UserAgent = _userAgentBuilder.GetUserAgent(request.UseSimplifiedUserAgent); @@ -87,9 +78,6 @@ namespace NzbDrone.Common.Http.Dispatchers if (httpWebResponse == null) { - // Workaround for mono not closing connections properly in certain situations. - AbortWebRequest(webRequest); - // The default messages for WebException on mono are pretty horrible. if (e.Status == WebExceptionStatus.NameResolutionFailure) { @@ -123,12 +111,6 @@ namespace NzbDrone.Common.Http.Dispatchers try { data = responseStream.ToBytes(); - - if (PlatformInfo.IsMono && httpWebResponse.ContentEncoding == "gzip") - { - data = data.Decompress(); - httpWebResponse.Headers.Remove("Content-Encoding"); - } } catch (Exception ex) { @@ -238,37 +220,5 @@ namespace NzbDrone.Common.Http.Dispatchers } } } - - // Workaround for mono not closing connections properly on timeouts - private void AbortWebRequest(HttpWebRequest webRequest) - { - // First affected version was mono 5.16 - if (OsInfo.IsNotWindows && _platformInfo.Version >= new Version(5, 16)) - { - try - { - var currentOperationInfo = webRequest.GetType().GetField("currentOperation", BindingFlags.NonPublic | BindingFlags.Instance); - var currentOperation = currentOperationInfo.GetValue(webRequest); - - if (currentOperation != null) - { - var responseStreamInfo = currentOperation.GetType().GetField("responseStream", BindingFlags.NonPublic | BindingFlags.Instance); - var responseStream = responseStreamInfo.GetValue(currentOperation) as Stream; - - // Note that responseStream will likely be null once mono fixes it. - responseStream?.Dispose(); - } - } - catch (Exception ex) - { - // This can fail randomly on future mono versions that have been changed/fixed. Log to sentry and ignore. - _logger.Trace() - .Exception(ex) - .Message("Unable to dispose responseStream on mono {0}", _platformInfo.Version) - .WriteSentryWarn("MonoCloseWaitPatchFailed", ex.Message) - .Write(); - } - } - } } } diff --git a/src/NzbDrone.Common/Http/NzbDroneWebClient.cs b/src/NzbDrone.Common/Http/NzbDroneWebClient.cs deleted file mode 100644 index ccd369bb7..000000000 --- a/src/NzbDrone.Common/Http/NzbDroneWebClient.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Net; - -namespace NzbDrone.Common.Http -{ - public class NzbDroneWebClient : WebClient - { - protected override WebRequest GetWebRequest(Uri address) - { - var request = base.GetWebRequest(address); - if (request is HttpWebRequest) - { - ((HttpWebRequest)request).KeepAlive = false; - ((HttpWebRequest)request).ServicePoint.Expect100Continue = false; - } - - return request; - } - } -} diff --git a/src/NzbDrone.Common/Lidarr.Common.csproj b/src/NzbDrone.Common/Lidarr.Common.csproj index 2014f91f8..83d85e4db 100644 --- a/src/NzbDrone.Common/Lidarr.Common.csproj +++ b/src/NzbDrone.Common/Lidarr.Common.csproj @@ -1,6 +1,6 @@  - net462;net5.0 + net5.0 en ISMUSL @@ -14,16 +14,11 @@ - - - - - True diff --git a/src/NzbDrone.Common/Processes/ProcessProvider.cs b/src/NzbDrone.Common/Processes/ProcessProvider.cs index f83f9470d..4b8f5e8c6 100644 --- a/src/NzbDrone.Common/Processes/ProcessProvider.cs +++ b/src/NzbDrone.Common/Processes/ProcessProvider.cs @@ -44,11 +44,7 @@ namespace NzbDrone.Common.Processes public static int GetCurrentProcessId() { -#if NETCOREAPP return Environment.ProcessId; -#else - return Process.GetCurrentProcess().Id; -#endif } public ProcessInfo GetCurrentProcess() diff --git a/src/NzbDrone.Console/Lidarr.Console.csproj b/src/NzbDrone.Console/Lidarr.Console.csproj index 794a4bed1..0bbe62b1d 100644 --- a/src/NzbDrone.Console/Lidarr.Console.csproj +++ b/src/NzbDrone.Console/Lidarr.Console.csproj @@ -1,7 +1,7 @@  Exe - net462;net5.0 + net5.0 ..\NzbDrone.Host\NzbDrone.ico app.manifest diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/MonoDebugCheckFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/MonoDebugCheckFixture.cs deleted file mode 100644 index 087501f7f..000000000 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/MonoDebugCheckFixture.cs +++ /dev/null @@ -1,63 +0,0 @@ -using NUnit.Framework; -using NzbDrone.Common.EnvironmentInfo; -using NzbDrone.Core.HealthCheck.Checks; -using NzbDrone.Core.Test.Framework; -using NzbDrone.Test.Common; -using static NzbDrone.Core.HealthCheck.Checks.MonoDebugCheck; - -namespace NzbDrone.Core.Test.HealthCheck.Checks -{ - [TestFixture] - public class MonoDebugCheckFixture : CoreTest - { - private void GivenHasStackFrame(bool hasStackFrame) - { - Mocker.GetMock() - .Setup(f => f.HasStackFrameInfo()) - .Returns(hasStackFrame); - } - - [Test] - public void should_return_ok_if_not_mono() - { - if (PlatformInfo.IsMono) - { - throw new IgnoreException("non mono specific test"); - } - - Subject.Check().ShouldBeOk(); - } - - [Test] - public void should_return_ok_if_not_debug() - { - MonoOnly(); - - GivenHasStackFrame(false); - - Subject.Check().ShouldBeOk(); - } - - [Test] - public void should_log_warning_if_not_debug() - { - MonoOnly(); - - GivenHasStackFrame(false); - - Subject.Check(); - - ExceptionVerification.ExpectedWarns(1); - } - - [Test] - public void should_return_ok_if_debug() - { - MonoOnly(); - - GivenHasStackFrame(true); - - Subject.Check().ShouldBeOk(); - } - } -} diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/MonoNotNetCoreCheckFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/MonoNotNetCoreCheckFixture.cs deleted file mode 100644 index 991040b35..000000000 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/MonoNotNetCoreCheckFixture.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System.Collections.Generic; -using NUnit.Framework; -using NzbDrone.Common.Processes; -using NzbDrone.Core.HealthCheck.Checks; -using NzbDrone.Core.Test.Framework; - -namespace NzbDrone.Core.Test.HealthCheck.Checks -{ - [TestFixture] - public class MonoNotNetCoreCheckFixture : CoreTest - { - [Test] - [Platform(Exclude = "Mono")] - public void should_return_ok_if_net_core() - { - Subject.Check().ShouldBeOk(); - } - - [Test] - [Platform("Mono")] - public void should_log_warning_if_mono() - { - Subject.Check().ShouldBeWarning(); - } - - [Test] - [Platform("Mono")] - public void should_return_ok_if_bsd() - { - Mocker.GetMock() - .Setup(x => x.StartAndCapture("uname", null, null)) - .Returns(new ProcessOutput - { - Lines = new List - { - new ProcessOutputLine(ProcessOutputLevel.Standard, "FreeBSD") - } - }); - Subject.Check().ShouldBeOk(); - } - } -} diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/MonoVersionCheckFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/MonoVersionCheckFixture.cs deleted file mode 100644 index e33402e41..000000000 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/MonoVersionCheckFixture.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System; -using NUnit.Framework; -using NzbDrone.Common.EnvironmentInfo; -using NzbDrone.Core.HealthCheck.Checks; -using NzbDrone.Core.Test.Framework; - -namespace NzbDrone.Core.Test.HealthCheck.Checks -{ - [TestFixture] - public class MonoVersionCheckFixture : CoreTest - { - private void GivenOutput(string version) - { - MonoOnly(); - - Mocker.GetMock() - .SetupGet(s => s.Version) - .Returns(new Version(version)); - } - - [TestCase("5.18")] - [TestCase("5.20")] - public void should_return_ok(string version) - { - GivenOutput(version); - - Subject.Check().ShouldBeOk(); - } - - [TestCase("5.16")] - public void should_return_notice(string version) - { - GivenOutput(version); - - Subject.Check().ShouldBeNotice(); - } - - [TestCase("5.4")] - [TestCase("5.8")] - public void should_return_warning(string version) - { - GivenOutput(version); - - Subject.Check().ShouldBeWarning(); - } - - [TestCase("2.10.2")] - [TestCase("2.10.8.1")] - [TestCase("3.0.0.1")] - [TestCase("3.2.0.1")] - [TestCase("3.2.1")] - [TestCase("3.2.7")] - [TestCase("3.6.1")] - [TestCase("3.8")] - [TestCase("3.10")] - [TestCase("4.0.0.0")] - [TestCase("4.2")] - [TestCase("4.4.0")] - [TestCase("4.4.1")] - public void should_return_error(string version) - { - GivenOutput(version); - - Subject.Check().ShouldBeError(); - } - } -} diff --git a/src/NzbDrone.Core.Test/Lidarr.Core.Test.csproj b/src/NzbDrone.Core.Test/Lidarr.Core.Test.csproj index 3f6f1fb7b..150916e29 100644 --- a/src/NzbDrone.Core.Test/Lidarr.Core.Test.csproj +++ b/src/NzbDrone.Core.Test/Lidarr.Core.Test.csproj @@ -1,6 +1,6 @@  - net462;net5.0 + net5.0 diff --git a/src/NzbDrone.Core/HealthCheck/Checks/MonoDebugCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/MonoDebugCheck.cs deleted file mode 100644 index 5d9bbce5c..000000000 --- a/src/NzbDrone.Core/HealthCheck/Checks/MonoDebugCheck.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System.Diagnostics; -using NLog; -using NzbDrone.Common.EnvironmentInfo; -using NzbDrone.Common.Extensions; - -namespace NzbDrone.Core.HealthCheck.Checks -{ - public class MonoDebugCheck : HealthCheckBase - { - private readonly Logger _logger; - private readonly StackFrameHelper _stackFrameHelper; - - public override bool CheckOnSchedule => false; - - public MonoDebugCheck(Logger logger, StackFrameHelper stackFrameHelper) - { - _logger = logger; - _stackFrameHelper = stackFrameHelper; - } - - public class StackFrameHelper - { - public virtual bool HasStackFrameInfo() - { - var stackTrace = new StackTrace(true); - - return stackTrace.FrameCount > 0 && stackTrace.GetFrame(0).GetFileName().IsNotNullOrWhiteSpace(); - } - } - - public override HealthCheck Check() - { - if (!PlatformInfo.IsMono) - { - return new HealthCheck(GetType()); - } - - if (!_stackFrameHelper.HasStackFrameInfo()) - { - _logger.Warn("Mono is not running with --debug switch"); - return new HealthCheck(GetType()); - } - - return new HealthCheck(GetType()); - } - } -} diff --git a/src/NzbDrone.Core/HealthCheck/Checks/MonoNotNetCoreCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/MonoNotNetCoreCheck.cs deleted file mode 100644 index 28691888d..000000000 --- a/src/NzbDrone.Core/HealthCheck/Checks/MonoNotNetCoreCheck.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System.Linq; -using System.Runtime.InteropServices; -using NLog; -using NzbDrone.Common.EnvironmentInfo; -using NzbDrone.Common.Processes; - -namespace NzbDrone.Core.HealthCheck.Checks -{ - public class MonoNotNetCoreCheck : HealthCheckBase - { - private static string[] MonoUnames = new string[] { "FreeBSD", "OpenBSD", "MidnightBSD", "NetBSD" }; - private readonly IOsInfo _osInfo; - private readonly IProcessProvider _processProvider; - - public MonoNotNetCoreCheck(IOsInfo osInfo, - IProcessProvider processProvider, - Logger logger) - { - _osInfo = osInfo; - _processProvider = processProvider; - } - - public override HealthCheck Check() - { - if (!PlatformInfo.IsMono) - { - return new HealthCheck(GetType()); - } - - // Don't warn on arm based synology - could be arm5 or something else rubbish - if (_osInfo.Name == "DSM" && RuntimeInformation.ProcessArchitecture == Architecture.Arm) - { - return new HealthCheck(GetType()); - } - - // Don't warn on linux x86 - we don't build x86 net core - if (OsInfo.IsLinux && RuntimeInformation.ProcessArchitecture == Architecture.X86) - { - return new HealthCheck(GetType()); - } - - // Check for BSD - var output = _processProvider.StartAndCapture("uname"); - if (output?.ExitCode == 0 && MonoUnames.Contains(output?.Lines.First().Content)) - { - return new HealthCheck(GetType()); - } - - return new HealthCheck(GetType(), - HealthCheckResult.Warning, - "Please upgrade to the .NET Core version of Lidarr", - "#update_to_net_core_version"); - } - - public override bool CheckOnSchedule => false; - } -} diff --git a/src/NzbDrone.Core/HealthCheck/Checks/MonoTlsCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/MonoTlsCheck.cs deleted file mode 100644 index c1f9ecc8b..000000000 --- a/src/NzbDrone.Core/HealthCheck/Checks/MonoTlsCheck.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using NLog; -using NLog.Fluent; -using NzbDrone.Common.EnvironmentInfo; -using NzbDrone.Common.Instrumentation.Extensions; - -namespace NzbDrone.Core.HealthCheck.Checks -{ - public class MonoTlsCheck : HealthCheckBase - { - private readonly IPlatformInfo _platformInfo; - private readonly Logger _logger; - - public MonoTlsCheck(IPlatformInfo platformInfo, Logger logger) - { - _platformInfo = platformInfo; - _logger = logger; - } - - public override HealthCheck Check() - { - if (!PlatformInfo.IsMono) - { - return new HealthCheck(GetType()); - } - - var monoVersion = _platformInfo.Version; - - if (monoVersion >= new Version("5.8.0") && Environment.GetEnvironmentVariable("MONO_TLS_PROVIDER") == "legacy") - { - _logger.Debug() - .Message("Mono version {0} and legacy TLS provider is selected, recommending user to switch to btls.", monoVersion) - .WriteSentryDebug("LegacyTlsProvider", monoVersion.ToString()) - .Write(); - - return new HealthCheck(GetType(), HealthCheckResult.Warning, "Lidarr Mono 4.x tls workaround still enabled, consider removing MONO_TLS_PROVIDER=legacy environment option"); - } - - return new HealthCheck(GetType()); - } - - public override bool CheckOnSchedule => false; - } -} diff --git a/src/NzbDrone.Core/HealthCheck/Checks/MonoVersionCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/MonoVersionCheck.cs deleted file mode 100644 index 02216d564..000000000 --- a/src/NzbDrone.Core/HealthCheck/Checks/MonoVersionCheck.cs +++ /dev/null @@ -1,76 +0,0 @@ -using System; -using NLog; -using NzbDrone.Common.EnvironmentInfo; - -namespace NzbDrone.Core.HealthCheck.Checks -{ - public class MonoVersionCheck : HealthCheckBase - { - private readonly IPlatformInfo _platformInfo; - private readonly Logger _logger; - - public MonoVersionCheck(IPlatformInfo platformInfo, Logger logger) - { - _platformInfo = platformInfo; - _logger = logger; - } - - public override HealthCheck Check() - { - if (!PlatformInfo.IsMono) - { - return new HealthCheck(GetType()); - } - - var monoVersion = _platformInfo.Version; - - // Known buggy Mono versions - if (monoVersion == new Version("4.4.0") || monoVersion == new Version("4.4.1")) - { - _logger.Debug("Mono version {0}", monoVersion); - return new HealthCheck(GetType(), - HealthCheckResult.Error, - $"Currently installed Mono version {monoVersion} has a bug that causes issues connecting to indexers/download clients. You should upgrade to a higher version", - "#currently_installed_mono_version_is_old_and_unsupported"); - } - - // Currently best stable Mono version (5.18 gets us .net 4.7.2 support) - var bestVersion = new Version("5.20"); - var targetVersion = new Version("5.18"); - if (monoVersion >= targetVersion) - { - _logger.Debug("Mono version is {0} or better: {1}", targetVersion, monoVersion); - return new HealthCheck(GetType()); - } - - // Stable Mono versions - var stableVersion = new Version("5.16"); - if (monoVersion >= stableVersion) - { - _logger.Debug("Mono version is {0} or better: {1}", stableVersion, monoVersion); - return new HealthCheck(GetType(), - HealthCheckResult.Notice, - $"Currently installed Mono version {monoVersion} is supported but upgrading to {bestVersion} is recommended.", - "#currently_installed_mono_version_is_supported_but_upgrading_is_recommended"); - } - - // Old but supported Mono versions, there are known bugs - var supportedVersion = new Version("5.4"); - if (monoVersion >= supportedVersion) - { - _logger.Debug("Mono version is {0} or better: {1}", supportedVersion, monoVersion); - return new HealthCheck(GetType(), - HealthCheckResult.Warning, - $"Currently installed Mono version {monoVersion} is supported but has some known issues. Please upgrade Mono to version {bestVersion}.", - "#currently_installed_mono_version_is_supported_but_upgrading_is_recommended"); - } - - return new HealthCheck(GetType(), - HealthCheckResult.Error, - $"Currently installed Mono version {monoVersion} is old and unsupported. Please upgrade Mono to version {bestVersion}.", - "#currently_installed_mono_version_is_old_and_unsupported"); - } - - public override bool CheckOnSchedule => false; - } -} diff --git a/src/NzbDrone.Core/Lidarr.Core.csproj b/src/NzbDrone.Core/Lidarr.Core.csproj index c2464643e..ea6d888ae 100644 --- a/src/NzbDrone.Core/Lidarr.Core.csproj +++ b/src/NzbDrone.Core/Lidarr.Core.csproj @@ -1,6 +1,6 @@  - net462;net5.0 + net5.0 @@ -24,10 +24,6 @@ - - - - Resources\Logo\64.png diff --git a/src/NzbDrone.Host.Test/Lidarr.Host.Test.csproj b/src/NzbDrone.Host.Test/Lidarr.Host.Test.csproj index d718c91b1..01ea98d8d 100644 --- a/src/NzbDrone.Host.Test/Lidarr.Host.Test.csproj +++ b/src/NzbDrone.Host.Test/Lidarr.Host.Test.csproj @@ -1,6 +1,6 @@  - net462;net5.0 + net5.0 diff --git a/src/NzbDrone.Host/Lidarr.Host.csproj b/src/NzbDrone.Host/Lidarr.Host.csproj index 52c07d9a8..97ec2cb28 100644 --- a/src/NzbDrone.Host/Lidarr.Host.csproj +++ b/src/NzbDrone.Host/Lidarr.Host.csproj @@ -1,19 +1,10 @@  - net462;net5.0 + net5.0 Library - - - - - - - - - - + @@ -30,7 +21,4 @@ True - - - diff --git a/src/NzbDrone.Host/WebHost/Middleware/SignalRMiddleware.cs b/src/NzbDrone.Host/WebHost/Middleware/SignalRMiddleware.cs index 07badd229..84d967076 100644 --- a/src/NzbDrone.Host/WebHost/Middleware/SignalRMiddleware.cs +++ b/src/NzbDrone.Host/WebHost/Middleware/SignalRMiddleware.cs @@ -55,17 +55,10 @@ namespace NzbDrone.Host.Middleware } }); -#if NETCOREAPP appBuilder.UseEndpoints(x => { x.MapHub(URL_BASE + "/signalr/messages"); }); -#else - appBuilder.UseSignalR(x => - { - x.MapHub("/signalr/messages"); - }); -#endif // This is a side effect of haing multiple IoC containers, TinyIoC and whatever // Kestrel/SignalR is using. Ideally we'd have one IoC container, but that's non-trivial with TinyIoC diff --git a/src/NzbDrone.Host/WebHost/WebHostController.cs b/src/NzbDrone.Host/WebHost/WebHostController.cs index 2e2f7f1b2..6320bebc1 100644 --- a/src/NzbDrone.Host/WebHost/WebHostController.cs +++ b/src/NzbDrone.Host/WebHost/WebHostController.cs @@ -105,23 +105,14 @@ namespace NzbDrone.Host { services .AddSignalR() -#if !NETCOREAPP - .AddJsonProtocol(options => - { - options.PayloadSerializerSettings = Json.GetSerializerSettings(); - }); -#else .AddJsonProtocol(options => { options.PayloadSerializerOptions = STJson.GetSerializerSettings(); }); -#endif }) .Configure(app => { -#if NETCOREAPP app.UseRouting(); -#endif app.Properties["host.AppName"] = BuildInfo.AppName; app.UsePathBase(_configFileProvider.UrlBase); diff --git a/src/NzbDrone.Integration.Test/Lidarr.Integration.Test.csproj b/src/NzbDrone.Integration.Test/Lidarr.Integration.Test.csproj index b5cfb88d5..0dd7a1d47 100644 --- a/src/NzbDrone.Integration.Test/Lidarr.Integration.Test.csproj +++ b/src/NzbDrone.Integration.Test/Lidarr.Integration.Test.csproj @@ -1,6 +1,6 @@  - net462;net5.0 + net5.0 Library diff --git a/src/NzbDrone.Libraries.Test/Lidarr.Libraries.Test.csproj b/src/NzbDrone.Libraries.Test/Lidarr.Libraries.Test.csproj index 11e5c1fad..e09634adc 100644 --- a/src/NzbDrone.Libraries.Test/Lidarr.Libraries.Test.csproj +++ b/src/NzbDrone.Libraries.Test/Lidarr.Libraries.Test.csproj @@ -1,6 +1,6 @@  - net462;net5.0 + net5.0 diff --git a/src/NzbDrone.Mono.Test/Lidarr.Mono.Test.csproj b/src/NzbDrone.Mono.Test/Lidarr.Mono.Test.csproj index eebd3362e..dea211fcb 100644 --- a/src/NzbDrone.Mono.Test/Lidarr.Mono.Test.csproj +++ b/src/NzbDrone.Mono.Test/Lidarr.Mono.Test.csproj @@ -1,6 +1,6 @@  - net462;net5.0 + net5.0 diff --git a/src/NzbDrone.Mono/Lidarr.Mono.csproj b/src/NzbDrone.Mono/Lidarr.Mono.csproj index 0dda46300..316d79eae 100644 --- a/src/NzbDrone.Mono/Lidarr.Mono.csproj +++ b/src/NzbDrone.Mono/Lidarr.Mono.csproj @@ -1,19 +1,10 @@  - net462;net5.0 + net5.0 - - - - - - diff --git a/src/NzbDrone.SignalR/Lidarr.SignalR.csproj b/src/NzbDrone.SignalR/Lidarr.SignalR.csproj index 6246627d1..c7bf7db3c 100644 --- a/src/NzbDrone.SignalR/Lidarr.SignalR.csproj +++ b/src/NzbDrone.SignalR/Lidarr.SignalR.csproj @@ -1,12 +1,8 @@  - net462;net5.0 + net5.0 Library - - - - diff --git a/src/NzbDrone.SignalR/SignalRMessage.cs b/src/NzbDrone.SignalR/SignalRMessage.cs index 81a0a2b2c..4b468477c 100644 --- a/src/NzbDrone.SignalR/SignalRMessage.cs +++ b/src/NzbDrone.SignalR/SignalRMessage.cs @@ -7,11 +7,7 @@ namespace NzbDrone.SignalR public object Body { get; set; } public string Name { get; set; } -#if !NETCOREAPP - [Newtonsoft.Json.JsonIgnore] -#else [System.Text.Json.Serialization.JsonIgnore] -#endif public ModelAction Action { get; set; } } } diff --git a/src/NzbDrone.Test.Common/AutoMoq/AutoMoqer.cs b/src/NzbDrone.Test.Common/AutoMoq/AutoMoqer.cs index f7eee539c..efcccbc83 100644 --- a/src/NzbDrone.Test.Common/AutoMoq/AutoMoqer.cs +++ b/src/NzbDrone.Test.Common/AutoMoq/AutoMoqer.cs @@ -164,9 +164,7 @@ namespace NzbDrone.Test.Common.AutoMoq RegisterPlatformLibrary(container); AddTheAutoMockingContainerExtensionToTheContainer(container); -#if NETCOREAPP ContainerBuilderBase.RegisterSQLiteResolver(); -#endif } private static void AddTheAutoMockingContainerExtensionToTheContainer(IUnityContainer container) diff --git a/src/NzbDrone.Test.Common/Lidarr.Test.Common.csproj b/src/NzbDrone.Test.Common/Lidarr.Test.Common.csproj index 297439761..81741f15f 100644 --- a/src/NzbDrone.Test.Common/Lidarr.Test.Common.csproj +++ b/src/NzbDrone.Test.Common/Lidarr.Test.Common.csproj @@ -1,6 +1,6 @@  - net462;net5.0 + net5.0 diff --git a/src/NzbDrone.Test.Common/NzbDroneRunner.cs b/src/NzbDrone.Test.Common/NzbDroneRunner.cs index 1bb7e066a..2b6b2d353 100644 --- a/src/NzbDrone.Test.Common/NzbDroneRunner.cs +++ b/src/NzbDrone.Test.Common/NzbDroneRunner.cs @@ -57,8 +57,7 @@ namespace NzbDrone.Test.Common _startupLog = new List(); if (BuildInfo.IsDebug) { - var frameworkFolder = PlatformInfo.IsNetCore ? "net5.0" : "net462"; - Start(Path.Combine(TestContext.CurrentContext.TestDirectory, "..", "..", "_output", frameworkFolder, lidarrConsoleExe)); + Start(Path.Combine(TestContext.CurrentContext.TestDirectory, "..", "..", "_output", "net5.0", lidarrConsoleExe)); } else { diff --git a/src/NzbDrone.Test.Dummy/Lidarr.Test.Dummy.csproj b/src/NzbDrone.Test.Dummy/Lidarr.Test.Dummy.csproj index c1cce723b..6be4dabce 100644 --- a/src/NzbDrone.Test.Dummy/Lidarr.Test.Dummy.csproj +++ b/src/NzbDrone.Test.Dummy/Lidarr.Test.Dummy.csproj @@ -1,6 +1,6 @@  Exe - net462;net5.0 + net5.0 diff --git a/src/NzbDrone.Update.Test/Lidarr.Update.Test.csproj b/src/NzbDrone.Update.Test/Lidarr.Update.Test.csproj index 9b5cb3eec..4532b5898 100644 --- a/src/NzbDrone.Update.Test/Lidarr.Update.Test.csproj +++ b/src/NzbDrone.Update.Test/Lidarr.Update.Test.csproj @@ -1,6 +1,6 @@  - net462;net5.0 + net5.0 diff --git a/src/NzbDrone.Update/Lidarr.Update.csproj b/src/NzbDrone.Update/Lidarr.Update.csproj index 75b5e597f..ee11e69ce 100644 --- a/src/NzbDrone.Update/Lidarr.Update.csproj +++ b/src/NzbDrone.Update/Lidarr.Update.csproj @@ -1,7 +1,7 @@  WinExe - net462;net5.0 + net5.0 diff --git a/src/NzbDrone.Windows.Test/Lidarr.Windows.Test.csproj b/src/NzbDrone.Windows.Test/Lidarr.Windows.Test.csproj index 5fb416ae6..0b7474297 100644 --- a/src/NzbDrone.Windows.Test/Lidarr.Windows.Test.csproj +++ b/src/NzbDrone.Windows.Test/Lidarr.Windows.Test.csproj @@ -1,6 +1,6 @@  - net462;net5.0 + net5.0 diff --git a/src/NzbDrone.Windows/Lidarr.Windows.csproj b/src/NzbDrone.Windows/Lidarr.Windows.csproj index 4ebbbd83d..a66e5d7a3 100644 --- a/src/NzbDrone.Windows/Lidarr.Windows.csproj +++ b/src/NzbDrone.Windows/Lidarr.Windows.csproj @@ -1,6 +1,6 @@  - net462;net5.0 + net5.0 diff --git a/src/NzbDrone/Lidarr.csproj b/src/NzbDrone/Lidarr.csproj index 243c45e66..35f57a2c7 100644 --- a/src/NzbDrone/Lidarr.csproj +++ b/src/NzbDrone/Lidarr.csproj @@ -1,7 +1,7 @@  WinExe - net462;net5.0-windows + net5.0-windows win-x64;win-x86 true ..\NzbDrone.Host\NzbDrone.ico @@ -14,9 +14,6 @@ - - - True diff --git a/src/ServiceHelpers/ServiceInstall/ServiceInstall.csproj b/src/ServiceHelpers/ServiceInstall/ServiceInstall.csproj index 25a99b203..35cf3158e 100644 --- a/src/ServiceHelpers/ServiceInstall/ServiceInstall.csproj +++ b/src/ServiceHelpers/ServiceInstall/ServiceInstall.csproj @@ -1,7 +1,7 @@  WinExe - net462;net5.0 + net5.0 diff --git a/src/ServiceHelpers/ServiceUninstall/ServiceUninstall.csproj b/src/ServiceHelpers/ServiceUninstall/ServiceUninstall.csproj index 25a99b203..35cf3158e 100644 --- a/src/ServiceHelpers/ServiceUninstall/ServiceUninstall.csproj +++ b/src/ServiceHelpers/ServiceUninstall/ServiceUninstall.csproj @@ -1,7 +1,7 @@  WinExe - net462;net5.0 + net5.0 diff --git a/src/Targets/FixBindingRedirects.targets b/src/Targets/FixBindingRedirects.targets deleted file mode 100644 index 8b34cfb68..000000000 --- a/src/Targets/FixBindingRedirects.targets +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/src/Targets/MonoFacades.targets b/src/Targets/MonoFacades.targets deleted file mode 100644 index 7e358209c..000000000 --- a/src/Targets/MonoFacades.targets +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - $(MSBuildThisFileDirectory)..\Libraries\Mono\ - - $(ResolveReferencesDependsOn); - SubstituteMonoFacadesBuild - - - - - - - - - - - - - - - - - - %(ReferenceCopyLocalPaths.Identity) - $(MonoFacadesPath)%(Filename)%(Extension) - - - - - - - - - - - - diff --git a/src/Targets/PublishAllRids.targets b/src/Targets/PublishAllRids.targets index e43dd7bfe..98f1b2de9 100644 --- a/src/Targets/PublishAllRids.targets +++ b/src/Targets/PublishAllRids.targets @@ -21,8 +21,6 @@ %(Framework) - - RuntimeIdentifier=%(Renamed.Runtime);TargetFramework=%(Renamed.Framework)