Skip to content

Commit

Permalink
Upgrade to .NET 8 (#492)
Browse files Browse the repository at this point in the history
* Upgrade to .NET 8

* Fix NSwag build errors

* Remove call to obsolete base constructor

* Set LangVersion to 12.0

* Update Pomelo.EntityFrameworkCore.MySql

* Update NuGet dependencies

* Update client version
  • Loading branch information
NoahStolk authored Jan 12, 2024
1 parent b9e3e02 commit 1addeb6
Show file tree
Hide file tree
Showing 21 changed files with 34 additions and 120 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- name: Set up dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.0.401'
dotnet-version: '8.0.100'
include-prerelease: false
- name: Checkout
uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- name: Set up dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.0.401'
dotnet-version: '8.0.100'
include-prerelease: false
- name: Checkout
uses: actions/checkout@v2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

<PropertyGroup>
<Version>5.7.8.0</Version>
<Version>5.7.9.0</Version>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<IntermediateOutputPath>obj</IntermediateOutputPath>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using DevilDaggersInfo.Web.Server.Domain.Exceptions;
using System.Net;
using System.Runtime.Serialization;

namespace DevilDaggersInfo.Web.Server.Domain.Admin.Exceptions;

[Serializable]
public class AdminDomainException : StatusCodeException
{
public AdminDomainException()
Expand All @@ -21,10 +19,5 @@ public AdminDomainException(string? message, Exception? innerException)
{
}

protected AdminDomainException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}

public override HttpStatusCode StatusCode => HttpStatusCode.BadRequest;
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using System.Net;
using System.Runtime.Serialization;

namespace DevilDaggersInfo.Web.Server.Domain.Exceptions;

[Serializable]
public class BadRequestException : StatusCodeException
{
public BadRequestException()
Expand All @@ -20,10 +18,5 @@ public BadRequestException(string? message, Exception? innerException)
{
}

protected BadRequestException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}

public override HttpStatusCode StatusCode => HttpStatusCode.BadRequest;
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using System.Net;
using System.Runtime.Serialization;

namespace DevilDaggersInfo.Web.Server.Domain.Exceptions;

[Serializable]
public class CustomEntryValidationException : StatusCodeException
{
public CustomEntryValidationException()
Expand All @@ -20,10 +18,5 @@ public CustomEntryValidationException(string? message, Exception? innerException
{
}

protected CustomEntryValidationException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}

public override HttpStatusCode StatusCode => HttpStatusCode.BadRequest;
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using System.Net;
using System.Runtime.Serialization;

namespace DevilDaggersInfo.Web.Server.Domain.Exceptions;

[Serializable]
public class CustomLeaderboardValidationException : StatusCodeException
{
public CustomLeaderboardValidationException()
Expand All @@ -20,10 +18,5 @@ public CustomLeaderboardValidationException(string? message, Exception? innerExc
{
}

protected CustomLeaderboardValidationException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}

public override HttpStatusCode StatusCode => HttpStatusCode.BadRequest;
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using System.Net;
using System.Runtime.Serialization;

namespace DevilDaggersInfo.Web.Server.Domain.Exceptions;

[Serializable]
public class DdLeaderboardException : StatusCodeException
{
public DdLeaderboardException()
Expand All @@ -20,10 +18,5 @@ public DdLeaderboardException(string? message, Exception? innerException)
{
}

protected DdLeaderboardException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}

public override HttpStatusCode StatusCode => HttpStatusCode.BadRequest;
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using System.Net;
using System.Runtime.Serialization;

namespace DevilDaggersInfo.Web.Server.Domain.Exceptions;

[Serializable]
public class ForbiddenException : StatusCodeException
{
public ForbiddenException()
Expand All @@ -20,10 +18,5 @@ public ForbiddenException(string? message, Exception? innerException)
{
}

protected ForbiddenException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}

public override HttpStatusCode StatusCode => HttpStatusCode.Forbidden;
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using System.Net;
using System.Runtime.Serialization;

namespace DevilDaggersInfo.Web.Server.Domain.Exceptions;

[Serializable]
public class InvalidModArchiveException : StatusCodeException
{
public InvalidModArchiveException()
Expand All @@ -20,10 +18,5 @@ public InvalidModArchiveException(string? message, Exception? innerException)
{
}

protected InvalidModArchiveException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}

public override HttpStatusCode StatusCode => HttpStatusCode.BadRequest;
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using System.Net;
using System.Runtime.Serialization;

namespace DevilDaggersInfo.Web.Server.Domain.Exceptions;

[Serializable]
public class InvalidProfileRequestException : StatusCodeException
{
public InvalidProfileRequestException()
Expand All @@ -20,10 +18,5 @@ public InvalidProfileRequestException(string? message, Exception? innerException
{
}

protected InvalidProfileRequestException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}

public override HttpStatusCode StatusCode => HttpStatusCode.BadRequest;
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using System.Net;
using System.Runtime.Serialization;

namespace DevilDaggersInfo.Web.Server.Domain.Exceptions;

[Serializable]
public class NotFoundException : StatusCodeException
{
public NotFoundException()
Expand All @@ -20,10 +18,5 @@ public NotFoundException(string? message, Exception? innerException)
{
}

protected NotFoundException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}

public override HttpStatusCode StatusCode => HttpStatusCode.NotFound;
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using System.Net;
using System.Runtime.Serialization;

namespace DevilDaggersInfo.Web.Server.Domain.Exceptions;

[Serializable]
public abstract class StatusCodeException : Exception
{
protected StatusCodeException()
Expand All @@ -20,10 +18,5 @@ protected StatusCodeException(string? message, Exception? innerException)
{
}

protected StatusCodeException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}

public abstract HttpStatusCode StatusCode { get; }
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using System.Net;
using System.Runtime.Serialization;

namespace DevilDaggersInfo.Web.Server.Domain.Exceptions;

[Serializable]
public class UnauthorizedException : StatusCodeException
{
public UnauthorizedException()
Expand All @@ -20,10 +18,5 @@ public UnauthorizedException(string? message, Exception? innerException)
{
}

protected UnauthorizedException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}

public override HttpStatusCode StatusCode => HttpStatusCode.Unauthorized;
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using System.Net;
using System.Runtime.Serialization;

namespace DevilDaggersInfo.Web.Server.Domain.Exceptions;

[Serializable]
public class UnsupportedOperatingSystemException : StatusCodeException
{
public UnsupportedOperatingSystemException()
Expand All @@ -20,10 +18,5 @@ public UnsupportedOperatingSystemException(string? message, Exception? innerExce
{
}

protected UnsupportedOperatingSystemException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}

public override HttpStatusCode StatusCode => HttpStatusCode.BadRequest;
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
using DevilDaggersInfo.Web.Server.Domain.Entities;
using DevilDaggersInfo.Web.Server.Domain.Entities.Enums;
using DevilDaggersInfo.Web.Server.Domain.Exceptions;
using DevilDaggersInfo.Web.Server.Domain.Models.FileSystem;
using DevilDaggersInfo.Web.Server.Domain.Models.Tools;
using DevilDaggersInfo.Web.Server.Domain.Services.Inversion;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;

namespace DevilDaggersInfo.Web.Server.Domain.Repositories;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public static void AddSwaggerDocument(this WebApplicationBuilder builder, string
};
config.DocumentName = apiNamespace.ToUpper();
config.OperationProcessors.Insert(0, new ApiOperationProcessor(apiNamespace));
config.SchemaType = SchemaType.OpenApi3;
config.GenerateEnumMappingDescription = true;
config.SchemaSettings.SchemaType = SchemaType.OpenApi3;
config.SchemaSettings.GenerateEnumMappingDescription = true;
});
}
}
2 changes: 1 addition & 1 deletion src/DevilDaggersInfo.Web.Server/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@
});

app.UseOpenApi();
app.UseSwaggerUi3();
app.UseSwaggerUi();

if (!app.Environment.IsDevelopment())
{
Expand Down
4 changes: 2 additions & 2 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="Current">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<RunAnalyzersDuringBuild>false</RunAnalyzersDuringBuild>
<NoWarn>SA1633</NoWarn>
<ImplicitUsings>true</ImplicitUsings>
<InvariantGlobalization>true</InvariantGlobalization>
<WarningsAsErrors>nullable</WarningsAsErrors>
<LangVersion>11.0</LangVersion>
<LangVersion>12.0</LangVersion>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<RuntimeIdentifiers>win-x64;linux-x64</RuntimeIdentifiers>
</PropertyGroup>
Expand Down
Loading

0 comments on commit 1addeb6

Please sign in to comment.