diff --git a/Files/Files.csproj b/Files/Files.csproj
index 8993f2d3e6e7..031b1c4ac9f3 100644
--- a/Files/Files.csproj
+++ b/Files/Files.csproj
@@ -170,7 +170,6 @@
-
DynamicDialog.xaml
diff --git a/Files/ViewModels/ItemViewModel.cs b/Files/ViewModels/ItemViewModel.cs
index 5c1e624ceb87..449f1ac58d67 100644
--- a/Files/ViewModels/ItemViewModel.cs
+++ b/Files/ViewModels/ItemViewModel.cs
@@ -476,7 +476,6 @@ public void CancelLoadAndClearFiles()
public void CancelExtendedPropertiesLoading()
{
loadPropsCTS.Cancel();
- loadPropsCTS.Dispose();
loadPropsCTS = new CancellationTokenSource();
}
@@ -753,7 +752,7 @@ await Task.Run(async () =>
{
await loadExtendedPropsSemaphore.WaitAsync(loadPropsCTS.Token);
}
- catch (Exception ex) when (ex is OperationCanceledException || ex is ObjectDisposedException)
+ catch (OperationCanceledException)
{
return;
}
@@ -912,7 +911,7 @@ public async void RapidAddItemsToCollectionAsync(string path, string previousDir
// simply drop this instance
await enumFolderSemaphore.WaitAsync(semaphoreCTS.Token);
}
- catch (Exception ex) when (ex is OperationCanceledException || ex is ObjectDisposedException)
+ catch (OperationCanceledException)
{
return;
}
@@ -921,7 +920,6 @@ public async void RapidAddItemsToCollectionAsync(string path, string previousDir
{
// Drop all the other waiting instances
semaphoreCTS.Cancel();
- semaphoreCTS.Dispose();
semaphoreCTS = new CancellationTokenSource();
IsLoadingItems = true;
@@ -1028,7 +1026,6 @@ await folders.AsyncParallelForEach(async (folder) =>
if (addFilesCTS.IsCancellationRequested)
{
- addFilesCTS.Dispose();
addFilesCTS = new CancellationTokenSource();
IsLoadingItems = false;
return;
@@ -1080,10 +1077,6 @@ await folders.AsyncParallelForEach(async (folder) =>
}
}
}
- catch (ObjectDisposedException ex)
- {
- NLog.LogManager.GetCurrentClassLogger().Warn(ex, ex.Message);
- }
finally
{
enumFolderSemaphore.Release();
@@ -1605,7 +1598,6 @@ private void WatchForDirectoryChanges(string path)
CloseHandle(overlapped.hEvent);
operationQueue.Clear();
cts.Cancel();
- cts.Dispose();
Debug.WriteLine("aWatcherAction done: {0}", rand);
});
@@ -1835,7 +1827,7 @@ private async Task UpdateFileOrFolderAsync(string path)
{
await enumFolderSemaphore.WaitAsync(semaphoreCTS.Token);
}
- catch (Exception ex) when (ex is OperationCanceledException || ex is ObjectDisposedException)
+ catch (OperationCanceledException)
{
return;
}
@@ -1880,7 +1872,7 @@ public async Task RemoveFileOrFolderAsync(string path)
{
await enumFolderSemaphore.WaitAsync(semaphoreCTS.Token);
}
- catch (Exception ex) when (ex is OperationCanceledException || ex is ObjectDisposedException)
+ catch (OperationCanceledException)
{
return;
}
@@ -1924,9 +1916,6 @@ private void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
public void Dispose()
{
CancelLoadAndClearFiles();
- addFilesCTS?.Dispose();
- semaphoreCTS?.Dispose();
- loadPropsCTS?.Dispose();
}
}
diff --git a/Files/Views/Pages/Properties.xaml.cs b/Files/Views/Pages/Properties.xaml.cs
index a1b641cbd6fa..436abd0f585f 100644
--- a/Files/Views/Pages/Properties.xaml.cs
+++ b/Files/Views/Pages/Properties.xaml.cs
@@ -128,7 +128,6 @@ private void Properties_Consolidated(ApplicationView sender, ApplicationViewCons
if (tokenSource != null && !tokenSource.IsCancellationRequested)
{
tokenSource.Cancel();
- tokenSource.Dispose();
tokenSource = null;
}
}
@@ -141,7 +140,6 @@ private void PropertiesDialog_Closed(ContentDialog sender, ContentDialogClosedEv
if (tokenSource != null && !tokenSource.IsCancellationRequested)
{
tokenSource.Cancel();
- tokenSource.Dispose();
tokenSource = null;
}
propertiesDialog.Hide();