Fixed exceptions in indexer and delayed execution logic (#5912)

This commit is contained in:
Arjun Balgovind
2020-08-12 12:44:55 -07:00
committed by GitHub
parent 95e82ca359
commit f3babcb46e
2 changed files with 48 additions and 32 deletions

View File

@@ -28,6 +28,8 @@ namespace Microsoft.Plugin.Indexer.SearchHelper
// open the connection // open the connection
conn.Open(); conn.Open();
try
{
// now create an OleDB command object with the query we built above and the connection we just opened. // now create an OleDB command object with the query we built above and the connection we just opened.
using (command = new OleDbCommand(sqlQuery, conn)) using (command = new OleDbCommand(sqlQuery, conn))
{ {
@@ -50,6 +52,13 @@ namespace Microsoft.Plugin.Indexer.SearchHelper
} }
} }
// AccessViolationException can occur if another query is made before the current query completes. Since the old query would be cancelled we can ignore the exception
catch (System.AccessViolationException)
{
// do nothing
}
}
return result; return result;
} }

View File

@@ -511,6 +511,8 @@ namespace PowerLauncher.ViewModel
// Run the slower query of the DelayedExecution plugins // Run the slower query of the DelayedExecution plugins
currentCancellationToken.ThrowIfCancellationRequested(); currentCancellationToken.ThrowIfCancellationRequested();
Parallel.ForEach(plugins, (plugin) => Parallel.ForEach(plugins, (plugin) =>
{
try
{ {
if (!plugin.Metadata.Disabled) if (!plugin.Metadata.Disabled)
{ {
@@ -539,6 +541,11 @@ namespace PowerLauncher.ViewModel
UpdateResultsListViewAfterQuery(query, true); UpdateResultsListViewAfterQuery(query, true);
} }
} }
}
catch (OperationCanceledException)
{
// nothing to do here
}
}); });
} }