Skip to content

Commit 13c9063

Browse files
authored
Merge pull request #192 from reactivemarbles/HouseKeeping
Update dependencies and refactor benchmark disposals
2 parents 6912f14 + 0bba19f commit 13c9063

26 files changed

+217
-205
lines changed

Directory.Build.props

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@
2929
<!-- Include PDB in the built .nupkg -->
3030
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
3131
<IncludePackageReferencesDuringMarkupCompilation>true</IncludePackageReferencesDuringMarkupCompilation>
32-
<AvaloniaVersion>11.3.8</AvaloniaVersion>
32+
<AvaloniaVersion>11.3.9</AvaloniaVersion>
3333
<SplatVersion>17.1.1</SplatVersion>
34-
<ReactiveUIVersion>22.2.1</ReactiveUIVersion>
34+
<ReactiveUIVersion>22.3.1</ReactiveUIVersion>
3535
<XamarinReactiveUIVersion>19.6.12</XamarinReactiveUIVersion>
3636
<WebViewVersion>1.0.3595.46</WebViewVersion>
37-
<CoreNetVersion>9.0.10</CoreNetVersion>
37+
<CoreNetVersion>9.0.11</CoreNetVersion>
3838
<CrissCrossCoreTargetFrameworks>netstandard2.0;net8.0;net9.0;net10.0</CrissCrossCoreTargetFrameworks>
3939
<CrissCrossWinTargetFrameworks>net472;net48;net8.0-windows10.0.19041.0;net9.0-windows10.0.19041.0;net10.0-windows10.0.19041.0</CrissCrossWinTargetFrameworks>
4040
<CrissCrossWebviewTargetFrameworks>net472;net48;net8.0-windows;net9.0-windows;net10.0-windows</CrissCrossWebviewTargetFrameworks>

build/_build.csproj

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net8.0</TargetFramework>
5+
<TargetFramework>net10.0</TargetFramework>
66
<RootNamespace></RootNamespace>
77
<NoWarn>CS0649;CS0169;CA1050;CA1822;CA2211;IDE1006;IDE0051</NoWarn>
88
<NukeRootDirectory>..</NukeRootDirectory>
@@ -12,12 +12,9 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="17.14.28" />
1615
<PackageReference Include="Nerdbank.GitVersioning" Version="3.9.50" />
17-
<PackageReference Include="Nuke.Common" Version="9.0.4" />
18-
<PackageReference Include="CP.Nuke.BuildTools" Version="1.0.94" />
19-
<PackageReference Include="System.Text.Json" Version="9.0.9" />
20-
<PackageReference Include="Microsoft.Build" Version="17.11.48" />
16+
<PackageReference Include="Nuke.Common" Version="10.0.1" />
17+
<PackageReference Include="CP.Nuke.BuildTools" Version="2.0.16" />
2118
</ItemGroup>
2219

2320
<ItemGroup>

src/CrissCross.Avalonia.Benchmarks/CrissCross.Avalonia.Benchmarks.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<OutputType>Exe</OutputType>
66
</PropertyGroup>
77
<ItemGroup>
8-
<PackageReference Include="BenchmarkDotNet" Version="0.15.6" />
8+
<PackageReference Include="BenchmarkDotNet" Version="0.15.8" />
99
</ItemGroup>
1010
<ItemGroup>
1111
<ProjectReference Include="..\CrissCross.Avalonia\CrissCross.Avalonia.csproj" />

src/CrissCross.Avalonia.Benchmarks/ViewModelRoutedViewHostBenchmark.cs

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,22 @@ namespace CrissCross.Avalonia.Benchmarks
1414
/// <summary>
1515
/// Benchmarks for ViewModelRoutedViewHost navigation and history operations.
1616
/// </summary>
17-
public sealed class ViewModelRoutedViewHostBenchmark : IDisposable
17+
public class ViewModelRoutedViewHostBenchmark : IDisposable
1818
{
1919
private ViewModelRoutedViewHost _host;
2020
private IRxObject _dummyViewModel;
21+
private bool _disposedValue;
2122

2223
/// <summary>
2324
/// Initializes the benchmark host and dummy view model.
2425
/// </summary>
2526
[GlobalSetup]
2627
public void Setup()
2728
{
28-
_host = new ViewModelRoutedViewHost();
29-
_host.HostName = "BenchmarkHost";
29+
_host = new ViewModelRoutedViewHost
30+
{
31+
HostName = "BenchmarkHost"
32+
};
3033
_host.Setup();
3134
_dummyViewModel = new DummyRxObject();
3235
}
@@ -35,54 +38,60 @@ public void Setup()
3538
/// Benchmarks navigation to a new view model type.
3639
/// </summary>
3740
[Benchmark]
38-
public void Navigate()
39-
{
40-
_host.Navigate<DummyRxObject>();
41-
}
41+
public void Navigate() => _host.Navigate<DummyRxObject>();
4242

4343
/// <summary>
4444
/// Benchmarks navigation with a view model instance.
4545
/// </summary>
4646
[Benchmark]
47-
public void NavigateWithInstance()
48-
{
49-
_host.Navigate(_dummyViewModel);
50-
}
47+
public void NavigateWithInstance() => _host.Navigate(_dummyViewModel);
5148

5249
/// <summary>
5350
/// Benchmarks navigation and reset to a new view model type.
5451
/// </summary>
5552
[Benchmark]
56-
public void NavigateAndReset()
57-
{
58-
_host.NavigateAndReset<DummyRxObject>();
59-
}
53+
public void NavigateAndReset() => _host.NavigateAndReset<DummyRxObject>();
6054

6155
/// <summary>
6256
/// Benchmarks navigating back in the navigation stack.
6357
/// </summary>
6458
[Benchmark]
65-
public void NavigateBack()
66-
{
67-
_host.NavigateBack();
68-
}
59+
public void NavigateBack() => _host.NavigateBack();
6960

7061
/// <summary>
7162
/// Benchmarks clearing the navigation history.
7263
/// </summary>
7364
[Benchmark]
74-
public void ClearHistory()
65+
public void ClearHistory() => _host.ClearHistory();
66+
67+
/// <summary>
68+
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
69+
/// </summary>
70+
public void Dispose()
7571
{
76-
_host.ClearHistory();
72+
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
73+
Dispose(disposing: true);
74+
GC.SuppressFinalize(this);
7775
}
7876

7977
/// <summary>
80-
/// Disposes the benchmark host and dummy view model.
78+
/// Releases unmanaged and - optionally - managed resources.
8179
/// </summary>
82-
public void Dispose()
80+
/// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
81+
protected virtual void Dispose(bool disposing)
8382
{
84-
_host?.Dispose();
85-
(_dummyViewModel as IDisposable)?.Dispose();
83+
if (!_disposedValue)
84+
{
85+
if (disposing)
86+
{
87+
_host?.Dispose();
88+
(_dummyViewModel as IDisposable)?.Dispose();
89+
}
90+
91+
// TODO: free unmanaged resources (unmanaged objects) and override finalizer
92+
// TODO: set large fields to null
93+
_disposedValue = true;
94+
}
8695
}
8796

8897
/// <summary>
@@ -110,10 +119,7 @@ public void Dispose()
110119
{
111120
}
112121

113-
public IDisposable SuppressChangeNotifications()
114-
{
115-
return Disposable.Empty;
116-
}
122+
public IDisposable SuppressChangeNotifications() => Disposable.Empty;
117123

118124
public void RaisePropertyChanging(PropertyChangingEventArgs args)
119125
{

src/CrissCross.MAUI.Benchmarks/CrissCross.MAUI.Benchmarks.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
</PropertyGroup>
2626

2727
<ItemGroup>
28-
<PackageReference Include="BenchmarkDotNet" Version="0.15.6" />
28+
<PackageReference Include="BenchmarkDotNet" Version="0.15.8" />
2929
<PackageReference Include="Microsoft.Maui.Controls" Version="9.0.120" />
3030
</ItemGroup>
3131
<ItemGroup>

src/CrissCross.MAUI.Benchmarks/NavigationShellBenchmark.cs

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,22 @@ namespace CrissCross.MAUI.Benchmarks
1414
/// <summary>
1515
/// NavigationShellBenchmark.
1616
/// </summary>
17-
public sealed class NavigationShellBenchmark : IDisposable
17+
public partial class NavigationShellBenchmark : IDisposable
1818
{
19-
private NavigationShell _host;
20-
private IRxObject _dummyViewModel;
19+
private NavigationShell? _host;
20+
private IRxObject? _dummyViewModel;
21+
private bool _disposedValue;
2122

2223
/// <summary>
2324
/// Setups this instance.
2425
/// </summary>
2526
[GlobalSetup]
2627
public void Setup()
2728
{
28-
_host = new NavigationShell();
29-
_host.Name = "BenchmarkHost";
29+
_host = new NavigationShell
30+
{
31+
Name = "BenchmarkHost"
32+
};
3033
_host.Setup();
3134
_dummyViewModel = new DummyRxObject();
3235
}
@@ -35,57 +38,61 @@ public void Setup()
3538
/// Navigates this instance.
3639
/// </summary>
3740
[Benchmark]
38-
public void Navigate()
39-
{
40-
_host.Navigate<DummyRxObject>();
41-
}
41+
public void Navigate() => _host?.Navigate<DummyRxObject>();
4242

4343
/// <summary>
4444
/// Navigates the with instance.
4545
/// </summary>
4646
[Benchmark]
47-
public void NavigateWithInstance()
48-
{
49-
_host.Navigate(_dummyViewModel);
50-
}
47+
public void NavigateWithInstance() => _host?.Navigate(_dummyViewModel!);
5148

5249
/// <summary>
5350
/// Navigates the and reset.
5451
/// </summary>
5552
[Benchmark]
56-
public void NavigateAndReset()
57-
{
58-
_host.NavigateAndReset<DummyRxObject>();
59-
}
53+
public void NavigateAndReset() => _host?.NavigateAndReset<DummyRxObject>();
6054

6155
/// <summary>
6256
/// Navigates the back.
6357
/// </summary>
6458
[Benchmark]
65-
public void NavigateBack()
66-
{
67-
_host.NavigateBack();
68-
}
59+
public void NavigateBack() => _host?.NavigateBack();
6960

7061
/// <summary>
7162
/// Clears the history.
7263
/// </summary>
7364
[Benchmark]
74-
public void ClearHistory()
75-
{
76-
_host.ClearHistory();
77-
}
65+
public void ClearHistory() => _host?.ClearHistory();
7866

7967
/// <summary>
8068
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
8169
/// </summary>
8270
public void Dispose()
8371
{
84-
_host?.Dispose();
85-
(_dummyViewModel as IDisposable)?.Dispose();
72+
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
73+
Dispose(disposing: true);
74+
GC.SuppressFinalize(this);
8675
}
8776

88-
private class DummyRxObject : IRxObject
77+
/// <summary>
78+
/// Releases unmanaged and - optionally - managed resources.
79+
/// </summary>
80+
/// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
81+
protected virtual void Dispose(bool disposing)
82+
{
83+
if (!_disposedValue)
84+
{
85+
if (disposing)
86+
{
87+
_host?.Dispose();
88+
(_dummyViewModel as IDisposable)?.Dispose();
89+
}
90+
91+
_disposedValue = true;
92+
}
93+
}
94+
95+
private partial class DummyRxObject : IRxObject
8996
{
9097
public event PropertyChangedEventHandler? PropertyChanged;
9198

@@ -107,10 +114,7 @@ public void Dispose()
107114
{
108115
}
109116

110-
public IDisposable SuppressChangeNotifications()
111-
{
112-
return Disposable.Empty;
113-
}
117+
public IDisposable SuppressChangeNotifications() => Disposable.Empty;
114118

115119
public void RaisePropertyChanging(PropertyChangingEventArgs args)
116120
{

src/CrissCross.MAUI/CrissCross.MAUI.csproj

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

33
<PropertyGroup>
4-
<TargetFrameworks>net9.0;net10.0</TargetFrameworks>
4+
<TargetFrameworks>net9.0;net10.0;net9.0-ios;net9.0-tvos;net9.0-macos;net9.0-maccatalyst;net10.0-ios;net10.0-tvos;net10.0-macos;net10.0-maccatalyst;net9.0-android;net10.0-android</TargetFrameworks>
55
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net9.0-windows10.0.19041.0;net10.0-windows10.0.19041.0</TargetFrameworks>
66
<UseMaui>true</UseMaui>
77
<SingleProject>true</SingleProject>
@@ -22,8 +22,8 @@
2222
<PackageReference Include="ReactiveUI.Maui" Version="$(ReactiveUIVersion)" />
2323
</ItemGroup>
2424
<ItemGroup Condition="$(TargetFramework.StartsWith('net10'))">
25-
<PackageReference Include="Microsoft.Maui.Controls" Version="10.0.10" />
26-
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="10.0.10" />
25+
<PackageReference Include="Microsoft.Maui.Controls" Version="10.0.11" />
26+
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="10.0.11" />
2727
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.*" />
2828
<PackageReference Include="Microsoft.Extensions.Logging" Version="10.0.*" />
2929
</ItemGroup>

src/CrissCross.WPF.Benchmarks/CrissCross.WPF.Benchmarks.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<OutputType>Exe</OutputType>
77
</PropertyGroup>
88
<ItemGroup>
9-
<PackageReference Include="BenchmarkDotNet" Version="0.15.6" />
9+
<PackageReference Include="BenchmarkDotNet" Version="0.15.8" />
1010
</ItemGroup>
1111
<ItemGroup>
1212
<ProjectReference Include="..\CrissCross.WPF\CrissCross.WPF.csproj" />

0 commit comments

Comments
 (0)