Skip to content

Commit fe961d3

Browse files
authored
upgrade: .NET 8.0 (#2429)
* chore: cleanup Intersect.Framework warnings * upgrade: net8 * fix: un-apply disable windows patch * fix: correct Editor launch settings cwd * fix: actually upgrade the server packages
1 parent 8c12785 commit fe961d3

File tree

30 files changed

+185
-137
lines changed

30 files changed

+185
-137
lines changed

.editorconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ resharper_csharp_wrap_after_invocation_lpar = true
140140
resharper_csharp_wrap_arguments_style = chop_if_long
141141
resharper_csharp_wrap_before_invocation_rpar = true
142142
resharper_keep_existing_invocation_parens_arrangement = false
143+
resharper_keep_existing_property_patterns_arrangement = false
143144
resharper_max_invocation_arguments_on_line = 3
144145
resharper_place_expr_property_on_single_line = true
145146
resharper_place_simple_initializer_on_single_line = false

Directory.Build.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
<PropertyGroup Label="Language Properties">
2121
<Deterministic>true</Deterministic>
2222
<ImplicitUsings>enable</ImplicitUsings>
23-
<LangVersion>preview</LangVersion>
23+
<LangVersion>latest</LangVersion>
2424
<Nullable>enable</Nullable>
2525
<RuntimeIdentifiers>linux-arm64;linux-x64;osx-arm64;osx-x64;win-x64</RuntimeIdentifiers>
26-
<TargetFramework>net7.0</TargetFramework>
26+
<TargetFramework>net8.0</TargetFramework>
2727
</PropertyGroup>
2828

2929
</Project>

Examples/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<ImplicitUsings>enable</ImplicitUsings>
2020
<LangVersion>latest</LangVersion>
2121
<Nullable>enable</Nullable>
22-
<TargetFramework>net7.0</TargetFramework>
22+
<TargetFramework>net8.0</TargetFramework>
2323
</PropertyGroup>
2424

2525
</Project>

Framework/Directory.Build.props

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
<Project>
2+
3+
<PropertyGroup>
4+
<IntersectRepoPath Condition="'$(IntersectRepoPath)' == ''">$(MSBuildProjectDirectory)\..\..</IntersectRepoPath>
5+
</PropertyGroup>
6+
7+
<Import Project="../Directory.Build.props" />
8+
29
<PropertyGroup>
310
<IntersectRepoPath>$(MSBuildProjectDirectory)\..\..</IntersectRepoPath>
411
</PropertyGroup>

Framework/Intersect.Framework/Converters/Json/GenericFactoryNewtonsoftJsonConverter.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace Intersect.Framework.Converters.Json;
55

66
public abstract class GenericFactoryNewtonsoftJsonConverter : JsonConverter
77
{
8-
private static readonly Dictionary<Type, JsonConverter> _converters = new Dictionary<Type, JsonConverter>();
8+
private static readonly Dictionary<Type, JsonConverter> Converters = [];
99

1010
private readonly Type _converterTypeDefinition;
1111
private readonly Type _serializedGenericTypeDefinition;
@@ -60,7 +60,7 @@ private static JsonConverter CreateActualConverter(
6060
Type objectType
6161
)
6262
{
63-
if (_converters.TryGetValue(objectType, out JsonConverter? jsonConverter))
63+
if (Converters.TryGetValue(objectType, out JsonConverter? jsonConverter))
6464
{
6565
return jsonConverter;
6666
}
@@ -73,7 +73,7 @@ Type objectType
7373
var identifiedType = targetType.FindGenericTypeParameters(serializedGenericTypeDefinition);
7474
var converterType = converterTypeDefinition.MakeGenericType(identifiedType);
7575
jsonConverter = Activator.CreateInstance(converterType) as JsonConverter;
76-
_converters[objectType] = jsonConverter ?? throw new InvalidOperationException();
76+
Converters[objectType] = jsonConverter ?? throw new InvalidOperationException();
7777
return jsonConverter;
7878
}
7979
}
Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3-
<PropertyGroup>
4-
<TargetFramework>net7.0</TargetFramework>
5-
<ImplicitUsings>enable</ImplicitUsings>
6-
<Nullable>enable</Nullable>
7-
</PropertyGroup>
8-
93
<ItemGroup>
104
<PackageReference Include="MessagePack.Annotations" Version="2.6.100-alpha" />
115
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="7.0.14" />
@@ -17,4 +11,19 @@
1711
<PackageReference Include="System.Text.Json" Version="8.0.5" />
1812
</ItemGroup>
1913

14+
<ItemGroup>
15+
<Compile Update="Reflection\ReflectionStrings.Designer.cs">
16+
<DesignTime>True</DesignTime>
17+
<AutoGen>True</AutoGen>
18+
<DependentUpon>ReflectionStrings.resx</DependentUpon>
19+
</Compile>
20+
</ItemGroup>
21+
22+
<ItemGroup>
23+
<EmbeddedResource Update="Reflection\ReflectionStrings.resx">
24+
<Generator>ResXFileCodeGenerator</Generator>
25+
<LastGenOutput>ReflectionStrings.Designer.cs</LastGenOutput>
26+
</EmbeddedResource>
27+
</ItemGroup>
28+
2029
</Project>

Framework/Intersect.Framework/Reflection/AssemblyExtensions.cs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System.Diagnostics.CodeAnalysis;
22
using System.Reflection;
33
using System.Resources;
4+
// ReSharper disable MemberCanBePrivate.Global
45

56
namespace Intersect.Framework.Reflection;
67

@@ -34,7 +35,7 @@ params object[] args
3435
if (type == default)
3536
{
3637
throw new InvalidOperationException(
37-
$"Found no matching subtype of {typeof(TParentType).FullName} that can be created."
38+
string.Format(ReflectionStrings.AssemblyExtensions_NoMatchingSubtype, typeof(TParentType).FullName)
3839
);
3940
}
4041

@@ -43,7 +44,9 @@ params object[] args
4344
return instance;
4445
}
4546

46-
throw new InvalidOperationException($"Failed to create instance of {typeof(TParentType).FullName}.");
47+
throw new InvalidOperationException(
48+
string.Format(ReflectionStrings.AssemblyExtensions_FailedToCreateInstance, typeof(TParentType).FullName)
49+
);
4750
}
4851

4952
public static string GetVersionName(this Assembly assembly)
@@ -61,7 +64,7 @@ public static string GetVersionName(this Assembly assembly)
6164
}
6265

6366
public static IEnumerable<Type> FindAbstractSubtypesOf(this Assembly assembly, Type type) =>
64-
assembly.FindSubtypesOf(type).Where(subtype => subtype?.IsAbstract ?? false);
67+
assembly.FindSubtypesOf(type).Where(subtype => subtype.IsAbstract);
6568

6669
public static IEnumerable<Type> FindAbstractSubtypesOf<TParentType>(this Assembly assembly) =>
6770
assembly.FindAbstractSubtypesOf(typeof(TParentType));
@@ -75,16 +78,16 @@ public static IEnumerable<Type> FindDefinedSubtypesOf<TParentType>(this Assembly
7578
assembly.FindDefinedSubtypesOf(typeof(TParentType));
7679

7780
public static IEnumerable<Type> FindGenericSubtypesOf(this Assembly assembly, Type type) =>
78-
assembly.FindSubtypesOf(type).Where(subtype => subtype?.IsGenericType ?? false);
81+
assembly.FindSubtypesOf(type).Where(subtype => subtype.IsGenericType);
7982

8083
public static IEnumerable<Type> FindGenericSubtypesOf<TParentType>(this Assembly assembly) =>
8184
assembly.FindGenericSubtypesOf(typeof(TParentType));
8285

8386
public static IEnumerable<Type> FindInterfaceSubtypesOf(this Assembly assembly, Type type) =>
84-
assembly.FindSubtypesOf(type).Where(subtype => subtype?.IsInterface ?? false);
87+
assembly.FindSubtypesOf(type).Where(subtype => subtype.IsInterface);
8588

8689
public static IEnumerable<Type> FindInterfaceSubtypesOf<TParentType>(this Assembly assembly) =>
87-
assembly.FindInterfaceSubtypesOf(typeof(Type));
90+
assembly.FindInterfaceSubtypesOf(typeof(TParentType));
8891

8992
public static IEnumerable<Type> FindSubtypesOf(this Assembly assembly, Type type) =>
9093
assembly.GetTypes().Where(type.IsAssignableFrom);
@@ -93,10 +96,10 @@ public static IEnumerable<Type> FindSubtypesOf<TParentType>(this Assembly assemb
9396
assembly.FindGenericSubtypesOf(typeof(TParentType));
9497

9598
public static IEnumerable<Type> FindValueSubtypesOf(this Assembly assembly, Type type) =>
96-
assembly.FindSubtypesOf(type).Where(subtype => subtype?.IsValueType ?? false);
99+
assembly.FindSubtypesOf(type).Where(subtype => subtype.IsValueType);
97100

98101
public static IEnumerable<Type> FindValueSubtypesOf<TParentType>(this Assembly assembly) =>
99-
assembly.FindValueSubtypesOf(typeof(Type));
102+
assembly.FindValueSubtypesOf(typeof(TParentType));
100103

101104
public static bool TryFindResource(
102105
this Assembly assembly,
@@ -111,7 +114,7 @@ public static bool TryFindResource(
111114
}
112115

113116
manifestResourceName = assembly.GetManifestResourceNames()
114-
.FirstOrDefault(name => name?.Contains(resourceName, StringComparison.CurrentCulture) ?? false);
117+
.FirstOrDefault(name => name.Contains(resourceName, StringComparison.CurrentCulture));
115118
return manifestResourceName != default;
116119
}
117120

Framework/Intersect.Framework/Reflection/MemberInfoExtensions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Diagnostics;
22
using System.Reflection;
3+
// ReSharper disable MemberCanBePrivate.Global
34

45
namespace Intersect.Framework.Reflection;
56

Framework/Intersect.Framework/Reflection/ReflectionHelper.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Diagnostics.CodeAnalysis;
22
using System.Reflection;
3+
// ReSharper disable MemberCanBePrivate.Global
34

45
namespace Intersect.Framework.Reflection;
56

Framework/Intersect.Framework/Reflection/ReflectionStrings.Designer.cs

Lines changed: 46 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)