Skip to content

Commit ed573f7

Browse files
authoredDec 29, 2024··
feat: migrate to .NET 9 (#30)
1 parent c8f3725 commit ed573f7

14 files changed

+177
-53
lines changed
 

‎.editorconfig

+34-14
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,14 @@ csharp_style_var_for_built_in_types = false
8181
csharp_style_var_when_type_is_apparent = false
8282

8383
# Expression-bodied members
84-
csharp_style_expression_bodied_accessors = true
85-
csharp_style_expression_bodied_constructors = false
86-
csharp_style_expression_bodied_indexers = true
87-
csharp_style_expression_bodied_lambdas = true
88-
csharp_style_expression_bodied_local_functions = false
89-
csharp_style_expression_bodied_methods = false
90-
csharp_style_expression_bodied_operators = false
91-
csharp_style_expression_bodied_properties = true
84+
csharp_style_expression_bodied_accessors = true:silent
85+
csharp_style_expression_bodied_constructors = false:silent
86+
csharp_style_expression_bodied_indexers = true:silent
87+
csharp_style_expression_bodied_lambdas = true:silent
88+
csharp_style_expression_bodied_local_functions = false:silent
89+
csharp_style_expression_bodied_methods = false:silent
90+
csharp_style_expression_bodied_operators = false:silent
91+
csharp_style_expression_bodied_properties = true:silent
9292

9393
# Pattern matching preferences
9494
csharp_style_pattern_matching_over_as_with_null_check = true
@@ -107,11 +107,11 @@ csharp_preferred_modifier_order = public,private,protected,internal,static,exter
107107
csharp_style_prefer_readonly_struct = true
108108

109109
# Code-block preferences
110-
csharp_prefer_braces = true
111-
csharp_prefer_simple_using_statement = true
112-
csharp_style_namespace_declarations = block_scoped
113-
csharp_style_prefer_method_group_conversion = true
114-
csharp_style_prefer_top_level_statements = true
110+
csharp_prefer_braces = true:silent
111+
csharp_prefer_simple_using_statement = true:suggestion
112+
csharp_style_namespace_declarations = block_scoped:silent
113+
csharp_style_prefer_method_group_conversion = true:silent
114+
csharp_style_prefer_top_level_statements = true:silent
115115

116116
# Expression-level preferences
117117
csharp_prefer_simple_default_expression = true
@@ -129,7 +129,7 @@ csharp_style_unused_value_assignment_preference = discard_variable
129129
csharp_style_unused_value_expression_statement_preference = discard_variable
130130

131131
# 'using' directive preferences
132-
csharp_using_directive_placement = outside_namespace
132+
csharp_using_directive_placement = outside_namespace:silent
133133

134134
# New line preferences
135135
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true
@@ -237,3 +237,23 @@ dotnet_naming_style.starts_with__.required_prefix = _
237237
dotnet_naming_style.starts_with__.required_suffix =
238238
dotnet_naming_style.starts_with__.word_separator =
239239
dotnet_naming_style.starts_with__.capitalization = camel_case
240+
csharp_style_prefer_primary_constructors = true:suggestion
241+
csharp_prefer_system_threading_lock = true:suggestion
242+
243+
[*.{cs,vb}]
244+
dotnet_style_coalesce_expression = true:suggestion
245+
dotnet_style_null_propagation = true:suggestion
246+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
247+
dotnet_style_prefer_auto_properties = true:silent
248+
dotnet_style_object_initializer = true:suggestion
249+
dotnet_style_collection_initializer = true:suggestion
250+
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
251+
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
252+
dotnet_style_prefer_conditional_expression_over_return = true:silent
253+
dotnet_style_explicit_tuple_names = true:suggestion
254+
dotnet_style_prefer_inferred_tuple_names = true:suggestion
255+
dotnet_style_operator_placement_when_wrapping = beginning_of_line
256+
tab_width = 2
257+
indent_size = 4
258+
end_of_line = crlf
259+
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion

‎Directory.Build.props

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<Project>
22
<PropertyGroup>
3-
<TargetFramework>net8.0</TargetFramework>
3+
<TargetFramework>net9.0</TargetFramework>
44
<Nullable>enable</Nullable>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<IsPackable>false</IsPackable>
77
</PropertyGroup>
88

99
<PropertyGroup>
10-
<VersionPrefix>0.8.1</VersionPrefix>
10+
<VersionPrefix>0.9.0</VersionPrefix>
1111
<RepositoryUrl>https://github.com/Ne4to/Heartbeat</RepositoryUrl>
1212
<PublishRepositoryUrl>true</PublishRepositoryUrl>
1313
<PackageLicenseExpression>MIT</PackageLicenseExpression>

‎Heartbeat.sln

+120-11
Large diffs are not rendered by default.

‎README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Diagnostics utility with web UI to analyze .NET application memory dump
77

88
### dotnet tool
99

10-
.NET 8 SDK is required
10+
.NET 9 SDK is required
1111

1212
```shell
1313
dotnet tool install --global Heartbeat

‎global.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "8.0.100",
3+
"version": "9.0.101",
44
"rollForward": "latestMinor",
55
"allowPrerelease": false
66
}

‎scripts/update-ts-client.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ $Configuration = 'DebugOpenAPI'
44
$RepositoryRoot = Split-Path $PSScriptRoot
55
$FrontendRoot = Join-Path $RepositoryRoot 'src/Heartbeat/ClientApp'
66
$ContractPath = Join-Path $FrontendRoot 'api.yml'
7-
$DllPath = Join-Path $RepositoryRoot "src/Heartbeat/bin/$Configuration/net8.0/Heartbeat.dll"
7+
$DllPath = Join-Path $RepositoryRoot "src/Heartbeat/bin/$Configuration/net9.0/Heartbeat.dll"
88

99
Push-Location
1010
try

‎src/DebugHost/DebugHost.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
</PropertyGroup>
66

77
<ItemGroup>
8-
<PackageReference Include="Microsoft.Diagnostics.Runtime" Version="3.1.506101" />
8+
<PackageReference Include="Microsoft.Diagnostics.Runtime" Version="3.1.512801" />
99
</ItemGroup>
1010

1111
<ItemGroup>

‎src/Heartbeat.Runtime/Analyzers/HttpClientAnalyzer.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public IReadOnlyCollection<HttpClientInfo> GetClientsInfo()
2020

2121
foreach (var address in Context.EnumerateObjectAddressesByTypeName("System.Net.Http.HttpClient", ObjectGcStatus))
2222
{
23-
var httpClientObjectType = Context.Heap.GetObjectType(address);
23+
var httpClientObjectType = Context.Heap.GetObjectType(address)!;
2424
var timeoutField = httpClientObjectType.GetFieldByName("_timeout");
2525
if (timeoutField == null)
2626
{

‎src/Heartbeat.Runtime/Heartbeat.Runtime.csproj

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<ItemGroup>
3-
<Using Include="Heartbeat.Domain"/>
3+
<Using Include="Heartbeat.Domain" />
44
</ItemGroup>
55

66
<PropertyGroup>
@@ -14,9 +14,9 @@
1414
<!-- </ItemGroup>-->
1515

1616
<ItemGroup>
17-
<PackageReference Include="Microsoft.Diagnostics.Runtime" Version="3.1.456101" />
18-
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0"/>
19-
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.8.14">
17+
<PackageReference Include="Microsoft.Diagnostics.Runtime" Version="3.1.512801" />
18+
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.0" />
19+
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.12.19">
2020
<PrivateAssets>all</PrivateAssets>
2121
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2222
</PackageReference>

‎src/Heartbeat.Runtime/RuntimeContext.cs

+2-7
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,8 @@ public string GetStringLengthFieldName()
5454

5555
public IEnumerable<ulong> EnumerateObjectAddressesByTypeName(string typeName, ObjectGCStatus? status)
5656
{
57-
var clrType = Heap.GetTypeByName(typeName);
58-
59-
if (clrType == null)
60-
{
61-
throw new Exception($"Type '{typeName}' is not found");
62-
}
63-
57+
var clrType = Heap.GetTypeByName(typeName) ?? throw new Exception($"Type '{typeName}' is not found");
58+
6459
return
6560
from clrObject in Heap.EnumerateObjects()
6661
let type = clrObject.Type

‎src/Heartbeat/Heartbeat.csproj

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFramework>net9.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<RootNamespace>Heartbeat.Host</RootNamespace>
@@ -60,12 +60,12 @@
6060
</ItemGroup>
6161

6262
<ItemGroup>
63-
<PackageReference Include="JWT" Version="10.1.1" />
64-
<PackageReference Include="Microsoft.AspNetCore.SpaProxy" Version="8.0.1" />
65-
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.1" />
66-
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
67-
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="8.0.1" />
68-
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
63+
<PackageReference Include="JWT" Version="11.0.0" />
64+
<PackageReference Include="Microsoft.AspNetCore.SpaProxy" Version="9.0.0" />
65+
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.0" />
66+
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
67+
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="9.0.0" />
68+
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="9.0.0" />
6969
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
7070
<PackageReference Include="System.CommandLine" Version="2.0.0-beta3.22114.1" />
7171
</ItemGroup>

‎tests/DumpHelper/DumpHelper.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
</PropertyGroup>
66

77
<ItemGroup>
8-
<PackageReference Include="Microsoft.Diagnostics.Runtime" Version="3.1.456101" />
8+
<PackageReference Include="Microsoft.Diagnostics.Runtime" Version="3.1.512801" />
99
</ItemGroup>
1010

1111
</Project>

‎tests/DumpHelper/Program.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ private void BuildProject(FileInfo projectFile)
4545

4646
private Process RunProject(FileInfo projectFile)
4747
{
48-
var dir = Path.Combine(projectFile.DirectoryName, @"bin\Release\net8.0");
48+
var dir = Path.Combine(projectFile.DirectoryName, @"bin\Release\net9.0");
4949
var exeFile = Path.ChangeExtension(projectFile.Name, "exe");
5050

5151
ProcessStartInfo startInfo = new()

‎tests/MinimalRepo/MinimalRepo.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="Microsoft.Diagnostics.Runtime" Version="3.1.456101" />
11+
<PackageReference Include="Microsoft.Diagnostics.Runtime" Version="3.1.512801" />
1212
</ItemGroup>
1313

1414
</Project>

0 commit comments

Comments
 (0)
Please sign in to comment.