mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-03 09:46:54 +02:00
[PTRun][Program]Fix FileSystemWatcher Crash (#15480)
* fix FileSystemWatcher crash * catch general exception
This commit is contained in:
committed by
GitHub
parent
ba431c5bfd
commit
5035dc6754
@@ -40,9 +40,15 @@ namespace Microsoft.Plugin.Program.Storage
|
||||
var invalidPaths = new List<string>();
|
||||
foreach (var path in paths)
|
||||
{
|
||||
if (!Directory.Exists(path))
|
||||
try
|
||||
{
|
||||
Log.Warn($"Directory {path} does not exist and will be ignored", typeof(Win32ProgramFileSystemWatchers));
|
||||
Directory.GetFiles(path);
|
||||
}
|
||||
#pragma warning disable CA1031 // Do not catch general exception types
|
||||
catch (Exception ex)
|
||||
#pragma warning restore CA1031 // Do not catch general exception types
|
||||
{
|
||||
Log.Exception($"Failed to get files in {path}", ex, typeof(Win32ProgramFileSystemWatchers));
|
||||
invalidPaths.Add(path);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user