File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -1943,7 +1943,11 @@ await Task.Factory.StartNew(() =>
19431943
19441944 private void WatchForWin32FolderChanges ( string ? folderPath )
19451945 {
1946- if ( Directory . Exists ( folderPath ) )
1946+ if ( ! Directory . Exists ( folderPath ) )
1947+ return ;
1948+
1949+ // NOTE: Suppressed NullReferenceException caused by EnableRaisingEvents
1950+ SafetyExtensions . IgnoreExceptions ( ( ) =>
19471951 {
19481952 watcher = new FileSystemWatcher
19491953 {
@@ -1956,7 +1960,7 @@ private void WatchForWin32FolderChanges(string? folderPath)
19561960 watcher . Deleted += DirectoryWatcher_Changed ;
19571961 watcher . Renamed += DirectoryWatcher_Changed ;
19581962 watcher . EnableRaisingEvents = true ;
1959- }
1963+ } , App . Logger ) ;
19601964 }
19611965
19621966 private async void DirectoryWatcher_Changed ( object sender , FileSystemEventArgs e )
You can’t perform that action at this time.
0 commit comments