mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-10 13:35:31 +02:00
Fixed exceptions in indexer and delayed execution logic (#5912)
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user