Skip to content

Commit fc673fe

Browse files
author
Jim.Jiang
committed
Fix can not show gc dump version.
1 parent cf0a837 commit fc673fe

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/DotnetDumpMonitor/ViewModels/MainWindowViewModel.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public partial class MainWindowViewModel : ObservableObject
2828
{
2929
private IEnumerable<ObjectDumpInfo>? _lastObjectDumpInfos = null;
3030
private IEnumerable<ObjectDumpInfo>? _baseObjectDumpInfos = null;
31-
private string _gcDumpVersionStr = string.Empty;
31+
private string? _gcDumpVersionStr = null;
3232

3333
[ObservableProperty]
3434
private bool _loaded = false;
@@ -70,16 +70,16 @@ public MainWindowViewModel()
7070

7171
public void RefreshTitle()
7272
{
73-
var gcDumpVersionStr = _gcDumpVersionStr == string.Empty ? "version loading..." : $"v{_gcDumpVersionStr}";
73+
var gcDumpVersionStr = _gcDumpVersionStr == null ? "version loading..." : $"v{_gcDumpVersionStr}";
7474
var version = (GithubLastReleaseVersion == null || GithubUpgradeHelper.CurrentVersion == GithubLastReleaseVersion)
7575
? $"v{GithubUpgradeHelper.CurrentVersion}" : $"v{GithubUpgradeHelper.CurrentVersion}(lastest v{GithubLastReleaseVersion})";
7676
Title = $"Dump monitor {version} / Dotnet gc dump {gcDumpVersionStr}";
7777
}
7878
[RelayCommand]
7979
private async Task InitWindow()
8080
{
81-
var _gcDumpVersionStr = await DotnetGcDumpHelper.GetGcDumpVersionStr();
82-
if (_gcDumpVersionStr == null)
81+
var gcDumpVersionStr = await DotnetGcDumpHelper.GetGcDumpVersionStr();
82+
if (gcDumpVersionStr == null)
8383
{
8484
if (MessageBox.Show("You haven't installed 'dotnet gc dump' yet, do you want to install it now?", "Warning!!!", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
8585
{
@@ -95,8 +95,9 @@ private async Task InitWindow()
9595
App.Current.Shutdown();
9696
return;
9797
}
98-
_gcDumpVersionStr = await DotnetGcDumpHelper.GetGcDumpVersionStr();
98+
gcDumpVersionStr = await DotnetGcDumpHelper.GetGcDumpVersionStr();
9999
}
100+
_gcDumpVersionStr = gcDumpVersionStr;
100101
RefreshTitle();
101102
Loaded = true;
102103
await RefreshProcesses();

0 commit comments

Comments
 (0)