Browse Source

Handle TaskCanceledException in RunningSearch.Run

pull/1515/head
Siegfried Pammer 7 years ago
parent
commit
418a8da306
  1. 28
      ILSpy/Search/SearchPane.cs

28
ILSpy/Search/SearchPane.cs

@ -293,20 +293,24 @@ namespace ICSharpCode.ILSpy @@ -293,20 +293,24 @@ namespace ICSharpCode.ILSpy
public async Task Run()
{
await Task.Factory.StartNew(() => {
var searcher = GetSearchStrategy();
try {
foreach (var loadedAssembly in assemblies) {
var module = loadedAssembly.GetPEFileOrNull();
if (module == null)
continue;
searcher.Search(module, cts.Token);
try {
await Task.Factory.StartNew(() => {
var searcher = GetSearchStrategy();
try {
foreach (var loadedAssembly in assemblies) {
var module = loadedAssembly.GetPEFileOrNull();
if (module == null)
continue;
searcher.Search(module, cts.Token);
}
} catch (OperationCanceledException) {
// ignore cancellation
}
} catch (OperationCanceledException) {
// ignore cancellation
}
}, cts.Token, TaskCreationOptions.LongRunning, TaskScheduler.Current).ConfigureAwait(false);
}, cts.Token, TaskCreationOptions.LongRunning, TaskScheduler.Current).ConfigureAwait(false);
} catch (TaskCanceledException) {
// ignore cancellation
}
}
AbstractSearchStrategy GetSearchStrategy()

Loading…
Cancel
Save