feat: Upgrade to .net 8 and remove obsolete method calls

This commit is contained in:
danielvschoor 2024-07-17 22:48:16 +02:00
parent f59c0b16ca
commit 3c9ed36006
39 changed files with 40 additions and 60 deletions

View File

@ -4,7 +4,7 @@ set -e
outputFolder='_output' outputFolder='_output'
testPackageFolder='_tests' testPackageFolder='_tests'
artifactsFolder="_artifacts"; artifactsFolder="_artifacts";
framework="${FRAMEWORK:=net6.0}" framework="${FRAMEWORK:=net8.0}"
ProgressStart() ProgressStart()
{ {

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
set -e set -e
FRAMEWORK="net6.0" FRAMEWORK="net8.0"
PLATFORM=$1 PLATFORM=$1
if [ "$PLATFORM" = "Windows" ]; then if [ "$PLATFORM" = "Windows" ]; then

View File

@ -1,5 +1,5 @@
{ {
"sdk": { "sdk": {
"version": "6.0.405" "version": "8.0.303"
} }
} }

View File

@ -135,7 +135,7 @@
<PackageReference Include="NunitXml.TestLogger" Version="3.0.131" /> <PackageReference Include="NunitXml.TestLogger" Version="3.0.131" />
</ItemGroup> </ItemGroup>
<ItemGroup Condition="'$(TestProject)'=='true' and '$(TargetFramework)'=='net6.0'"> <ItemGroup Condition="'$(TestProject)'=='true' and '$(TargetFramework)'=='net8.0'">
<PackageReference Include="coverlet.collector" Version="3.0.4-preview.27.ge7cb7c3b40" /> <PackageReference Include="coverlet.collector" Version="3.0.4-preview.27.ge7cb7c3b40" />
</ItemGroup> </ItemGroup>

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks> <TargetFrameworks>net8.0</TargetFrameworks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" Version="2.3.3" /> <PackageReference Include="GitHubActionsTestLogger" Version="2.3.3" />

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks> <TargetFrameworks>net8.0</TargetFrameworks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" Version="2.3.3" /> <PackageReference Include="GitHubActionsTestLogger" Version="2.3.3" />

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks> <TargetFrameworks>net8.0</TargetFrameworks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" Version="2.3.3" /> <PackageReference Include="GitHubActionsTestLogger" Version="2.3.3" />

View File

@ -1,6 +1,5 @@
using System; using System;
using System.IO; using System.IO;
using System.Runtime.Serialization;
namespace NzbDrone.Common.Disk namespace NzbDrone.Common.Disk
{ {
@ -24,10 +23,5 @@ namespace NzbDrone.Common.Disk
: base(message, innerException) : base(message, innerException)
{ {
} }
protected DestinationAlreadyExistsException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
} }
} }

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks> <TargetFrameworks>net8.0</TargetFrameworks>
<DefineConstants Condition="'$(RuntimeIdentifier)' == 'linux-musl-x64' or '$(RuntimeIdentifier)' == 'linux-musl-arm64'">ISMUSL</DefineConstants> <DefineConstants Condition="'$(RuntimeIdentifier)' == 'linux-musl-x64' or '$(RuntimeIdentifier)' == 'linux-musl-arm64'">ISMUSL</DefineConstants>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,9 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFrameworks>net6.0</TargetFrameworks>
<ApplicationIcon>..\NzbDrone.Host\Sonarr.ico</ApplicationIcon> <ApplicationIcon>..\NzbDrone.Host\Sonarr.ico</ApplicationIcon>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="!$(RuntimeIdentifier.StartsWith('win'))"> <PropertyGroup Condition="!$(RuntimeIdentifier.StartsWith('win'))">
<AssemblyName>Sonarr</AssemblyName> <AssemblyName>Sonarr</AssemblyName>

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks> <TargetFrameworks>net8.0</TargetFrameworks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Dapper" Version="2.0.123" /> <PackageReference Include="Dapper" Version="2.0.123" />

View File

@ -1,6 +1,5 @@
using System; using System;
using System.IO; using System.IO;
using System.Runtime.Serialization;
namespace NzbDrone.Core.MediaFiles.EpisodeImport namespace NzbDrone.Core.MediaFiles.EpisodeImport
{ {
@ -19,10 +18,5 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
: base(message, innerException) : base(message, innerException)
{ {
} }
protected RecycleBinException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
} }
} }

View File

@ -1,6 +1,5 @@
using System; using System;
using System.IO; using System.IO;
using System.Runtime.Serialization;
namespace NzbDrone.Core.MediaFiles.EpisodeImport namespace NzbDrone.Core.MediaFiles.EpisodeImport
{ {
@ -19,10 +18,5 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
: base(message, innerException) : base(message, innerException)
{ {
} }
protected RootFolderNotFoundException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
} }
} }

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks> <TargetFrameworks>net8.0</TargetFrameworks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Dapper" Version="2.0.123" /> <PackageReference Include="Dapper" Version="2.0.123" />

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks> <TargetFrameworks>net8.0</TargetFrameworks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" Version="2.3.3" /> <PackageReference Include="GitHubActionsTestLogger" Version="2.3.3" />

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks> <TargetFrameworks>net8.0</TargetFrameworks>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks> <TargetFrameworks>net8.0</TargetFrameworks>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks> <TargetFrameworks>net8.0</TargetFrameworks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" Version="2.3.3" /> <PackageReference Include="GitHubActionsTestLogger" Version="2.3.3" />

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks> <TargetFrameworks>net8.0</TargetFrameworks>
</PropertyGroup> </PropertyGroup>
<!-- <!--
The netstandard version here doesn't work in net framework The netstandard version here doesn't work in net framework

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks> <TargetFrameworks>net8.0</TargetFrameworks>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup> </PropertyGroup>
<!-- <!--

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks> <TargetFrameworks>net8.0</TargetFrameworks>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -55,7 +55,7 @@ namespace NzbDrone.Test.Common
if (BuildInfo.IsDebug) if (BuildInfo.IsDebug)
{ {
Start(Path.Combine(TestContext.CurrentContext.TestDirectory, "..", "..", "_output", "net6.0", consoleExe)); Start(Path.Combine(TestContext.CurrentContext.TestDirectory, "..", "..", "_output", "net8.0", consoleExe));
} }
else else
{ {

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks> <TargetFrameworks>net8.0</TargetFrameworks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.10.0" /> <PackageReference Include="FluentAssertions" Version="6.10.0" />

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFrameworks>net6.0</TargetFrameworks> <TargetFrameworks>net8.0</TargetFrameworks>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks> <TargetFrameworks>net8.0</TargetFrameworks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" Version="2.3.3" /> <PackageReference Include="GitHubActionsTestLogger" Version="2.3.3" />

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<TargetFrameworks>net6.0</TargetFrameworks> <TargetFrameworks>net8.0</TargetFrameworks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="DryIoc.dll" Version="5.4.3" /> <PackageReference Include="DryIoc.dll" Version="5.4.3" />

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks> <TargetFrameworks>net8.0</TargetFrameworks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" Version="2.3.3" /> <PackageReference Include="GitHubActionsTestLogger" Version="2.3.3" />

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks> <TargetFrameworks>net8.0</TargetFrameworks>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<TargetFrameworks>net6.0-windows</TargetFrameworks> <TargetFrameworks>net8.0-windows</TargetFrameworks>
<RuntimeIdentifiers>win-x64;win-x86</RuntimeIdentifiers> <RuntimeIdentifiers>win-x64;win-x86</RuntimeIdentifiers>
<UseWindowsForms>true</UseWindowsForms> <UseWindowsForms>true</UseWindowsForms>
<ApplicationIcon>..\NzbDrone.Host\Sonarr.ico</ApplicationIcon> <ApplicationIcon>..\NzbDrone.Host\Sonarr.ico</ApplicationIcon>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<TargetFrameworks>net6.0</TargetFrameworks> <TargetFrameworks>net8.0</TargetFrameworks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="System.Security.Principal.Windows" Version="6.0.0-preview.5.21301.5" /> <PackageReference Include="System.Security.Principal.Windows" Version="6.0.0-preview.5.21301.5" />

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<TargetFrameworks>net6.0</TargetFrameworks> <TargetFrameworks>net8.0</TargetFrameworks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="System.Security.Principal.Windows" Version="6.0.0-preview.5.21301.5" /> <PackageReference Include="System.Security.Principal.Windows" Version="6.0.0-preview.5.21301.5" />

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks> <TargetFrameworks>net8.0</TargetFrameworks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="FluentValidation" Version="9.5.4" /> <PackageReference Include="FluentValidation" Version="9.5.4" />

View File

@ -28,9 +28,8 @@ namespace Sonarr.Http.Authentication
public ApiKeyAuthenticationHandler(IOptionsMonitor<ApiKeyAuthenticationOptions> options, public ApiKeyAuthenticationHandler(IOptionsMonitor<ApiKeyAuthenticationOptions> options,
ILoggerFactory logger, ILoggerFactory logger,
UrlEncoder encoder, UrlEncoder encoder,
ISystemClock clock,
IConfigFileProvider config) IConfigFileProvider config)
: base(options, logger, encoder, clock) : base(options, logger, encoder)
{ {
_apiKey = config.ApiKey; _apiKey = config.ApiKey;
} }

View File

@ -20,9 +20,8 @@ namespace Sonarr.Http.Authentication
public BasicAuthenticationHandler(IAuthenticationService authService, public BasicAuthenticationHandler(IAuthenticationService authService,
IOptionsMonitor<AuthenticationSchemeOptions> options, IOptionsMonitor<AuthenticationSchemeOptions> options,
ILoggerFactory logger, ILoggerFactory logger,
UrlEncoder encoder, UrlEncoder encoder)
ISystemClock clock) : base(options, logger, encoder)
: base(options, logger, encoder, clock)
{ {
_authService = authService; _authService = authService;
} }
@ -71,7 +70,7 @@ namespace Sonarr.Http.Authentication
protected override Task HandleChallengeAsync(AuthenticationProperties properties) protected override Task HandleChallengeAsync(AuthenticationProperties properties)
{ {
Response.Headers.Add("WWW-Authenticate", $"Basic realm=\"{BuildInfo.AppName}\""); Response.Headers["WWW-Authenticate"] = $"Basic realm=\"{BuildInfo.AppName}\"";
Response.StatusCode = 401; Response.StatusCode = 401;
return Task.CompletedTask; return Task.CompletedTask;
} }

View File

@ -13,9 +13,8 @@ namespace Sonarr.Http.Authentication
{ {
public NoAuthenticationHandler(IOptionsMonitor<AuthenticationSchemeOptions> options, public NoAuthenticationHandler(IOptionsMonitor<AuthenticationSchemeOptions> options,
ILoggerFactory logger, ILoggerFactory logger,
UrlEncoder encoder, UrlEncoder encoder)
ISystemClock clock) : base(options, logger, encoder)
: base(options, logger, encoder, clock)
{ {
} }

View File

@ -22,7 +22,7 @@ namespace Sonarr.Http.Middleware
{ {
if (context.Request.IsApiRequest() && !context.Response.Headers.ContainsKey(VERSIONHEADER)) if (context.Request.IsApiRequest() && !context.Response.Headers.ContainsKey(VERSIONHEADER))
{ {
context.Response.Headers.Add(VERSIONHEADER, _version); context.Response.Headers[VERSIONHEADER] = _version;
} }
await _next(context); await _next(context);

View File

@ -102,7 +102,7 @@ namespace Sonarr.Http.REST
if (controllerAttributes.Any(x => x.AttributeType == DEPRECATED_ATTRIBUTE) || attributes.Any(x => x.AttributeType == DEPRECATED_ATTRIBUTE)) if (controllerAttributes.Any(x => x.AttributeType == DEPRECATED_ATTRIBUTE) || attributes.Any(x => x.AttributeType == DEPRECATED_ATTRIBUTE))
{ {
_logger.Warn("API call made to deprecated endpoint from {0}", Request.Headers.UserAgent.ToString()); _logger.Warn("API call made to deprecated endpoint from {0}", Request.Headers.UserAgent.ToString());
Response.Headers.Add("Deprecation", "true"); Response.Headers["Deprecation"] = "true";
} }
base.OnActionExecuting(context); base.OnActionExecuting(context);

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks> <TargetFrameworks>net8.0</TargetFrameworks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="FluentValidation" Version="9.5.4" /> <PackageReference Include="FluentValidation" Version="9.5.4" />

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks> <TargetFrameworks>net8.0</TargetFrameworks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Lib.Harmony" Version="2.0.1" /> <PackageReference Include="Lib.Harmony" Version="2.0.1" />