From ca80b2f270bf469a0b3b4257f91cfb0e5d4140d9 Mon Sep 17 00:00:00 2001 From: Xavier Date: Mon, 20 Nov 2023 14:34:27 -0800 Subject: [PATCH 01/17] Suppress CA1825 --- .editorconfig | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index fe5a4a9e..8c17a132 100644 --- a/.editorconfig +++ b/.editorconfig @@ -180,4 +180,8 @@ dotnet_naming_style.test_methods.word_separator = _ dotnet_naming_rule.test_methods.style = test_methods dotnet_naming_rule.test_methods.symbols = test_methods -dotnet_naming_rule.test_methods.severity = error \ No newline at end of file +dotnet_naming_rule.test_methods.severity = error + +# https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1825 +[*.{cs,vb}] +dotnet_diagnostic.CA1825.severity = none \ No newline at end of file From 88743dd0915d32856e0ef1d59f74c0cbb84b74e0 Mon Sep 17 00:00:00 2001 From: Xavier Date: Mon, 20 Nov 2023 16:22:34 -0800 Subject: [PATCH 02/17] controller.RouteValues.TryGetValue --- .../ApiVersioningApplicationModelProvider.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/ApiVersioningApplicationModelProvider.cs b/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/ApiVersioningApplicationModelProvider.cs index ed1e996b..cda16298 100644 --- a/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/ApiVersioningApplicationModelProvider.cs +++ b/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/ApiVersioningApplicationModelProvider.cs @@ -80,8 +80,14 @@ public virtual void OnProvidersExecuting( ApplicationModelProviderContext contex for ( var i = 0; i < controllers.Count; i++ ) { var controller = controllers[i]; - - controller.ControllerName = NamingConvention.NormalizeName( controller.ControllerName ); + if ( controller.RouteValues.TryGetValue( "controller", out var name ) ) + { + controller.ControllerName = name!; + } + else + { + controller.ControllerName = NamingConvention.NormalizeName( controller.ControllerName ); + } if ( !ConventionBuilder.ApplyTo( controller ) ) { From 1b446567c73eca6bc187a44fd0a073f8796d4d5d Mon Sep 17 00:00:00 2001 From: Xavier Date: Mon, 20 Nov 2023 16:42:10 -0800 Subject: [PATCH 03/17] Update version and release notes. --- .../WebApi/src/Asp.Versioning.Mvc/Asp.Versioning.Mvc.csproj | 4 ++-- src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/ReleaseNotes.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/Asp.Versioning.Mvc.csproj b/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/Asp.Versioning.Mvc.csproj index 8ad4d30d..16117444 100644 --- a/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/Asp.Versioning.Mvc.csproj +++ b/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/Asp.Versioning.Mvc.csproj @@ -1,8 +1,8 @@  - 6.4.0 - 6.4.0.0 + 6.4.1 + 6.4.1.0 net6.0;netcoreapp3.1 Asp.Versioning ASP.NET Core API Versioning diff --git a/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/ReleaseNotes.txt b/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/ReleaseNotes.txt index 5f282702..2c16c58e 100644 --- a/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/ReleaseNotes.txt +++ b/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/ReleaseNotes.txt @@ -1 +1 @@ - \ No newline at end of file +If Controller Attribute is set, use it for the controller name. \ No newline at end of file From 045ffd6572302d20cb71e5f91a69af8bc78db061 Mon Sep 17 00:00:00 2001 From: Xavier Date: Mon, 20 Nov 2023 16:46:57 -0800 Subject: [PATCH 04/17] VersionPrefix --- .../WebApi/src/Asp.Versioning.Mvc/Asp.Versioning.Mvc.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/Asp.Versioning.Mvc.csproj b/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/Asp.Versioning.Mvc.csproj index 16117444..fc73900a 100644 --- a/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/Asp.Versioning.Mvc.csproj +++ b/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/Asp.Versioning.Mvc.csproj @@ -2,7 +2,7 @@ 6.4.1 - 6.4.1.0 + 6.4.0.0 net6.0;netcoreapp3.1 Asp.Versioning ASP.NET Core API Versioning From 57629e197788f3cc83ea26fb86c4db00d22c3ea6 Mon Sep 17 00:00:00 2001 From: Xavier Date: Mon, 20 Nov 2023 16:49:05 -0800 Subject: [PATCH 05/17] Update release note. --- src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/ReleaseNotes.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/ReleaseNotes.txt b/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/ReleaseNotes.txt index 2c16c58e..525fc7a3 100644 --- a/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/ReleaseNotes.txt +++ b/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/ReleaseNotes.txt @@ -1 +1 @@ -If Controller Attribute is set, use it for the controller name. \ No newline at end of file +If Controller Attribute is set, use it for the controller name ([#1033](https://github.com/dotnet/aspnet-api-versioning/issues/1033)) \ No newline at end of file From 8fe6861ccfe591ca0114d9af375ccf82dc20ad40 Mon Sep 17 00:00:00 2001 From: Xavier Date: Mon, 20 Nov 2023 17:18:39 -0800 Subject: [PATCH 06/17] Setup .net for code ql --- .github/workflows/codeql-analysis.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 1887dfdc..b732a4c6 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -27,6 +27,11 @@ jobs: queries: security-and-quality languages: csharp + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 6.0.x + # build a temporary *.slnf file that only contains source projects and put it in ~/obj # so that it is not tracked by git. then run 'dotnet build' using the *.slnf, which # will preserve the dependency order and configuration of the *.sln From 30af9a7a4df4a6d482bfa6458eecc76db789c810 Mon Sep 17 00:00:00 2001 From: Xavier Date: Mon, 20 Nov 2023 17:28:18 -0800 Subject: [PATCH 07/17] Setup .NET 3.1 --- .github/workflows/codeql-analysis.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index b732a4c6..2d64c7ff 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -27,7 +27,12 @@ jobs: queries: security-and-quality languages: csharp - - name: Setup .NET + - name: Setup .NET 3.1 + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 3.1.x + + - name: Setup .NET 6.0 uses: actions/setup-dotnet@v3 with: dotnet-version: 6.0.x From db6af2f0afd04b4d371df4f7ab1743c3264f282c Mon Sep 17 00:00:00 2001 From: Xavier Date: Mon, 20 Nov 2023 17:31:03 -0800 Subject: [PATCH 08/17] Update Codeql --- .github/workflows/codeql-analysis.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 2d64c7ff..4bd152c9 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -21,12 +21,6 @@ jobs: - name: Checkout Repository uses: actions/checkout@v2 - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - queries: security-and-quality - languages: csharp - - name: Setup .NET 3.1 uses: actions/setup-dotnet@v3 with: @@ -37,6 +31,12 @@ jobs: with: dotnet-version: 6.0.x + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + queries: security-and-quality + languages: csharp + # build a temporary *.slnf file that only contains source projects and put it in ~/obj # so that it is not tracked by git. then run 'dotnet build' using the *.slnf, which # will preserve the dependency order and configuration of the *.sln From 6d33909c3d96f40d26dc8eeac23f1743dadafccf Mon Sep 17 00:00:00 2001 From: Xavier Date: Mon, 20 Nov 2023 17:38:26 -0800 Subject: [PATCH 09/17] Update code ql --- .github/workflows/codeql-analysis.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 1887dfdc..4bd152c9 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -21,6 +21,16 @@ jobs: - name: Checkout Repository uses: actions/checkout@v2 + - name: Setup .NET 3.1 + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 3.1.x + + - name: Setup .NET 6.0 + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 6.0.x + - name: Initialize CodeQL uses: github/codeql-action/init@v2 with: From 64c7d4fc58a9a92af22aed707460d633d54b3171 Mon Sep 17 00:00:00 2001 From: Xavier Date: Mon, 20 Nov 2023 17:44:42 -0800 Subject: [PATCH 10/17] Touch. --- .github/workflows/codeql-analysis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 4bd152c9..3dbec6ec 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -21,12 +21,12 @@ jobs: - name: Checkout Repository uses: actions/checkout@v2 - - name: Setup .NET 3.1 + - name: Setup .NET 3.1 SDK uses: actions/setup-dotnet@v3 with: dotnet-version: 3.1.x - - name: Setup .NET 6.0 + - name: Setup .NET 6.0 SDK uses: actions/setup-dotnet@v3 with: dotnet-version: 6.0.x From 92849d5644e93b128e7ebaa35fe80af6e7d7a720 Mon Sep 17 00:00:00 2001 From: Xavier Date: Mon, 20 Nov 2023 18:12:52 -0800 Subject: [PATCH 11/17] Setup .NET 6.0 SDK --- .github/workflows/codeql-analysis.yml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 3dbec6ec..349f81f3 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -21,22 +21,17 @@ jobs: - name: Checkout Repository uses: actions/checkout@v2 - - name: Setup .NET 3.1 SDK - uses: actions/setup-dotnet@v3 + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 with: - dotnet-version: 3.1.x + queries: security-and-quality + languages: csharp - name: Setup .NET 6.0 SDK uses: actions/setup-dotnet@v3 with: dotnet-version: 6.0.x - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - queries: security-and-quality - languages: csharp - # build a temporary *.slnf file that only contains source projects and put it in ~/obj # so that it is not tracked by git. then run 'dotnet build' using the *.slnf, which # will preserve the dependency order and configuration of the *.sln From 41f73d9e80b19aecda1a298bb89d25ff6502f968 Mon Sep 17 00:00:00 2001 From: Xavier Date: Mon, 20 Nov 2023 18:27:23 -0800 Subject: [PATCH 12/17] add global.json --- .gitignore | 1 - global.json | 9 +++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 global.json diff --git a/.gitignore b/.gitignore index 2b3d0141..f4ef69c4 100644 --- a/.gitignore +++ b/.gitignore @@ -37,7 +37,6 @@ x86/ # .NET CLI project.lock.json artifacts/ -global.json # Visual Studio profiler *.psess diff --git a/global.json b/global.json new file mode 100644 index 00000000..de03e62f --- /dev/null +++ b/global.json @@ -0,0 +1,9 @@ +{ + "sdk": { + "version": "6.0.417", + "rollForward": "latestFeature" + }, + "msbuild-sdks": { + "Microsoft.Build.Traversal": "4.1.00" + } +} \ No newline at end of file From c7773695e13004abb7ec4c59f3e212f14fc2ac4d Mon Sep 17 00:00:00 2001 From: Xavier Date: Tue, 21 Nov 2023 14:30:37 -0800 Subject: [PATCH 13/17] Add Setup .NET 3.1 SDK --- .github/workflows/codeql-analysis.yml | 5 +++++ global.json | 9 --------- 2 files changed, 5 insertions(+), 9 deletions(-) delete mode 100644 global.json diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 349f81f3..06cd8f9b 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -27,6 +27,11 @@ jobs: queries: security-and-quality languages: csharp + - name: Setup .NET 3.1 SDK + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 3.1.x + - name: Setup .NET 6.0 SDK uses: actions/setup-dotnet@v3 with: diff --git a/global.json b/global.json deleted file mode 100644 index de03e62f..00000000 --- a/global.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "sdk": { - "version": "6.0.417", - "rollForward": "latestFeature" - }, - "msbuild-sdks": { - "Microsoft.Build.Traversal": "4.1.00" - } -} \ No newline at end of file From dc8deb18462472e77135abe6a8f32726c24d35ed Mon Sep 17 00:00:00 2001 From: Xavier Date: Tue, 21 Nov 2023 14:53:19 -0800 Subject: [PATCH 14/17] Setup dotnet --- .github/workflows/codeql-analysis.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 06cd8f9b..bfe99508 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -27,15 +27,12 @@ jobs: queries: security-and-quality languages: csharp - - name: Setup .NET 3.1 SDK + - name: Setup dotnet uses: actions/setup-dotnet@v3 with: - dotnet-version: 3.1.x - - - name: Setup .NET 6.0 SDK - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 6.0.x + dotnet-version: | + 3.1.x + 6.0.x # build a temporary *.slnf file that only contains source projects and put it in ~/obj # so that it is not tracked by git. then run 'dotnet build' using the *.slnf, which From d9c8043b64cdc98e2462f42d880a95218f3833c9 Mon Sep 17 00:00:00 2001 From: Xavier Date: Tue, 21 Nov 2023 15:18:12 -0800 Subject: [PATCH 15/17] Create temporary global.json --- .github/workflows/codeql-analysis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index bfe99508..5301a11c 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -29,10 +29,14 @@ jobs: - name: Setup dotnet uses: actions/setup-dotnet@v3 + id: installdotnet with: dotnet-version: | 3.1.x 6.0.x + + - name: Create temporary global.json + run: echo '{"sdk":{"version":"${{ steps.installdotnet.outputs.dotnet-version }}"}}' > ./global.json # build a temporary *.slnf file that only contains source projects and put it in ~/obj # so that it is not tracked by git. then run 'dotnet build' using the *.slnf, which From e1569d26f310a406905ab11f68a8d8a3d579e7d8 Mon Sep 17 00:00:00 2001 From: Xavier Date: Tue, 21 Nov 2023 15:26:05 -0800 Subject: [PATCH 16/17] revert gitignore. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index f4ef69c4..2b3d0141 100644 --- a/.gitignore +++ b/.gitignore @@ -37,6 +37,7 @@ x86/ # .NET CLI project.lock.json artifacts/ +global.json # Visual Studio profiler *.psess From c2bbf94b74f0d3009d5888aad2df3c29866c39bb Mon Sep 17 00:00:00 2001 From: Xavier Date: Tue, 21 Nov 2023 15:51:52 -0800 Subject: [PATCH 17/17] Remove bad merge. --- .github/workflows/codeql-analysis.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index cc399873..5301a11c 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -21,16 +21,6 @@ jobs: - name: Checkout Repository uses: actions/checkout@v2 - - name: Setup .NET 3.1 - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 3.1.x - - - name: Setup .NET 6.0 - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 6.0.x - - name: Initialize CodeQL uses: github/codeql-action/init@v2 with: