diff --git a/shadowsocks-csharp/Controller/Service/AvailabilityStatistics.cs b/shadowsocks-csharp/Controller/Service/AvailabilityStatistics.cs index 8f2e6eaa..94cbd735 100644 --- a/shadowsocks-csharp/Controller/Service/AvailabilityStatistics.cs +++ b/shadowsocks-csharp/Controller/Service/AvailabilityStatistics.cs @@ -258,9 +258,20 @@ namespace Shadowsocks.Controller Logging.Debug($"loading statistics from {path}"); if (!File.Exists(path)) { - Console.WriteLine($"statistics file does not exist, try to reload {RetryInterval / 60 / 1000} minutes later"); - _timer.Change(RetryInterval, Interval); - return; + try { + using (FileStream fs = File.Create(path)) + { + //do nothing + } + }catch(Exception e) + { + Logging.LogUsefulException(e); + } + if (!File.Exists(path)) { + Console.WriteLine($"statistics file does not exist, try to reload {RetryInterval / 60 / 1000} minutes later"); + _timer.Change(RetryInterval, Interval); + return; + } } RawStatistics = (from l in File.ReadAllLines(path).Skip(1) let strings = l.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries)