LinqToExcel: Problem after windows update (Microsoft.Jet.OLEDB.4.0 no longer works)
Hi team,
Today I update my Windows and after this, my test with LinqToExcel fails. Is any have the same problem?
Error log:
Controllers\Cargas\InformeDeCargasController.cs(81,51): warning CS0429: Se ha detectado un código de expresión al que no se puede tener acceso [D:\CruiseControl.NET\builds\TransoftWEBDesarrollo\src\Web\Web.csproj]
--
Controllers\Cargas\InformeDeCargasController.cs(82,51): warning CS0429: Se ha detectado un código de expresión al que no se puede tener acceso [D:\CruiseControl.NET\builds\TransoftWEBDesarrollo\src\Web\Web.csproj]
Error Message:
Test method Infraestructura.Test.Readers.LecturaDeMDTArchivoExcelTest.VerificaLaLecturaDeTodosLosCampos threw exception:
System.InvalidOperationException: Error en la lectura del archivo. Verifique que contenga todas las columnas requeridas.
Stack Trace:
en Infraestructura.Readers.LectorXLSMovimientosDepositoDeTerceros.LeerYRetornarEnumerator() en d:\CruiseControl.NET\builds\TransoftWEBDesarrollo\src\Infraestructura\Readers\LectorXLSMovimientosDepositoDeTerceros.cs:línea 73
en Infraestructura.Readers.LectorXLSMovimientosDepositoDeTerceros.GetEnumerator() en d:\CruiseControl.NET\builds\TransoftWEBDesarrollo\src\Infraestructura\Readers\LectorXLSMovimientosDepositoDeTerceros.cs:línea 81
en Infraestructura.Test.Readers.LecturaDeMDTArchivoExcelTest.VerificaLaLecturaDeTodosLosCampos() en d:\CruiseControl.NET\builds\TransoftWEBDesarrollo\src\Infraestructura.Test\Readers\LecturaDeMDTArchivoExcelTest.cs:línea 50
Error Message:
Test method Infraestructura.Test.Readers.LecturaArchivoExcelTest.LeeArchivoExcel threw exception:
System.Data.OleDb.OleDbException: Error no esperado desde el controlador de la base de datos externa (1) .
Stack Trace:
en System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)
en System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
en System.Data.ProviderBase.DbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
en System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
en System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
en System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
en System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
en System.Data.ProviderBase.DbConnectionInternal.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
en System.Data.OleDb.OleDbConnection.Open()
en LinqToExcel.Query.ExcelQueryExecutor.GetDataResults(SqlParts sql, QueryModel queryModel)
en LinqToExcel.Query.ExcelQueryExecutor.ExecuteCollection[T](QueryModel queryModel)
en LinqToExcel.Query.ExcelQueryExecutor.ExecuteSingle[T](QueryModel queryModel, Boolean returnDefaultWhenEmpty)
en LinqToExcel.Query.ExcelQueryExecutor.ExecuteScalar[T](QueryModel queryModel)
en Remotion.Data.Linq.Clauses.StreamedData.StreamedScalarValueInfo.ExecuteScalarQueryModel[T](QueryModel queryModel, IQueryExecutor executor)
en Remotion.Data.Linq.Clauses.StreamedData.StreamedScalarValueInfo.ExecuteQueryModel(QueryModel queryModel, IQueryExecutor executor)
en Remotion.Data.Linq.QueryModel.Execute(IQueryExecutor executor)
en Remotion.Data.Linq.QueryProviderBase.Execute[TResult](Expression expression)
en System.Linq.Queryable.Count[TSource](IQueryable`1 source)
en Infraestructura.Test.Readers.LecturaArchivoExcelTest.LeeArchivoExcel() en d:\CruiseControl.NET\builds\TransoftWEBDesarrollo\src\Infraestructura.Test\Readers\LecturaArchivoExcelTest.cs:línea 44
Test Run Failed.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 30
Investigating now: Error happens upon opening the connection. There are no more details sadly and i’m no expert on OLEDB / JetEngine, but according to wikipedia ACE 12 supports everything that OLE 4 does, so shouldn’t it be possible to simply switch ExcelUtilities.cs Line 48
to
If you have access to the source code of the application using linqtoexcel, you could also define the Engine when creating the ExcelQueryFactory like this:
using (var eqf = new ExcelQueryFactory(@"") { DatabaseEngine = DatabaseEngine.Ace })i’ll try to run the tests in a second to find out if there is any case that does not work with the solution.
Even if the database engine is defined as Ace, when “GetWorksheetNames” or “GetColumnNames” is called it’s defaulting back to the Jet engine…causing it to fail again. For now, we can use a custom build of the library.
This blog article popped up about this issue. It does confirm that this was an unintentional breakage, and that Microsoft is working on a fix:
The article of course recommends switching to ACE since Jet was deprecated 15 years ago. To me it doesn’t make sense to hack LinqToExcel to try to switch its default to use ACE instead of Jet. It makes more sense to completely remove support for Jet, and make ACE a hard requirement. Because this move removes support for a technology (in a sense), I think this should be a LinqToExcel version 2.0 sort of thing.
Look for a new release of LinqToExcel in the near future.
Hmmm… looks like other people are having issues with these recent patches (i.e. Microsoft broke something).
My recommendation would be to uninstall the following patch(es):
Translated from German from here:
Also here:
More here:
Per October 10, 2017—KB4041681 (Monthly Rollup)
Per October 10, 2017—KB4041678 (Security-only update)
So, both potentially are the cause.
Hi @streppelchen, I tried your solution 2 which to modify source code, it works for me. Thank you so much!
Ok, thanks. I will see if I can reproduce the issue.