Skip to content

Commit d3ddcb1

Browse files
committed
Upgrade to .NET 7 and C# 11
1 parent 526bebc commit d3ddcb1

34 files changed

+76
-160
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
with:
3939
dotnet-version: |
4040
3.1.x
41-
5.0.x
41+
6.0.x
4242
global-json-file: "./global.json"
4343
- name: "Dotnet Tool Restore"
4444
run: dotnet tool restore

Benchmarks/Boxed.Mapping.Benchmark/Boxed.Mapping.Benchmark.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup Label="Build">
44
<OutputType>Exe</OutputType>
5-
<TargetFrameworks>net6.0;net5.0;netcoreapp3.1</TargetFrameworks>
5+
<TargetFrameworks>net7.0;net6.0;netcoreapp3.1</TargetFrameworks>
66
<IsPackable>false</IsPackable>
77
</PropertyGroup>
88

Benchmarks/Boxed.Mapping.Benchmark/MapArrayBenchmark.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,11 @@ public void GlobalSetup()
4040
{
4141
this.mapFrom[i] = new MapFrom()
4242
{
43-
#pragma warning disable CA5394 // Do not use insecure randomness
4443
BooleanFrom = this.random.NextDouble() > 0.5D,
4544
DateTimeOffsetFrom = DateTimeOffset.UtcNow,
4645
IntegerFrom = this.random.Next(),
4746
LongFrom = this.random.Next(),
4847
StringFrom = this.random.Next().ToString(CultureInfo.InvariantCulture),
49-
#pragma warning restore CA5394 // Do not use insecure randomness
5048
};
5149
}
5250
}

Benchmarks/Boxed.Mapping.Benchmark/MapListBenchmark.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ namespace Boxed.Mapping.Benchmark;
99
using Boxed.Mapping.Benchmark.Mapping;
1010
using Boxed.Mapping.Benchmark.Models;
1111

12-
#pragma warning disable CA1002 // Do not expose generic lists
1312
[KeepBenchmarkFiles]
1413
[MemoryDiagnoser]
1514
[MinColumn]
@@ -43,13 +42,11 @@ public void GlobalSetup()
4342
this.mapFrom.Add(
4443
new MapFrom()
4544
{
46-
#pragma warning disable CA5394 // Do not use insecure randomness
4745
BooleanFrom = this.random.NextDouble() > 0.5D,
4846
DateTimeOffsetFrom = DateTimeOffset.UtcNow,
4947
IntegerFrom = this.random.Next(),
5048
LongFrom = this.random.Next(),
5149
StringFrom = this.random.Next().ToString(CultureInfo.InvariantCulture),
52-
#pragma warning restore CA5394 // Do not use insecure randomness
5350
});
5451
}
5552
}

Benchmarks/Boxed.Mapping.Benchmark/MapObjectBenchmark.cs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,24 +36,23 @@ public MapObjectBenchmark()
3636
public void GlobalSetup() =>
3737
this.mapFrom = new MapFrom()
3838
{
39-
#pragma warning disable CA5394 // Do not use insecure randomness
4039
BooleanFrom = this.random.NextDouble() > 0.5D,
4140
DateTimeOffsetFrom = DateTimeOffset.UtcNow,
4241
IntegerFrom = this.random.Next(),
4342
LongFrom = this.random.Next(),
4443
StringFrom = this.random.Next().ToString(CultureInfo.InvariantCulture),
45-
#pragma warning restore CA5394 // Do not use insecure randomness
4644
};
4745

4846
[Benchmark(Baseline = true)]
49-
public MapTo Baseline() => new()
50-
{
51-
BooleanTo = this.mapFrom.BooleanFrom,
52-
DateTimeOffsetTo = this.mapFrom.DateTimeOffsetFrom,
53-
IntegerTo = this.mapFrom.IntegerFrom,
54-
LongTo = this.mapFrom.LongFrom,
55-
StringTo = this.mapFrom.StringFrom,
56-
};
47+
public MapTo Baseline() =>
48+
new()
49+
{
50+
BooleanTo = this.mapFrom.BooleanFrom,
51+
DateTimeOffsetTo = this.mapFrom.DateTimeOffsetFrom,
52+
IntegerTo = this.mapFrom.IntegerFrom,
53+
LongTo = this.mapFrom.LongFrom,
54+
StringTo = this.mapFrom.StringFrom,
55+
};
5756

5857
[Benchmark]
5958
public MapTo BoxedMapper() => this.boilerplateMapper.Map(this.mapFrom);

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project>
22

33
<PropertyGroup Label="Build">
4-
<LangVersion>latest</LangVersion>
4+
<LangVersion>preview</LangVersion>
55
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
66
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
77
<AnalysisLevel>latest</AnalysisLevel>

Source/Boxed.AspNetCore.Swagger/Boxed.AspNetCore.Swagger.csproj

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup Label="Build">
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
55
<MinVerDefaultPreReleasePhase>preview</MinVerDefaultPreReleasePhase>
66
<MinVerTagPrefix>Boxed.AspNetCore.</MinVerTagPrefix>
77
<MinVerVerbosity>normal</MinVerVerbosity>
8+
<OpenApiGenerateDocuments>false</OpenApiGenerateDocuments>
89
</PropertyGroup>
910

1011
<PropertyGroup Label="Package">
@@ -19,10 +20,17 @@
1920
</ItemGroup>
2021

2122
<ItemGroup Label="Package References">
22-
<PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="6.0.0" />
2323
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.0.0" />
2424
</ItemGroup>
2525

26+
<ItemGroup Label="Package References (.NET 7)" Condition="'$(TargetFramework)' == 'net7.0'">
27+
<PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="7.0.0-preview.7.22376.6" />
28+
</ItemGroup>
29+
30+
<ItemGroup Label="Package References (.NET 6)" Condition="'$(TargetFramework)' == 'net6.0'">
31+
<PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="6.0.0" />
32+
</ItemGroup>
33+
2634
<ItemGroup Label="Files">
2735
<None Include="..\..\Documentation\Boxed.AspNetCore.Swagger.md" Pack="true" PackagePath="\" />
2836
</ItemGroup>

Source/Boxed.AspNetCore.Swagger/OperationFilters/ProblemDetailsOperationFilter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public class ProblemDetailsOperationFilter : IOperationFilter
3838
{
3939
["exampleProperty1"] = new OpenApiArray()
4040
{
41-
new OpenApiString("The property field is required"),
41+
new OpenApiString("The property field is required"),
4242
},
4343
},
4444
};

Source/Boxed.AspNetCore.TagHelpers/Boxed.AspNetCore.TagHelpers.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup Label="Build">
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
55
<MinVerDefaultPreReleasePhase>preview</MinVerDefaultPreReleasePhase>
66
<MinVerTagPrefix>Boxed.AspNetCore.</MinVerTagPrefix>
77
<MinVerVerbosity>normal</MinVerVerbosity>

Source/Boxed.AspNetCore.TagHelpers/OpenGraph/ObjectTypes/OpenGraphMetadata.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,7 @@ public abstract class OpenGraphMetadata : TagHelper
160160
/// Gets or sets the images, videos or audio which should represent your object within the graph.
161161
/// </summary>
162162
[HtmlAttributeName(MediaAttributeName)]
163-
#pragma warning disable CA2227 // Collection properties should be read only
164163
public ICollection<OpenGraphMedia>? Media { get; set; }
165-
#pragma warning restore CA2227 // Collection properties should be read only
166164

167165
/// <summary>
168166
/// Gets the namespace of this open graph type.

0 commit comments

Comments
 (0)