enhance: avoid unhandled exceptions in timer

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2025-03-31 19:06:10 +08:00
parent 55be1ad1ca
commit 8e55ba1b47
No known key found for this signature in database

View file

@ -2512,6 +2512,8 @@ namespace SourceGit.ViewModels
} }
private void AutoFetchImpl(object sender) private void AutoFetchImpl(object sender)
{
try
{ {
if (!_settings.EnableAutoFetch || _isAutoFetching) if (!_settings.EnableAutoFetch || _isAutoFetching)
return; return;
@ -2538,6 +2540,11 @@ namespace SourceGit.ViewModels
_lastFetchTime = DateTime.Now; _lastFetchTime = DateTime.Now;
Dispatcher.UIThread.Invoke(() => IsAutoFetching = false); Dispatcher.UIThread.Invoke(() => IsAutoFetching = false);
} }
catch
{
// DO nothing, but prevent `System.AggregateException`
}
}
private string _fullpath = string.Empty; private string _fullpath = string.Empty;
private string _gitDir = string.Empty; private string _gitDir = string.Empty;