From 6411d23744e1c04548c7b5d3dde24b52e4e3b7cd Mon Sep 17 00:00:00 2001 From: Michael Bucari-Tovo Date: Thu, 23 Jun 2022 11:34:20 -0600 Subject: [PATCH] Revert "Non-null disposed BlockingCollection can throw exception" This reverts commit ba722487d8c7be977d8246e152131e9c1d829b2f. --- Source/FileManager/BackgroundFileSystem.cs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/Source/FileManager/BackgroundFileSystem.cs b/Source/FileManager/BackgroundFileSystem.cs index f3f9a747..4f68003d 100644 --- a/Source/FileManager/BackgroundFileSystem.cs +++ b/Source/FileManager/BackgroundFileSystem.cs @@ -79,13 +79,8 @@ namespace FileManager //Stop raising events fileSystemWatcher?.Dispose(); - try - { - //Calling CompleteAdding() will cause background scanner to terminate. - directoryChangesEvents?.CompleteAdding(); - } - // if directoryChangesEvents is non-null and isDisposed, this exception is thrown. there's no other way to check >:( - catch (ObjectDisposedException) { } + //Calling CompleteAdding() will cause background scanner to terminate. + directoryChangesEvents?.CompleteAdding(); //Wait for background scanner to terminate before reinitializing. backgroundScanner?.Wait();