Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.NET 8 Build #1052

Merged
merged 38 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
fd14771
Rename folders
commonsensesoftware Dec 5, 2023
b419731
Update .NET version for tools
commonsensesoftware Dec 5, 2023
8084c96
Update sign tool
commonsensesoftware Dec 5, 2023
1d45d6f
Update branches that trigger builds
commonsensesoftware Dec 5, 2023
8bff563
Update code analysis rules
commonsensesoftware Dec 5, 2023
4068f9a
Centralize .NET versions and make major releases easier to update
commonsensesoftware Dec 5, 2023
7c18943
Backport ThrowIfNullOrEmpty and ThrowIfNull
commonsensesoftware Dec 5, 2023
4fa8dd3
Use ThrowIfNull and ThrowIfNullOrEmpty everywhere
commonsensesoftware Dec 5, 2023
b039d93
Use collection initializers and spreads everywhere
commonsensesoftware Dec 5, 2023
1d066a6
Add [Obsolete] for deprecated APIs
commonsensesoftware Dec 5, 2023
a8b280d
Use CompositeFormat where possible
commonsensesoftware Dec 5, 2023
40cbab8
Simplify internal types with default constructors
commonsensesoftware Dec 5, 2023
6d010ef
Prefer concrete types for better performance
commonsensesoftware Dec 5, 2023
ee0baa4
Refactor with multiple Minimal API configurations
commonsensesoftware Dec 5, 2023
d47f03f
Refactor to recommended header usage
commonsensesoftware Dec 5, 2023
bf41a45
Use nameof
commonsensesoftware Dec 5, 2023
c6528f9
Correct casing
commonsensesoftware Dec 5, 2023
9719918
Avoid unnecessary initialization
commonsensesoftware Dec 5, 2023
d47fefe
Improve readability with type aliases
commonsensesoftware Dec 5, 2023
1df1dac
Refactor internals with concrete types and type aliases
commonsensesoftware Dec 5, 2023
4895d2e
Fix spelling
commonsensesoftware Dec 5, 2023
c3bddac
Bump version numbers and update release notes
commonsensesoftware Dec 5, 2023
a1a1569
Add missing /unsafe directive
commonsensesoftware Dec 5, 2023
657ea60
Avoid exceptions with TryWriteAsync vs WriteAsync
commonsensesoftware Dec 5, 2023
4390e52
Update comments
commonsensesoftware Dec 5, 2023
2d07705
Support async API version selection. Resolves #1009
commonsensesoftware Dec 6, 2023
f9ac283
Add extension method to simplify version selection without a HTTP req…
commonsensesoftware Dec 6, 2023
dd05896
Fix matched pattern for implicit type
commonsensesoftware Dec 6, 2023
19d19ef
Use frozen collections
commonsensesoftware Dec 7, 2023
e969e5c
Use default constructors
commonsensesoftware Dec 7, 2023
6d5711a
Use static lambda
commonsensesoftware Dec 7, 2023
d5978ba
Add to dictionary
commonsensesoftware Dec 7, 2023
a6e7e95
Simplify initialization
commonsensesoftware Dec 7, 2023
54e8702
Use collection initializers
commonsensesoftware Dec 7, 2023
07c7685
Use readonly
commonsensesoftware Dec 7, 2023
e2500a6
Clean up code analysis
commonsensesoftware Dec 7, 2023
3f990d8
More code analysis clean up
commonsensesoftware Dec 7, 2023
9d6769e
Update .NET SDK in CI build
commonsensesoftware Dec 7, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"sign": {
"version": "0.9.1-beta.23356.1",
"version": "0.9.1-beta.23530.1",
"commands": [
"sign"
]
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.177.0/containers/dotnet/.devcontainer/base.Dockerfile

# [Choice] .NET version: 7.0, 6.0, 5.0
ARG VARIANT="6.0"
ARG VARIANT="8.0"
FROM mcr.microsoft.com/vscode/devcontainers/dotnet
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"remoteEnv": {
"PATH": "${containerWorkspaceFolder}/.dotnet:${containerEnv:PATH}",
"DOTNET_MULTILEVEL_LOOKUP": "0",
"TARGET": "net6.0",
"TARGET": "net8.0",
"DOTNET_WATCH_SUPPRESS_LAUNCH_BROWSER": "true"
},
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
Expand Down
23 changes: 20 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ root = true
# don't use tabs for indentation
[*]
indent_style = space
vsspell_section_id = 41b65011239a40959ccaae2a4ec7044a
vsspell_ignored_words_41b65011239a40959ccaae2a4ec7044a = Accessor|app|clr|Edm|inline|middleware|Mvc|odata|Validator|Deconstruct

# code files
[*.{cs,csx,vb,vbx}]
Expand Down Expand Up @@ -88,8 +90,8 @@ csharp_space_between_method_declaration_parameter_list_parentheses = true
csharp_space_between_method_call_parameter_list_parentheses = true
csharp_space_between_parentheses = control_flow_statements, expressions

# ide code suppressions
# dotnet_diagnostic.IDE0079.severity = none
# primary construcrtors
csharp_style_prefer_primary_constructors = false:none

# style code suppressions
dotnet_diagnostic.SA1002.severity = none
Expand All @@ -110,6 +112,13 @@ dotnet_diagnostic.SA1502.severity = none
dotnet_diagnostic.SA1516.severity = none
dotnet_diagnostic.SA1600.severity = none

# TEMP: currently suppressed rules due to false positives
# REF: https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/3687
# REF: https://github.com/dotnet/aspnetcore/issues/52556
dotnet_diagnostic.SA1010.severity = none # Opening square brackets should be spaced correctly
dotnet_diagnostic.ASP0022.severity = none # Route conflict detected between route handlers
dotnet_diagnostic.ASP0023.severity = none # Route conflict detected between route handlers

# test settings

# Default severity for analyzer diagnostics with category 'Reliability'
Expand All @@ -128,6 +137,7 @@ dotnet_diagnostic.CA1707.severity = none
dotnet_diagnostic.CA1711.severity = none
dotnet_diagnostic.CA1716.severity = none
dotnet_diagnostic.CA1806.severity = none
dotnet_diagnostic.CA1861.severity = none
dotnet_diagnostic.CA2007.severity = none
dotnet_diagnostic.CA2234.severity = none
dotnet_code_quality.CA2000.excluded_symbol_names = HttpRequestMessage|HttpResponseMessage|HttpConfiguration|HttpRouteCollection|HostedHttpRouteCollection|HttpServer|HttpClient
Expand All @@ -138,6 +148,13 @@ dotnet_diagnostic.SA1300.severity = none
dotnet_diagnostic.SA1507.severity = none
dotnet_diagnostic.SA1601.severity = none

# TEMP: currently suppressed rules due to false positives
# REF: https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/3687
# REF: https://github.com/dotnet/aspnetcore/issues/52556
dotnet_diagnostic.SA1010.severity = none # Opening square brackets should be spaced correctly
dotnet_diagnostic.ASP0022.severity = none # Route conflict detected between route handlers
dotnet_diagnostic.ASP0023.severity = none # Route conflict detected between route handlers

# test methods should use all lowercase characters
dotnet_naming_symbols.test_methods.applicable_kinds = method
dotnet_naming_symbols.test_methods.applicable_accessibilities = public
Expand Down Expand Up @@ -180,4 +197,4 @@ 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
dotnet_naming_rule.test_methods.severity = error
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ updates:
# only servicing 5.x release
- package-ecosystem: "nuget"
directory: "/"
target-branch: "release/5.0"
target-branch: "release/5.1"
schedule:
interval: "monthly"
allow:
Expand All @@ -29,5 +29,5 @@ updates:
reviewers:
- "commonsensesoftware"
commit-message:
prefix: "[release/5.0] "
prefix: "[release/5.1] "
include: scope
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
uses: actions/setup-dotnet@v3
id: installdotnet
with:
dotnet-version: 7.0.x
dotnet-version: 8.0.x

- name: Create temporary global.json
run: echo '{"sdk":{"version":"${{ steps.installdotnet.outputs.dotnet-version }}"}}' > ./global.json
Expand Down
2 changes: 2 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ trigger:
branches:
include:
- main
- release/*
paths:
exclude:
- .config
Expand All @@ -16,6 +17,7 @@ trigger:

pr:
- main
- release/*

# build at least once a month so the build badge is up-to-date
schedules:
Expand Down
4 changes: 2 additions & 2 deletions build/test.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<PropertyGroup>
<FluentAssertionsVersion>6.8.0</FluentAssertionsVersion>

<!--
beware of other versions that may contain SponsorLink
REF: https://github.com/moq/moq/issues/1372
Expand All @@ -27,7 +27,7 @@
</ItemGroup>

<ItemGroup Condition=" '$(IsAspNetCore)' == 'true' ">
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="7.0.10" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="$(DotNetReleaseBasePackageVersion)" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
[RoutePrefix( "api/books" )]
public class BooksController : ApiController
{
private static readonly Book[] books = new Book[]
{
private static readonly Book[] books =
[
new() { Id = "9781847490599", Title = "Anna Karenina", Author = "Leo Tolstoy", Published = 1878 },
new() { Id = "9780198800545", Title = "War and Peace", Author = "Leo Tolstoy", Published = 1869 },
new() { Id = "9780684801520", Title = "The Great Gatsby", Author = "F. Scott Fitzgerald", Published = 1925 },
new() { Id = "9780486280615", Title = "The Adventures of Huckleberry Finn", Author = "Mark Twain", Published = 1884 },
new() { Id = "9780140430820", Title = "Moby Dick", Author = "Herman Melville", Published = 1851 },
new() { Id = "9780060934347", Title = "Don Quixote", Author = "Miguel de Cervantes", Published = 1605 },
};
];

/// <summary>
/// Gets all books.
Expand Down
10 changes: 10 additions & 0 deletions examples/AspNetCore/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<Import Project="$([MSBuild]::GetPathOfFileAbove('$(MSBuildThisFile)','$(MSBuildThisFileDirectory)../'))" />

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

</Project>
5 changes: 2 additions & 3 deletions examples/AspNetCore/OData/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<Import Project="$([MSBuild]::GetPathOfFileAbove('$(MSBuildThisFile)','$(MSBuildThisFileDirectory)../'))"
Condition="Exists($([MSBuild]::GetPathOfFileAbove('$(MSBuildThisFile)','$(MSBuildThisFileDirectory)../')))"/>
<Import Project="$([MSBuild]::GetPathOfFileAbove('$(MSBuildThisFile)','$(MSBuildThisFileDirectory)../'))" />

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OData" Version="8.0.11" />
<PackageReference Include="Microsoft.AspNetCore.OData" Version="8.2.3" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\..\src\AspNetCore\OData\src\Asp.Versioning.OData\Asp.Versioning.OData.csproj" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\..\src\AspNetCore\OData\src\Asp.Versioning.OData\Asp.Versioning.OData.csproj" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\..\src\AspNetCore\OData\src\Asp.Versioning.OData\Asp.Versioning.OData.csproj" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0-*" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0-*" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\..\src\AspNetCore\OData\src\Asp.Versioning.OData.ApiExplorer\Asp.Versioning.OData.ApiExplorer.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
[Route( "api/[controller]" )]
public class BooksController : ControllerBase
{
private static readonly Book[] books = new Book[]
{
private static readonly Book[] books =
[
new() { Id = "9781847490599", Title = "Anna Karenina", Author = "Leo Tolstoy", Published = 1878 },
new() { Id = "9780198800545", Title = "War and Peace", Author = "Leo Tolstoy", Published = 1869 },
new() { Id = "9780684801520", Title = "The Great Gatsby", Author = "F. Scott Fitzgerald", Published = 1925 },
new() { Id = "9780486280615", Title = "The Adventures of Huckleberry Finn", Author = "Mark Twain", Published = 1884 },
new() { Id = "9780140430820", Title = "Moby Dick", Author = "Herman Melville", Published = 1851 },
new() { Id = "9780060934347", Title = "Don Quixote", Author = "Miguel de Cervantes", Published = 1605 },
};
];

/// <summary>
/// Gets all books.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0-*" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0-*" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\..\src\AspNetCore\OData\src\Asp.Versioning.OData.ApiExplorer\Asp.Versioning.OData.ApiExplorer.csproj" />
</ItemGroup>

</Project>
4 changes: 0 additions & 4 deletions examples/AspNetCore/WebApi/BasicExample/BasicExample.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\..\src\AspNetCore\WebApi\src\Asp.Versioning.Mvc\Asp.Versioning.Mvc.csproj" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\..\src\AspNetCore\WebApi\src\Asp.Versioning.Mvc\Asp.Versioning.Mvc.csproj" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\..\src\AspNetCore\WebApi\src\Asp.Versioning.Mvc\Asp.Versioning.Mvc.csproj" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0-*" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0-*" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0-*" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0-*" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@ public partial class AmbiguousApiVersionException : Exception
/// <summary>
/// Initializes a new instance of the <see cref="AmbiguousApiVersionException"/> class.
/// </summary>
public AmbiguousApiVersionException() => apiVersions = Array.Empty<string>();
public AmbiguousApiVersionException() => apiVersions = [];

/// <summary>
/// Initializes a new instance of the <see cref="AmbiguousApiVersionException"/> class.
/// </summary>
/// <param name="message">The associated error message.</param>
public AmbiguousApiVersionException( string message )
: base( message ) => apiVersions = Array.Empty<string>();
: base( message ) => apiVersions = [];

/// <summary>
/// Initializes a new instance of the <see cref="AmbiguousApiVersionException"/> class.
/// </summary>
/// <param name="message">The associated error message.</param>
/// <param name="innerException">The inner <see cref="Exception">exception</see> that caused the current exception, if any.</param>
public AmbiguousApiVersionException( string message, Exception innerException )
: base( message, innerException ) => apiVersions = Array.Empty<string>();
: base( message, innerException ) => apiVersions = [];

/// <summary>
/// Initializes a new instance of the <see cref="AmbiguousApiVersionException"/> class.
Expand Down
Loading
Loading