Revert "Non-null disposed BlockingCollection can throw exception"

This reverts commit ba722487d8c7be977d8246e152131e9c1d829b2f.
This commit is contained in:
Michael Bucari-Tovo 2022-06-23 11:34:20 -06:00
parent 1a74736115
commit 6411d23744

View File

@ -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) { }
//Wait for background scanner to terminate before reinitializing.
backgroundScanner?.Wait();