@@ -53,40 +53,40 @@ protected override async void OnExecute(object parameter)
5353 Logger . Info ( "Executing version check..." ) ;
5454
5555 var tokenSource = new CancellationTokenSource ( TimeSpan . FromSeconds ( 5 ) ) ;
56- await _versionCheck
57- . GetLatestVersionAsync ( settings , tokenSource . Token )
58- . ContinueWith ( t =>
59- {
60- if ( t . IsFaulted )
61- {
62- Logger . Warn ( t . Exception ) ;
63- return ;
64- }
56+ Version latest = default ;
6557
66- if ( _versionCheck . CurrentVersion < t . Result )
67- {
68- var proceed = true ;
69- if ( _versionCheck . IsDebugBuild || ! settings . IncludePreRelease )
70- {
71- // if the latest version has a revision number and isn't a pre-release build,
72- // avoid prompting since we can't know if the build already includes the latest version.
73- proceed = t . Result . Revision == 0 ;
74- }
58+ try
59+ {
60+ latest = await _versionCheck . GetLatestVersionAsync ( settings , tokenSource . Token ) ;
61+ }
62+ catch ( Exception e )
63+ {
64+ Logger . Warn ( e , "Version check failed." ) ;
65+ }
7566
76- if ( proceed )
77- {
78- PromptAndBrowse ( t . Result , settings . IncludePreRelease ) ;
79- }
80- else
81- {
82- Logger . Info ( "Version check skips notification of an existing newer version available." ) ;
83- }
84- }
85- else
86- {
87- Logger . Info ( "Version check completed: running current latest." ) ;
88- }
89- } ) ;
67+ if ( _versionCheck . CurrentVersion < latest )
68+ {
69+ var proceed = true ;
70+ if ( _versionCheck . IsDebugBuild || ! settings . IncludePreRelease )
71+ {
72+ // if the latest version has a revision number and isn't a pre-release build,
73+ // avoid prompting since we can't know if the build already includes the latest version.
74+ proceed = latest . Revision == 0 ;
75+ }
76+
77+ if ( proceed )
78+ {
79+ PromptAndBrowse ( latest , settings . IncludePreRelease ) ;
80+ }
81+ else
82+ {
83+ Logger . Info ( "Version check skips notification of an existing newer version available." ) ;
84+ }
85+ }
86+ else if ( latest != default )
87+ {
88+ Logger . Info ( "Version check completed: running current latest." ) ;
89+ }
9090 }
9191
9292 private void PromptAndBrowse ( Version latestVersion , bool includePreRelease )
0 commit comments