From 9ae0e09cbe49f1d91ccf2197eb99fa5bc42ac733 Mon Sep 17 00:00:00 2001 From: Josef Dvorak Date: Tue, 9 Jan 2024 01:01:54 +1100 Subject: [PATCH 01/10] Create dotnet.yml Adds configuration file for GitHub Actions for .NET 8.0 on windows-latest. --- .github/workflows/dotnet.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/dotnet.yml diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml new file mode 100644 index 00000000..00a067a9 --- /dev/null +++ b/.github/workflows/dotnet.yml @@ -0,0 +1,28 @@ +# This workflow will build a .NET project +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net + +name: .NET + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + + runs-on: windows-latest + + steps: + - uses: actions/checkout@v3 + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 8.0.x + - name: Restore dependencies + run: dotnet restore + - name: Build + run: dotnet build --no-restore + - name: Test + run: dotnet test --no-build --verbosity normal From 5c21eb715493d424131eb921b0d2943b98a77fa1 Mon Sep 17 00:00:00 2001 From: Josef Dvorak Date: Tue, 9 Jan 2024 01:18:19 +1100 Subject: [PATCH 02/10] Change version to .NET 8.0 --- KenticoInspector.Actions/KenticoInspector.Actions.csproj | 2 +- .../KenticoInspector.Core.Tests.csproj | 2 +- KenticoInspector.Core/KenticoInspector.Core.csproj | 2 +- .../KenticoInspector.Infrastructure.Tests.csproj | 2 +- .../KenticoInspector.Infrastructure.csproj | 2 +- .../KenticoInspector.Reports.Tests.csproj | 2 +- KenticoInspector.Reports/KenticoInspector.Reports.csproj | 4 ++-- .../KenticoInspector.WebApplication.csproj | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/KenticoInspector.Actions/KenticoInspector.Actions.csproj b/KenticoInspector.Actions/KenticoInspector.Actions.csproj index cb1072d5..bca1f1bc 100644 --- a/KenticoInspector.Actions/KenticoInspector.Actions.csproj +++ b/KenticoInspector.Actions/KenticoInspector.Actions.csproj @@ -1,7 +1,7 @@  - netcoreapp2.2 + net8.0 diff --git a/KenticoInspector.Core.Tests/KenticoInspector.Core.Tests.csproj b/KenticoInspector.Core.Tests/KenticoInspector.Core.Tests.csproj index 33a955c2..f17452b6 100644 --- a/KenticoInspector.Core.Tests/KenticoInspector.Core.Tests.csproj +++ b/KenticoInspector.Core.Tests/KenticoInspector.Core.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp2.2 + net8.0 false diff --git a/KenticoInspector.Core/KenticoInspector.Core.csproj b/KenticoInspector.Core/KenticoInspector.Core.csproj index 8fae0dc1..6675160f 100644 --- a/KenticoInspector.Core/KenticoInspector.Core.csproj +++ b/KenticoInspector.Core/KenticoInspector.Core.csproj @@ -1,7 +1,7 @@ - netcoreapp2.2 + net8.0 7.1 diff --git a/KenticoInspector.Infrastructure.Tests/KenticoInspector.Infrastructure.Tests.csproj b/KenticoInspector.Infrastructure.Tests/KenticoInspector.Infrastructure.Tests.csproj index 95c497d4..98b87bd5 100644 --- a/KenticoInspector.Infrastructure.Tests/KenticoInspector.Infrastructure.Tests.csproj +++ b/KenticoInspector.Infrastructure.Tests/KenticoInspector.Infrastructure.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp2.2 + net8.0 false diff --git a/KenticoInspector.Infrastructure/KenticoInspector.Infrastructure.csproj b/KenticoInspector.Infrastructure/KenticoInspector.Infrastructure.csproj index 4253e5dc..4034d81f 100644 --- a/KenticoInspector.Infrastructure/KenticoInspector.Infrastructure.csproj +++ b/KenticoInspector.Infrastructure/KenticoInspector.Infrastructure.csproj @@ -1,7 +1,7 @@  - netcoreapp2.2 + net8.0 7.1 diff --git a/KenticoInspector.Reports.Tests/KenticoInspector.Reports.Tests.csproj b/KenticoInspector.Reports.Tests/KenticoInspector.Reports.Tests.csproj index 4303f4ec..6b8f615c 100644 --- a/KenticoInspector.Reports.Tests/KenticoInspector.Reports.Tests.csproj +++ b/KenticoInspector.Reports.Tests/KenticoInspector.Reports.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp2.2 + net8.0 false diff --git a/KenticoInspector.Reports/KenticoInspector.Reports.csproj b/KenticoInspector.Reports/KenticoInspector.Reports.csproj index 5e25c3f1..f87a1152 100644 --- a/KenticoInspector.Reports/KenticoInspector.Reports.csproj +++ b/KenticoInspector.Reports/KenticoInspector.Reports.csproj @@ -1,7 +1,7 @@ - + - netcoreapp2.2 + net8.0 7.1 diff --git a/KenticoInspector.WebApplication/KenticoInspector.WebApplication.csproj b/KenticoInspector.WebApplication/KenticoInspector.WebApplication.csproj index e6fead5b..101ad8b0 100644 --- a/KenticoInspector.WebApplication/KenticoInspector.WebApplication.csproj +++ b/KenticoInspector.WebApplication/KenticoInspector.WebApplication.csproj @@ -1,7 +1,7 @@  - netcoreapp2.2 + net8.0 InProcess 7.1 From 695a0f53215d00ed260fe25658d4479d4357e9d7 Mon Sep 17 00:00:00 2001 From: Josef Dvorak Date: Mon, 15 Jan 2024 12:24:15 +1100 Subject: [PATCH 03/10] upgrade Autofac 7.1.0 --- KenticoInspector.Actions/KenticoInspector.Actions.csproj | 2 +- KenticoInspector.Core/KenticoInspector.Core.csproj | 2 +- .../KenticoInspector.Infrastructure.csproj | 2 +- KenticoInspector.Reports/KenticoInspector.Reports.csproj | 2 +- .../KenticoInspector.WebApplication.csproj | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/KenticoInspector.Actions/KenticoInspector.Actions.csproj b/KenticoInspector.Actions/KenticoInspector.Actions.csproj index bca1f1bc..a428eda0 100644 --- a/KenticoInspector.Actions/KenticoInspector.Actions.csproj +++ b/KenticoInspector.Actions/KenticoInspector.Actions.csproj @@ -5,7 +5,7 @@ - + diff --git a/KenticoInspector.Core/KenticoInspector.Core.csproj b/KenticoInspector.Core/KenticoInspector.Core.csproj index 6675160f..395a6b24 100644 --- a/KenticoInspector.Core/KenticoInspector.Core.csproj +++ b/KenticoInspector.Core/KenticoInspector.Core.csproj @@ -11,7 +11,7 @@ - + diff --git a/KenticoInspector.Infrastructure/KenticoInspector.Infrastructure.csproj b/KenticoInspector.Infrastructure/KenticoInspector.Infrastructure.csproj index 4034d81f..5e843e92 100644 --- a/KenticoInspector.Infrastructure/KenticoInspector.Infrastructure.csproj +++ b/KenticoInspector.Infrastructure/KenticoInspector.Infrastructure.csproj @@ -11,7 +11,7 @@ - + diff --git a/KenticoInspector.Reports/KenticoInspector.Reports.csproj b/KenticoInspector.Reports/KenticoInspector.Reports.csproj index f87a1152..cc712f5e 100644 --- a/KenticoInspector.Reports/KenticoInspector.Reports.csproj +++ b/KenticoInspector.Reports/KenticoInspector.Reports.csproj @@ -11,7 +11,7 @@ - + diff --git a/KenticoInspector.WebApplication/KenticoInspector.WebApplication.csproj b/KenticoInspector.WebApplication/KenticoInspector.WebApplication.csproj index 101ad8b0..647519f6 100644 --- a/KenticoInspector.WebApplication/KenticoInspector.WebApplication.csproj +++ b/KenticoInspector.WebApplication/KenticoInspector.WebApplication.csproj @@ -13,8 +13,8 @@ - - + + From 4549b8269515e925f55e7b3891f9f7b2edabfe76 Mon Sep 17 00:00:00 2001 From: Josef Dvorak Date: Mon, 15 Jan 2024 12:25:30 +1100 Subject: [PATCH 04/10] upgrade SqlClient 4.8.6 --- KenticoInspector.Core/KenticoInspector.Core.csproj | 2 +- .../KenticoInspector.Infrastructure.csproj | 2 +- .../KenticoInspector.WebApplication.csproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/KenticoInspector.Core/KenticoInspector.Core.csproj b/KenticoInspector.Core/KenticoInspector.Core.csproj index 395a6b24..3602d4d0 100644 --- a/KenticoInspector.Core/KenticoInspector.Core.csproj +++ b/KenticoInspector.Core/KenticoInspector.Core.csproj @@ -13,7 +13,7 @@ - + diff --git a/KenticoInspector.Infrastructure/KenticoInspector.Infrastructure.csproj b/KenticoInspector.Infrastructure/KenticoInspector.Infrastructure.csproj index 5e843e92..cc512d6c 100644 --- a/KenticoInspector.Infrastructure/KenticoInspector.Infrastructure.csproj +++ b/KenticoInspector.Infrastructure/KenticoInspector.Infrastructure.csproj @@ -15,7 +15,7 @@ - + diff --git a/KenticoInspector.WebApplication/KenticoInspector.WebApplication.csproj b/KenticoInspector.WebApplication/KenticoInspector.WebApplication.csproj index 647519f6..f3a15039 100644 --- a/KenticoInspector.WebApplication/KenticoInspector.WebApplication.csproj +++ b/KenticoInspector.WebApplication/KenticoInspector.WebApplication.csproj @@ -18,7 +18,7 @@ - + From 730edfab1e9f158deb2f38c7326c85df5205ba5b Mon Sep 17 00:00:00 2001 From: Josef Dvorak Date: Mon, 15 Jan 2024 12:33:34 +1100 Subject: [PATCH 05/10] fix file encoding --- KenticoInspector.Core/KenticoInspector.Core.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KenticoInspector.Core/KenticoInspector.Core.csproj b/KenticoInspector.Core/KenticoInspector.Core.csproj index 3602d4d0..c323158c 100644 --- a/KenticoInspector.Core/KenticoInspector.Core.csproj +++ b/KenticoInspector.Core/KenticoInspector.Core.csproj @@ -1,4 +1,4 @@ - + net8.0 From 69533bea9936e287222e6f2eacf9a036cedce68d Mon Sep 17 00:00:00 2001 From: Josef Dvorak Date: Mon, 15 Jan 2024 12:35:31 +1100 Subject: [PATCH 06/10] fix JSON serialization The serialization logic has changed in .NET 8 and the code needs to implement converters for complex type, such as System.Version. --- .../Converters/VersionListConverter.cs | 28 +++++++++++++++++++ .../Converters/VersionObjectConverter.cs | 26 +++++++++++++++++ .../Models/InstanceDetails.cs | 6 +++- KenticoInspector.Core/Modules/IModule.cs | 7 +++-- .../KenticoInspector.WebApplication.csproj | 1 + KenticoInspector.WebApplication/Startup.cs | 5 ++-- 6 files changed, 67 insertions(+), 6 deletions(-) create mode 100644 KenticoInspector.Core/Converters/VersionListConverter.cs create mode 100644 KenticoInspector.Core/Converters/VersionObjectConverter.cs diff --git a/KenticoInspector.Core/Converters/VersionListConverter.cs b/KenticoInspector.Core/Converters/VersionListConverter.cs new file mode 100644 index 00000000..2982cc5f --- /dev/null +++ b/KenticoInspector.Core/Converters/VersionListConverter.cs @@ -0,0 +1,28 @@ +using Newtonsoft.Json; +using System.Collections.Generic; +using System; + +namespace KenticoInspector.Core.Converters +{ + public class VersionListConverter : JsonConverter + { + public override bool CanConvert(Type objectType) + { + return (objectType == typeof(List)); + } + + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + serializer.Converters.Add(new VersionObjectConverter()); + + serializer.Serialize(writer, value); + } + + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + serializer.Converters.Add(new VersionObjectConverter()); + + return serializer.Deserialize(reader, typeof(Version)); + } + } +} \ No newline at end of file diff --git a/KenticoInspector.Core/Converters/VersionObjectConverter.cs b/KenticoInspector.Core/Converters/VersionObjectConverter.cs new file mode 100644 index 00000000..0cad0a83 --- /dev/null +++ b/KenticoInspector.Core/Converters/VersionObjectConverter.cs @@ -0,0 +1,26 @@ +using Newtonsoft.Json.Linq; +using Newtonsoft.Json; +using System; + +namespace KenticoInspector.Core.Converters +{ + public class VersionObjectConverter : JsonConverter + { + public override void WriteJson(JsonWriter writer, Version value, JsonSerializer serializer) + { + JObject jsonVersion = new JObject + { + { "major", value.Major }, + { "minor", value.Minor }, + { "build", value.Build }, + }; + jsonVersion.WriteTo(writer); + } + + public override Version ReadJson(JsonReader reader, Type objectType, Version existingValue, bool hasExistingValue, JsonSerializer serializer) + { + JObject jsonVersion = JObject.Load(reader); + return new Version((int)jsonVersion["major"], (int)jsonVersion["minor"], (int)jsonVersion["build"]); + } + } +} \ No newline at end of file diff --git a/KenticoInspector.Core/Models/InstanceDetails.cs b/KenticoInspector.Core/Models/InstanceDetails.cs index c76f340c..eb7fffcf 100644 --- a/KenticoInspector.Core/Models/InstanceDetails.cs +++ b/KenticoInspector.Core/Models/InstanceDetails.cs @@ -1,4 +1,6 @@ -using System; +using KenticoInspector.Core.Converters; +using Newtonsoft.Json; +using System; using System.Collections.Generic; namespace KenticoInspector.Core.Models @@ -7,8 +9,10 @@ public class InstanceDetails { public Guid Guid { get; set; } + [JsonConverter(typeof(VersionObjectConverter))] public Version AdministrationVersion { get; set; } + [JsonConverter(typeof(VersionObjectConverter))] public Version DatabaseVersion { get; set; } public IEnumerable Sites { get; set; } diff --git a/KenticoInspector.Core/Modules/IModule.cs b/KenticoInspector.Core/Modules/IModule.cs index 740d316b..74d31df2 100644 --- a/KenticoInspector.Core/Modules/IModule.cs +++ b/KenticoInspector.Core/Modules/IModule.cs @@ -1,7 +1,8 @@ -using System; +using Newtonsoft.Json; +using System; using System.Collections.Generic; -using KenticoInspector.Core.Models; +using KenticoInspector.Core.Converters; namespace KenticoInspector.Core.Modules { @@ -9,8 +10,10 @@ public interface IModule { string Codename { get; } + [JsonConverter(typeof(VersionListConverter))] IList CompatibleVersions { get; } + [JsonConverter(typeof(VersionListConverter))] IList IncompatibleVersions { get; } IList Tags { get; } diff --git a/KenticoInspector.WebApplication/KenticoInspector.WebApplication.csproj b/KenticoInspector.WebApplication/KenticoInspector.WebApplication.csproj index f3a15039..540ea404 100644 --- a/KenticoInspector.WebApplication/KenticoInspector.WebApplication.csproj +++ b/KenticoInspector.WebApplication/KenticoInspector.WebApplication.csproj @@ -16,6 +16,7 @@ + diff --git a/KenticoInspector.WebApplication/Startup.cs b/KenticoInspector.WebApplication/Startup.cs index 7afe9003..37f7dd22 100644 --- a/KenticoInspector.WebApplication/Startup.cs +++ b/KenticoInspector.WebApplication/Startup.cs @@ -7,10 +7,8 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; - using System; namespace KenticoInspector.WebApplication @@ -26,7 +24,8 @@ public Startup(IConfiguration configuration) public IServiceProvider ConfigureServices(IServiceCollection services) { - services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); + services.AddMvc(options => options.EnableEndpointRouting = false) + .AddNewtonsoftJson(options => options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore); services.AddSpaStaticFiles(configuration => { From 14a5ffd218fd8e1519eacede278fc3b8b0d433d8 Mon Sep 17 00:00:00 2001 From: Josef Dvorak Date: Mon, 15 Jan 2024 14:27:46 +1100 Subject: [PATCH 07/10] update readme.md version compatibility --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d252dd23..a96efab1 100644 --- a/README.md +++ b/README.md @@ -42,9 +42,9 @@ If anything feels wrong or incomplete, please let us know. Create a new [issue]( All versions below are from a known working environment. Lower versions may work but are not tested. - [Visual Studio 2017 updated to 15.9.11 or later](https://visualstudio.microsoft.com/vs/) -- [.NET Core 2.2 SDK](https://dotnet.microsoft.com/download/dotnet-core/2.2) -- [Node for Windows (10.15.X+)](https://nodejs.org/en/) -- [NPM (6.4.X+) (included with Node)](https://www.npmjs.com/) +- [.NET Core 8.0 SDK](https://dotnet.microsoft.com/download/dotnet/8.0) +- [Node for Windows (10.15.X - 20.7.0)](https://nodejs.org/en/) +- [NPM (6.4.X - 10.1.0) (included with Node)](https://www.npmjs.com/) - [Vue CLI (3.x)](https://cli.vuejs.org/) ### First run From 42dd6e5b31c309de3ec8a6d2d89872d444231d0a Mon Sep 17 00:00:00 2001 From: Josef Dvorak Date: Mon, 15 Jan 2024 14:32:27 +1100 Subject: [PATCH 08/10] Update dotnet.yml Add specific Node version to use: 20.7.x Add front-end build step. Add manual Workflow dispatch. --- .github/workflows/dotnet.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 00a067a9..01274084 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -8,6 +8,8 @@ on: branches: [ "master" ] pull_request: branches: [ "master" ] + workflow_dispatch: + jobs: build: @@ -20,9 +22,15 @@ jobs: uses: actions/setup-dotnet@v3 with: dotnet-version: 8.0.x + node-version: 20.7.x - name: Restore dependencies run: dotnet restore - - name: Build + - name: Build front-end app + run: | + cd ./KenticoInspector.WebApplication/ClientApp + npm i + npm run build + - name: Build dotnet app run: dotnet build --no-restore - name: Test run: dotnet test --no-build --verbosity normal From 268dfaf23752dcfab4c647e9498f99a9c18b59e3 Mon Sep 17 00:00:00 2001 From: Eric Dugre Date: Tue, 16 Jan 2024 14:24:37 -0500 Subject: [PATCH 09/10] fix async controller error, target C# 9 --- .../KenticoInspector.Actions.csproj | 1 + .../KenticoInspector.Core.Tests.csproj | 4 +--- .../KenticoInspector.Core.csproj | 2 +- ...KenticoInspector.Infrastructure.Tests.csproj | 2 +- .../KenticoInspector.Infrastructure.csproj | 2 +- .../KenticoInspector.Reports.Tests.csproj | 4 +--- .../KenticoInspector.Reports.csproj | 2 +- .../Controllers/ActionsController.cs | 16 +++++++--------- .../Controllers/InstancesController.cs | 17 +++++++++-------- .../Controllers/ReportsController.cs | 10 +++++----- .../KenticoInspector.WebApplication.csproj | 2 +- KenticoInspector.WebApplication/Startup.cs | 4 +++- 12 files changed, 32 insertions(+), 34 deletions(-) diff --git a/KenticoInspector.Actions/KenticoInspector.Actions.csproj b/KenticoInspector.Actions/KenticoInspector.Actions.csproj index a428eda0..aea96db5 100644 --- a/KenticoInspector.Actions/KenticoInspector.Actions.csproj +++ b/KenticoInspector.Actions/KenticoInspector.Actions.csproj @@ -2,6 +2,7 @@ net8.0 + 9.0 diff --git a/KenticoInspector.Core.Tests/KenticoInspector.Core.Tests.csproj b/KenticoInspector.Core.Tests/KenticoInspector.Core.Tests.csproj index f17452b6..a79cc967 100644 --- a/KenticoInspector.Core.Tests/KenticoInspector.Core.Tests.csproj +++ b/KenticoInspector.Core.Tests/KenticoInspector.Core.Tests.csproj @@ -2,10 +2,8 @@ net8.0 - false - - 7.1 + 9.0 diff --git a/KenticoInspector.Core/KenticoInspector.Core.csproj b/KenticoInspector.Core/KenticoInspector.Core.csproj index c323158c..4c358d90 100644 --- a/KenticoInspector.Core/KenticoInspector.Core.csproj +++ b/KenticoInspector.Core/KenticoInspector.Core.csproj @@ -2,7 +2,7 @@ net8.0 - 7.1 + 9.0 diff --git a/KenticoInspector.Infrastructure.Tests/KenticoInspector.Infrastructure.Tests.csproj b/KenticoInspector.Infrastructure.Tests/KenticoInspector.Infrastructure.Tests.csproj index 98b87bd5..e66d4c81 100644 --- a/KenticoInspector.Infrastructure.Tests/KenticoInspector.Infrastructure.Tests.csproj +++ b/KenticoInspector.Infrastructure.Tests/KenticoInspector.Infrastructure.Tests.csproj @@ -2,7 +2,7 @@ net8.0 - + 9.0 false diff --git a/KenticoInspector.Infrastructure/KenticoInspector.Infrastructure.csproj b/KenticoInspector.Infrastructure/KenticoInspector.Infrastructure.csproj index cc512d6c..8bfc3e93 100644 --- a/KenticoInspector.Infrastructure/KenticoInspector.Infrastructure.csproj +++ b/KenticoInspector.Infrastructure/KenticoInspector.Infrastructure.csproj @@ -2,7 +2,7 @@ net8.0 - 7.1 + 9.0 diff --git a/KenticoInspector.Reports.Tests/KenticoInspector.Reports.Tests.csproj b/KenticoInspector.Reports.Tests/KenticoInspector.Reports.Tests.csproj index 6b8f615c..46f86c99 100644 --- a/KenticoInspector.Reports.Tests/KenticoInspector.Reports.Tests.csproj +++ b/KenticoInspector.Reports.Tests/KenticoInspector.Reports.Tests.csproj @@ -2,10 +2,8 @@ net8.0 - false - - 7.1 + 9.0 diff --git a/KenticoInspector.Reports/KenticoInspector.Reports.csproj b/KenticoInspector.Reports/KenticoInspector.Reports.csproj index cc712f5e..a05c2b57 100644 --- a/KenticoInspector.Reports/KenticoInspector.Reports.csproj +++ b/KenticoInspector.Reports/KenticoInspector.Reports.csproj @@ -2,7 +2,7 @@ net8.0 - 7.1 + 9.0 diff --git a/KenticoInspector.WebApplication/Controllers/ActionsController.cs b/KenticoInspector.WebApplication/Controllers/ActionsController.cs index 42f9d831..21137dc4 100644 --- a/KenticoInspector.WebApplication/Controllers/ActionsController.cs +++ b/KenticoInspector.WebApplication/Controllers/ActionsController.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.IO; using System.Text; +using System.Threading.Tasks; using KenticoInspector.Core.Models; using KenticoInspector.Core.Modules; @@ -23,20 +24,17 @@ public ActionsController(IModuleService moduleService) } [HttpGet("{instanceGuid}")] - public ActionResult> Get(Guid instanceGuid) + public Task> Get(Guid instanceGuid) { - return Ok(moduleService.GetActions(instanceGuid)); + return Task.FromResult(moduleService.GetActions(instanceGuid)); } - // POST api/values [HttpPost("{codename}/execute/{instanceGuid}")] - public ActionResult Excecute(string codename, Guid instanceGuid) + public async Task Excecute(string codename, Guid instanceGuid) { - using (StreamReader reader = new StreamReader(Request.Body, Encoding.UTF8)) - { - var optionsJson = reader.ReadToEnd(); - return moduleService.ExecuteAction(codename, instanceGuid, optionsJson); - } + using StreamReader reader = new(Request.Body, Encoding.UTF8); + var optionsJson = await reader.ReadToEndAsync(); + return moduleService.ExecuteAction(codename, instanceGuid, optionsJson); } } } \ No newline at end of file diff --git a/KenticoInspector.WebApplication/Controllers/InstancesController.cs b/KenticoInspector.WebApplication/Controllers/InstancesController.cs index a3bed60d..98bc21d1 100644 --- a/KenticoInspector.WebApplication/Controllers/InstancesController.cs +++ b/KenticoInspector.WebApplication/Controllers/InstancesController.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Threading.Tasks; using KenticoInspector.Core.Models; using KenticoInspector.Core.Services.Interfaces; @@ -21,9 +22,9 @@ public InstancesController(IInstanceService instanceService) } [HttpGet("details/{instanceGuid}")] - public ActionResult Details(Guid instanceGuid) + public Task Details(Guid instanceGuid) { - return _instanceService.GetInstanceDetails(instanceGuid); + return Task.FromResult(_instanceService.GetInstanceDetails(instanceGuid)); } [HttpDelete("{instanceGuid}")] @@ -33,22 +34,22 @@ public void Delete(Guid instanceGuid) } [HttpGet] - public ActionResult> Get() + public Task> Get() { var instances = _instanceService.GetInstances(); - return instances.ToList(); + return Task.FromResult(instances.ToList()); } [HttpGet("{instanceGuid}")] - public ActionResult Get(Guid instanceGuid) + public Task Get(Guid instanceGuid) { - return _instanceService.GetInstance(instanceGuid); + return Task.FromResult(_instanceService.GetInstance(instanceGuid)); } [HttpPost] - public Instance Post([FromBody] Instance instance) + public Task Post([FromBody] Instance instance) { - return _instanceService.UpsertInstance(instance); + return Task.FromResult(_instanceService.UpsertInstance(instance)); } } } \ No newline at end of file diff --git a/KenticoInspector.WebApplication/Controllers/ReportsController.cs b/KenticoInspector.WebApplication/Controllers/ReportsController.cs index b694cee0..df585185 100644 --- a/KenticoInspector.WebApplication/Controllers/ReportsController.cs +++ b/KenticoInspector.WebApplication/Controllers/ReportsController.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Threading.Tasks; using KenticoInspector.Core.Models; using KenticoInspector.Core.Modules; @@ -21,16 +22,15 @@ public ReportsController(IModuleService moduleService) } [HttpGet("{instanceGuid}")] - public ActionResult> Get(Guid instanceGuid) + public Task> Get(Guid instanceGuid) { - return Ok(moduleService.GetReports(instanceGuid)); + return Task.FromResult(moduleService.GetReports(instanceGuid)); } - // POST api/values [HttpGet("{codename}/results/{instanceGuid}")] - public ActionResult Get(string codename, Guid instanceGuid) + public Task Get(string codename, Guid instanceGuid) { - return moduleService.GetReportResults(codename, instanceGuid); + return Task.FromResult(moduleService.GetReportResults(codename, instanceGuid)); } } } \ No newline at end of file diff --git a/KenticoInspector.WebApplication/KenticoInspector.WebApplication.csproj b/KenticoInspector.WebApplication/KenticoInspector.WebApplication.csproj index 540ea404..a8fcb98d 100644 --- a/KenticoInspector.WebApplication/KenticoInspector.WebApplication.csproj +++ b/KenticoInspector.WebApplication/KenticoInspector.WebApplication.csproj @@ -4,7 +4,7 @@ net8.0 InProcess - 7.1 + 9.0 diff --git a/KenticoInspector.WebApplication/Startup.cs b/KenticoInspector.WebApplication/Startup.cs index 37f7dd22..373d0dfb 100644 --- a/KenticoInspector.WebApplication/Startup.cs +++ b/KenticoInspector.WebApplication/Startup.cs @@ -9,6 +9,8 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; + using System; namespace KenticoInspector.WebApplication @@ -50,7 +52,7 @@ private IServiceProvider ConfigureAutofac(IServiceCollection services) return new AutofacServiceProvider(container); } - public void Configure(IApplicationBuilder app, IHostingEnvironment env) + public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { From 597bd2219e25d4bf4bc7b30caf086a7fbf8cbb65 Mon Sep 17 00:00:00 2001 From: Eric Dugre Date: Tue, 16 Jan 2024 14:44:49 -0500 Subject: [PATCH 10/10] update Newtonsoft.Json, fix obsolete methods --- KenticoInspector.Core/Helpers/DirectoryHelper.cs | 8 ++------ KenticoInspector.Core/KenticoInspector.Core.csproj | 2 +- KenticoInspector.Core/Tokens/TokenExpressionResolver.cs | 4 ++-- .../KenticoInspector.Infrastructure.csproj | 2 +- .../KenticoInspector.WebApplication.csproj | 2 -- KenticoInspector.WebApplication/Startup.cs | 2 +- 6 files changed, 7 insertions(+), 13 deletions(-) diff --git a/KenticoInspector.Core/Helpers/DirectoryHelper.cs b/KenticoInspector.Core/Helpers/DirectoryHelper.cs index 708332f4..631038aa 100644 --- a/KenticoInspector.Core/Helpers/DirectoryHelper.cs +++ b/KenticoInspector.Core/Helpers/DirectoryHelper.cs @@ -5,18 +5,14 @@ namespace KenticoInspector.Core.Helpers { public static class DirectoryHelper { - private const string filePrefix = "file:\\"; - /// /// Gets the executing directory of the application. /// /// A string that contains the path of the executing directory, and does not end with a backslash (\). public static string GetExecutingDirectory() { - var assemblyPath = Assembly.GetExecutingAssembly().CodeBase; - var assemblyDirectory = Path.GetDirectoryName(assemblyPath); - - return assemblyDirectory.Substring(filePrefix.Length); + var assemblyPath = Assembly.GetExecutingAssembly().Location; + return Path.GetDirectoryName(assemblyPath); } } } \ No newline at end of file diff --git a/KenticoInspector.Core/KenticoInspector.Core.csproj b/KenticoInspector.Core/KenticoInspector.Core.csproj index 4c358d90..be5f6cc5 100644 --- a/KenticoInspector.Core/KenticoInspector.Core.csproj +++ b/KenticoInspector.Core/KenticoInspector.Core.csproj @@ -12,7 +12,7 @@ - + diff --git a/KenticoInspector.Core/Tokens/TokenExpressionResolver.cs b/KenticoInspector.Core/Tokens/TokenExpressionResolver.cs index 429e3fbf..f2fa0502 100644 --- a/KenticoInspector.Core/Tokens/TokenExpressionResolver.cs +++ b/KenticoInspector.Core/Tokens/TokenExpressionResolver.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; -using System.Runtime.Serialization; +using System.Runtime.CompilerServices; using System.Text.RegularExpressions; namespace KenticoInspector.Core.Tokens @@ -86,7 +86,7 @@ private static string ResolveTokenExpression(string tokenExpression, IDictionary { if (Regex.IsMatch(innerTokenExpression, pattern)) { - var expressionObject = FormatterServices.GetUninitializedObject(tokenExpressionType) as ITokenExpression; + var expressionObject = RuntimeHelpers.GetUninitializedObject(tokenExpressionType) as ITokenExpression; resolvedExpression = expressionObject.Resolve(innerTokenExpression, tokenDictionary); diff --git a/KenticoInspector.Infrastructure/KenticoInspector.Infrastructure.csproj b/KenticoInspector.Infrastructure/KenticoInspector.Infrastructure.csproj index 8bfc3e93..7b512d7f 100644 --- a/KenticoInspector.Infrastructure/KenticoInspector.Infrastructure.csproj +++ b/KenticoInspector.Infrastructure/KenticoInspector.Infrastructure.csproj @@ -14,7 +14,7 @@ - + diff --git a/KenticoInspector.WebApplication/KenticoInspector.WebApplication.csproj b/KenticoInspector.WebApplication/KenticoInspector.WebApplication.csproj index a8fcb98d..88acef50 100644 --- a/KenticoInspector.WebApplication/KenticoInspector.WebApplication.csproj +++ b/KenticoInspector.WebApplication/KenticoInspector.WebApplication.csproj @@ -15,9 +15,7 @@ - - diff --git a/KenticoInspector.WebApplication/Startup.cs b/KenticoInspector.WebApplication/Startup.cs index 373d0dfb..d1c121a3 100644 --- a/KenticoInspector.WebApplication/Startup.cs +++ b/KenticoInspector.WebApplication/Startup.cs @@ -37,7 +37,7 @@ public IServiceProvider ConfigureServices(IServiceCollection services) return ConfigureAutofac(services); } - private IServiceProvider ConfigureAutofac(IServiceCollection services) + private AutofacServiceProvider ConfigureAutofac(IServiceCollection services) { var containerBuilder = new ContainerBuilder();