Rx8.3.2: ADO-Error after Update from Ranorex 8.3.0

Bug reports.
BCTest
Posts: 127
Joined: Tue Jun 03, 2014 10:15 am
Location: Hamburg, Germany

Rx8.3.2: ADO-Error after Update from Ranorex 8.3.0

Post by BCTest » Mon Jan 14, 2019 1:24 pm

Hello,

we noticed a serious behaviour after the update from Ranorex 8.3.0 to 8.3.2: Simple queries to a MS-ACC-DB fail now. The only change we made was the Ranorex version.
We made both, an update and a reinstall, but the result was always the same: ADO throws an exception.
We made a little project to reproduce this issue and attached it to this post. A litte ACC-Database is included as well as the last succesfully report. This demo-project was made with version 8.3.0 and works fine.
DbTestRx830.zip
After update/reinstall the same project fails in version 8.3.2: How can we fix the ADO-data access?

Regards,
bctest
OLE-Automation.png
You do not have the required permissions to view the files attached to this post.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Rx8.3.2: ADO-Error after Update from Ranorex 8.3.0

Post by odklizec » Mon Jan 14, 2019 2:37 pm

Hi,

My guess is that your problem is caused by this breaking change, introduced in Ranorex 8.3.0 (see release notes):
The Ranorex Office plugin no longer contains Microsoft Office Interop Assemblies to interface directly with MS Office types, like the types returned from ExcelApplication.GetExcelApplicationObject() -> if you directly use Office Interop types, please download the official Microsoft Office Interop Assemblies(Microsoft Office 2007 or higher) and reference them in your project to resolve the Interop types
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

BCTest
Posts: 127
Joined: Tue Jun 03, 2014 10:15 am
Location: Hamburg, Germany

Re: Rx8.3.2: ADO-Error after Update from Ranorex 8.3.0

Post by BCTest » Mon Jan 14, 2019 3:04 pm

odklizec wrote:
Mon Jan 14, 2019 2:37 pm
Hi,

My guess is that your problem is caused by this breaking change, introduced in Ranorex 8.3.0 (see release notes):
The Ranorex Office plugin no longer contains Microsoft Office Interop Assemblies to interface directly with MS Office types, like the types returned from ExcelApplication.GetExcelApplicationObject() -> if you directly use Office Interop types, please download the official Microsoft Office Interop Assemblies(Microsoft Office 2007 or higher) and reference them in your project to resolve the Interop types
Hi odklizec,

I'm not sure.
This change already was included in Ranorex 8.3.0, so I think it would be a problem in Ranorex 8.3.0, too. But the demo project works in Ranorex 8.3.0 and it fails because of a change in Ranorex 8.3.1 or 8.3.2.
But I agree, maybe I have to change the coding ... but how?

Regards,
bctest.

BCTest
Posts: 127
Joined: Tue Jun 03, 2014 10:15 am
Location: Hamburg, Germany

Re: Rx8.3.2: ADO-Error after Update from Ranorex 8.3.0

Post by BCTest » Mon Jan 14, 2019 3:09 pm

Just to clarify here the code:
using (var connection = new OleDbConnection(connStr))
    {
        connection.Open();
        
        using (var command = new OleDbCommand(sql, connection))
Creating the OLECommand-Object (last line) fails,

Regards,
bctest

ahoisl
Certified Professional
Certified Professional
Posts: 192
Joined: Fri Sep 07, 2007 8:16 am

Re: Rx8.3.2: ADO-Error after Update from Ranorex 8.3.0

Post by ahoisl » Mon Jan 14, 2019 11:50 pm

I just downloaded and tried your sample with 8.3.2 ... and everything just went fine, no errors, data access works flawlessly.
Capture.PNG
Can you please give some more information on the exception you encounter, like exception message and stacktrace. Basically, most of it should be in your report by clicking on the "Show/Hide Stacktrace" link.

Technically, the code you run to access the database is almost completely unrelated to Ranorex as it just uses plain .NET types. You should be able to compile/run that part of the code (inside the user code method) even without Ranorex being installed, e.g. using Visual Studio. That said, it's weird that a Ranorex bug fix version should have an influence on that code...

Regards,
Alex
Ranorex Team
You do not have the required permissions to view the files attached to this post.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Rx8.3.2: ADO-Error after Update from Ranorex 8.3.0

Post by odklizec » Tue Jan 15, 2019 8:56 am

Hi Alex,

I can confirm bctest's finding. The code fails for me as well with 8.3.2 (I've not tried it with 8.3.0). Just one interesting finding. If

Code: Select all

connection.Open();
line is moved after

Code: Select all

using (var command = new OleDbCommand(sql, connection)) 
line, there is not thrown an error on 'OleDbCommand' line, but it fails the same on 'ExecuteReader' line. Generally speaking the code looks OK to me? It's just some sort of 'missing dependency' error?
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

ahoisl
Certified Professional
Certified Professional
Posts: 192
Joined: Fri Sep 07, 2007 8:16 am

Re: Rx8.3.2: ADO-Error after Update from Ranorex 8.3.0

Post by ahoisl » Tue Jan 15, 2019 8:58 am

As you can reproduce the problem, but I couldn't, can any of you please post the error message you get?

Regards,
Alex
Ranorex Team

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Rx8.3.2: ADO-Error after Update from Ranorex 8.3.0

Post by odklizec » Tue Jan 15, 2019 9:09 am

Error says just this:
Internal OLE Automation error
Show/Hide Stacktrace
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr)at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)at System.Data.OleDb.OleDbCommand.ExecuteReader()at DbTestRx8.TestReader.GetId(String sql) in c:\temp\RanorexStudioProjects\DbTestRx8\DbTestRx8\TestReader.UserCode.cs:line 61at DbTestRx8.TestReader.ReadData() in c:\temp\RanorexStudioProjects\DbTestRx8\DbTestRx8\TestReader.UserCode.cs:line 40at DbTestRx8.TestReader.Ranorex.Core.Testing.ITestModule.Run() in c:\temp\RanorexStudioProjects\DbTestRx8\DbTestRx8\TestReader.cs:line 82at Ranorex.Core.Testing.TestModuleLeaf.RunInternal(DataContext parentDataContext, Int32 iteration, Int32 iterationCount, Boolean skipIteration)
Please find attached studio and solution trace logs.
You do not have the required permissions to view the files attached to this post.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

BCTest
Posts: 127
Joined: Tue Jun 03, 2014 10:15 am
Location: Hamburg, Germany

Re: Rx8.3.2: ADO-Error after Update from Ranorex 8.3.0

Post by BCTest » Tue Jan 15, 2019 9:28 am

Hi Alex,
oh, I forgot some information, sorry.

1. This behaviour appears only on Win 10 (1709, no updates available) not on Win 7. On Win 7 the test works fine.

2. The stacktrace
Interner Fehler bei OLE-Automatisierung
Show/Hide Stacktrace
bei System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr)bei System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)bei System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)bei System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)bei System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)bei System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)bei System.Data.OleDb.OleDbCommand.ExecuteReader()bei DbTestRx8.TestReader.GetId(String sql) in c:\DbTestRx8\DbTestRx8\TestReader.UserCode.cs:Zeile 62.bei DbTestRx8.TestReader.ReadData() in c:\DbTestRx8\DbTestRx8\TestReader.UserCode.cs:Zeile 40.bei DbTestRx8.TestReader.Ranorex.Core.Testing.ITestModule.Run() in c:\DbTestRx8\DbTestRx8\TestReader.cs:Zeile 82.bei Ranorex.Core.Testing.TestModuleLeaf.RunInternal(DataContext parentDataContext, Int32 iteration, Int32 iterationCount, Boolean skipIteration)

3. I agree, the affected code is unrelated to Ranorex and nevertheless I can not understand: Why did this code worked in Ranorex 8.3.0 and failed in Ranorex 8.3.2? The only thing changed is the Ranorex version.
I created and executed the project with Ranorex 8.3.0, deinstalled Ranorex, installed Ranorex 8.3.2 and tried to execute the project without any other changes. The executing machine is still the same and all its other componentes were unchanged. Only Ranorex was updated/changed so I estimate it could be a change in Ranorex that is responsible for the altered behaviour. Am I wrong?
And last but not least: Compiling and executing this method with VS2015 also works.

Regards,
bctest

BCTest
Posts: 127
Joined: Tue Jun 03, 2014 10:15 am
Location: Hamburg, Germany

Re: Rx8.3.2: ADO-Error after Update from Ranorex 8.3.0

Post by BCTest » Tue Jan 15, 2019 10:53 am

BCTest wrote:
Tue Jan 15, 2019 9:28 am
This behaviour appears only on Win 10 (1709, no updates available) not on Win 7. On Win 7 the test works fine.
Unfortunately still the same behaviour after update to Win 10 (1809)

Regards,
bctest

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Rx8.3.2: ADO-Error after Update from Ranorex 8.3.0

Post by odklizec » Tue Jan 15, 2019 10:57 am

Just for fun, have you tried to rollback Ranorex 8.3.0? It would be interesting to know, if the problem is solved by using 8.3.0. I'm just unable to test it.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

BCTest
Posts: 127
Joined: Tue Jun 03, 2014 10:15 am
Location: Hamburg, Germany

Re: Rx8.3.2: ADO-Error after Update from Ranorex 8.3.0

Post by BCTest » Tue Jan 15, 2019 11:42 am

odklizec wrote:
Tue Jan 15, 2019 10:57 am
Just for fun, have you tried to rollback Ranorex 8.3.0? It would be interesting to know, if the problem is solved by using 8.3.0. I'm just unable to test it.
Yes,
that's what I've done to reproduce this behaviour. Deinstalling 8.3.2 and installing 8.3.0 "fixes" this problem.

Regards,
bctest

ahoisl
Certified Professional
Certified Professional
Posts: 192
Joined: Fri Sep 07, 2007 8:16 am

Re: Rx8.3.2: ADO-Error after Update from Ranorex 8.3.0

Post by ahoisl » Tue Jan 15, 2019 10:51 pm

We were able to reproduce the problem on Windows 10 and we also know which change caused the problem, i.e. a change in native DLL probing directories. Unfortunately, we don't understand why the change actually causes a problem.

The good thing is that we found a workaround, which should theoretically not be needed, but worked in our tests. Would be great if you could try the workaround and give us feedback. Thank you!

Workaround:
Call the below method just once in your test executable before creating a Jet OLEDB connection in order to preload the native "vbajet32.dll" library from the system directory, e.g in the Program.cs Main method (Theoretically, the OleDbConnection should load this DLL automatically, but it obviously does not any more.)
// --- place all this code in Program.cs ---

// place this at the top of your file next to other using statements
using System.Runtime.InteropServices;
...
// calls this method in once in the Main method
LoadLibrary(@"vbajet32.dll");
...
// place this somewhere in the Program.cs file
[DllImport("kernel32", SetLastError=true, CharSet = CharSet.Ansi)]
static extern IntPtr LoadLibrary([MarshalAs(UnmanagedType.LPStr)]string lpFileName);
Regards,
Alex
Ranorex Team

BCTest
Posts: 127
Joined: Tue Jun 03, 2014 10:15 am
Location: Hamburg, Germany

Re: Rx8.3.2: ADO-Error after Update from Ranorex 8.3.0

Post by BCTest » Wed Jan 16, 2019 8:18 am

Hi Alex,

thanks for the workaround: It works.
Success.png
Do you know how Ranorex will handle this problem in future? Will there be a change in Ranorex so it will load this library when needed automatically?

Regards,
bctest
You do not have the required permissions to view the files attached to this post.

ahoisl
Certified Professional
Certified Professional
Posts: 192
Joined: Fri Sep 07, 2007 8:16 am

Re: Rx8.3.2: ADO-Error after Update from Ranorex 8.3.0

Post by ahoisl » Wed Jan 16, 2019 8:40 am

Like I said in my previous post, we currently don't know why this issue happens as the DLL required by the Jet connection is actually in one of the DLL probing directories - "theoretically" (as documented by the Windows APIs) it should have worked out of the box :|
And we cannot revert the change that causes this new behavior since it fixes an even more serious problem. Until now, we only know of this OLEDB Jet connection weirdness caused by the change.

So for now, please stick with the workaround, we will not add a fix shortly, but wait if other issues pop up for the same reason. Probably we could then see a common reason for the issue...

And thank you again for reporting the issue! :D

Regards,
Alex
Ranorex Team