Skip to content

Commit

Permalink
feat: migrate to .NET 9
Browse files Browse the repository at this point in the history
  • Loading branch information
Ne4to committed Dec 29, 2024
1 parent c8f3725 commit b6f3e4c
Show file tree
Hide file tree
Showing 14 changed files with 177 additions and 53 deletions.
48 changes: 34 additions & 14 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ csharp_style_var_for_built_in_types = false
csharp_style_var_when_type_is_apparent = false

# Expression-bodied members
csharp_style_expression_bodied_accessors = true
csharp_style_expression_bodied_constructors = false
csharp_style_expression_bodied_indexers = true
csharp_style_expression_bodied_lambdas = true
csharp_style_expression_bodied_local_functions = false
csharp_style_expression_bodied_methods = false
csharp_style_expression_bodied_operators = false
csharp_style_expression_bodied_properties = true
csharp_style_expression_bodied_accessors = true:silent
csharp_style_expression_bodied_constructors = false:silent
csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_lambdas = true:silent
csharp_style_expression_bodied_local_functions = false:silent
csharp_style_expression_bodied_methods = false:silent
csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_properties = true:silent

# Pattern matching preferences
csharp_style_pattern_matching_over_as_with_null_check = true
Expand All @@ -107,11 +107,11 @@ csharp_preferred_modifier_order = public,private,protected,internal,static,exter
csharp_style_prefer_readonly_struct = true

# Code-block preferences
csharp_prefer_braces = true
csharp_prefer_simple_using_statement = true
csharp_style_namespace_declarations = block_scoped
csharp_style_prefer_method_group_conversion = true
csharp_style_prefer_top_level_statements = true
csharp_prefer_braces = true:silent
csharp_prefer_simple_using_statement = true:suggestion
csharp_style_namespace_declarations = block_scoped:silent
csharp_style_prefer_method_group_conversion = true:silent
csharp_style_prefer_top_level_statements = true:silent

# Expression-level preferences
csharp_prefer_simple_default_expression = true
Expand All @@ -129,7 +129,7 @@ csharp_style_unused_value_assignment_preference = discard_variable
csharp_style_unused_value_expression_statement_preference = discard_variable

# 'using' directive preferences
csharp_using_directive_placement = outside_namespace
csharp_using_directive_placement = outside_namespace:silent

# New line preferences
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true
Expand Down Expand Up @@ -237,3 +237,23 @@ dotnet_naming_style.starts_with__.required_prefix = _
dotnet_naming_style.starts_with__.required_suffix =
dotnet_naming_style.starts_with__.word_separator =
dotnet_naming_style.starts_with__.capitalization = camel_case
csharp_style_prefer_primary_constructors = true:suggestion
csharp_prefer_system_threading_lock = true:suggestion

[*.{cs,vb}]
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
dotnet_style_prefer_auto_properties = true:silent
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
dotnet_style_prefer_conditional_expression_over_return = true:silent
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_operator_placement_when_wrapping = beginning_of_line
tab_width = 2
indent_size = 4
end_of_line = crlf
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<IsPackable>false</IsPackable>
</PropertyGroup>

<PropertyGroup>
<VersionPrefix>0.8.1</VersionPrefix>
<VersionPrefix>0.9.0</VersionPrefix>
<RepositoryUrl>https://github.com/Ne4to/Heartbeat</RepositoryUrl>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand Down
131 changes: 120 additions & 11 deletions Heartbeat.sln

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Diagnostics utility with web UI to analyze .NET application memory dump

### dotnet tool

.NET 8 SDK is required
.NET 9 SDK is required

```shell
dotnet tool install --global Heartbeat
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.100",
"version": "9.0.101",
"rollForward": "latestMinor",
"allowPrerelease": false
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/update-ts-client.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ $Configuration = 'DebugOpenAPI'
$RepositoryRoot = Split-Path $PSScriptRoot
$FrontendRoot = Join-Path $RepositoryRoot 'src/Heartbeat/ClientApp'
$ContractPath = Join-Path $FrontendRoot 'api.yml'
$DllPath = Join-Path $RepositoryRoot "src/Heartbeat/bin/$Configuration/net8.0/Heartbeat.dll"
$DllPath = Join-Path $RepositoryRoot "src/Heartbeat/bin/$Configuration/net9.0/Heartbeat.dll"

Push-Location
try
Expand Down
2 changes: 1 addition & 1 deletion src/DebugHost/DebugHost.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Diagnostics.Runtime" Version="3.1.506101" />
<PackageReference Include="Microsoft.Diagnostics.Runtime" Version="3.1.512801" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Heartbeat.Runtime/Analyzers/HttpClientAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public IReadOnlyCollection<HttpClientInfo> GetClientsInfo()

foreach (var address in Context.EnumerateObjectAddressesByTypeName("System.Net.Http.HttpClient", ObjectGcStatus))
{
var httpClientObjectType = Context.Heap.GetObjectType(address);
var httpClientObjectType = Context.Heap.GetObjectType(address)!;
var timeoutField = httpClientObjectType.GetFieldByName("_timeout");
if (timeoutField == null)
{
Expand Down
8 changes: 4 additions & 4 deletions src/Heartbeat.Runtime/Heartbeat.Runtime.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<Using Include="Heartbeat.Domain"/>
<Using Include="Heartbeat.Domain" />
</ItemGroup>

<PropertyGroup>
Expand All @@ -14,9 +14,9 @@
<!-- </ItemGroup>-->

<ItemGroup>
<PackageReference Include="Microsoft.Diagnostics.Runtime" Version="3.1.456101" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0"/>
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.8.14">
<PackageReference Include="Microsoft.Diagnostics.Runtime" Version="3.1.512801" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.12.19">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
9 changes: 2 additions & 7 deletions src/Heartbeat.Runtime/RuntimeContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,8 @@ public string GetStringLengthFieldName()

public IEnumerable<ulong> EnumerateObjectAddressesByTypeName(string typeName, ObjectGCStatus? status)
{
var clrType = Heap.GetTypeByName(typeName);

if (clrType == null)
{
throw new Exception($"Type '{typeName}' is not found");
}

var clrType = Heap.GetTypeByName(typeName) ?? throw new Exception($"Type '{typeName}' is not found");

return
from clrObject in Heap.EnumerateObjects()
let type = clrObject.Type
Expand Down
14 changes: 7 additions & 7 deletions src/Heartbeat/Heartbeat.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>Heartbeat.Host</RootNamespace>
Expand Down Expand Up @@ -60,12 +60,12 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="JWT" Version="10.1.1" />
<PackageReference Include="Microsoft.AspNetCore.SpaProxy" Version="8.0.1" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
<PackageReference Include="JWT" Version="11.0.0" />
<PackageReference Include="Microsoft.AspNetCore.SpaProxy" Version="9.0.0" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="9.0.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta3.22114.1" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion tests/DumpHelper/DumpHelper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Diagnostics.Runtime" Version="3.1.456101" />
<PackageReference Include="Microsoft.Diagnostics.Runtime" Version="3.1.512801" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion tests/DumpHelper/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ private void BuildProject(FileInfo projectFile)

private Process RunProject(FileInfo projectFile)
{
var dir = Path.Combine(projectFile.DirectoryName, @"bin\Release\net8.0");
var dir = Path.Combine(projectFile.DirectoryName, @"bin\Release\net9.0");

Check warning on line 48 in tests/DumpHelper/Program.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'path1' in 'string Path.Combine(string path1, string path2)'.
var exeFile = Path.ChangeExtension(projectFile.Name, "exe");

ProcessStartInfo startInfo = new()
Expand Down
2 changes: 1 addition & 1 deletion tests/MinimalRepo/MinimalRepo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Diagnostics.Runtime" Version="3.1.456101" />
<PackageReference Include="Microsoft.Diagnostics.Runtime" Version="3.1.512801" />
</ItemGroup>

</Project>

0 comments on commit b6f3e4c

Please sign in to comment.