mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 10:46:33 +02:00
Fixed exceptions in indexer and delayed execution logic (#5912)
This commit is contained in:
@@ -28,26 +28,35 @@ namespace Microsoft.Plugin.Indexer.SearchHelper
|
||||
// open the connection
|
||||
conn.Open();
|
||||
|
||||
// now create an OleDB command object with the query we built above and the connection we just opened.
|
||||
using (command = new OleDbCommand(sqlQuery, conn))
|
||||
try
|
||||
{
|
||||
using (wDSResults = command.ExecuteReader())
|
||||
// now create an OleDB command object with the query we built above and the connection we just opened.
|
||||
using (command = new OleDbCommand(sqlQuery, conn))
|
||||
{
|
||||
if (!wDSResults.IsClosed && wDSResults.HasRows)
|
||||
using (wDSResults = command.ExecuteReader())
|
||||
{
|
||||
while (!wDSResults.IsClosed && wDSResults.Read())
|
||||
if (!wDSResults.IsClosed && wDSResults.HasRows)
|
||||
{
|
||||
List<object> fieldData = new List<object>();
|
||||
for (int i = 0; i < wDSResults.FieldCount; i++)
|
||||
while (!wDSResults.IsClosed && wDSResults.Read())
|
||||
{
|
||||
fieldData.Add(wDSResults.GetValue(i));
|
||||
}
|
||||
List<object> fieldData = new List<object>();
|
||||
for (int i = 0; i < wDSResults.FieldCount; i++)
|
||||
{
|
||||
fieldData.Add(wDSResults.GetValue(i));
|
||||
}
|
||||
|
||||
result.Add(new OleDBResult(fieldData));
|
||||
result.Add(new OleDBResult(fieldData));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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;
|
||||
|
||||
Reference in New Issue
Block a user