paulyoder / LinqToExcel

Use LINQ to retrieve data from spreadsheets and csv files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"Unspecified Error" when reading multiple files sequentially.

MountainBanjo opened this issue · comments

Reading multiple files with multiple worksheets in a row (approx 100 files, approx 40 worksheets in each file).

I will get "Unspecified Error" as I'm disposing and creating ExcelQueryFactories, then querying either a specific worksheet, or getting the worksheet names collection immediately after creating a new factory.

However, if I catch the error, I can work around it by running garbage collection and recreating a new ExcelQueryFactory.

_excelQueryFactory.Dispose();
Thread.Sleep(500);
_excelQueryFactory = null;
Thread.Sleep(500);
System.GC.Collect();
Thread.Sleep(500);

And then instantiate a new ExcelQueryFactory object:

...
_excelQueryFactory = new ExcelQueryFactory(xlCache.FullName)
{
UsePersistentConnection = true,
TrimSpaces = TrimSpacesType.Both,
ReadOnly = true
};


Notes:  This just started today (6/25/2021), but the size of my data in these sheets has been steadily growing.

Version: 1.11.0.0
Runtime version v2.0.50727

Other notable exception properties:

Source: Microsoft Access Database Engine

StackTrace:

> Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
>    at System.Data.ProviderBase.DbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
>    at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
>    at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
>    at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
>    at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
>    at System.Data.ProviderBase.DbConnectionInternal.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
>    at System.Data.OleDb.OleDbConnection.Open()
>    at LinqToExcel.Query.ExcelUtilities.GetWorksheetNames(ExcelQueryArgs args)
>    at LinqToExcel.Query.ExcelUtilities.GetWorksheetNames(String fileName, ExcelQueryArgs args)
>    at LinqToExcel.ExcelQueryFactory.GetWorksheetNames()