none
Getting Exception "System.Reflection.TargetInvocationException" when trying to access oracle database through Entity Framework in Coded UI Test RRS feed

  • Question

  • Hi,

    I have created a Coded UI Test project with the following settings:
    NuGet Packages Installed:
    EntityFramework 6.0.0 
    Oracle.ManagedDataAccess.EntityFrameWork 12.1.2400
    Oracle.ManagedDataAccess 12.1.2400

    Target Framework:.Net Framework 4.5.2

    When trying to access the oracle database through Entity Eramework 6.0.0, I get the exception below:

    Result Message:

    Test method ExcelDBImplementation.CodedUITest1.CodedUITestOracleEntityFramework threw exception: 
    System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'System.Data.Entity.SqlServer.SqlProviderServices' threw an exception. ---> System.TypeLoadException: Could not load type 'System.Data.Entity.Infrastructure.TableExistenceChecker' from assembly 'EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

    However, when running a console application project or a unit test project with the same settings, it runs sucessfully. Is there any difference in the Coded UI Test project that causes this difference in behaviour?

    Thursday, August 10, 2017 3:02 AM

All replies

  • Coded UI Test

    What is a Coded UI Test?

    Thursday, August 10, 2017 12:00 PM
  • Automated tests that drive your application through its user interface (UI) are known as coded UI tests (CUITs).
    Friday, August 11, 2017 2:04 AM
  • Hi abubakar.semasaba,

    Please re-install the entity framework Package and upgrade to the lasted version and check if it works. please refer to the following steps.

    1. Open your solution and go to Tools -> Nuget Package Manager -> Package Manager Console

    2. Select the project that uses EF and is having the problem

    3. Type Uninstall-package EntityFramework

    4. You should be prompted to restart Visual Studio so close and reopen VS and your solution

    5. Open Package Manager Console with Tools...Library Package Manager...Package Manager Console

    6. Type Install-package EntityFramework

    Best regards,

    Cole Wu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Friday, August 11, 2017 3:16 AM
  • Hi Cole,
    Thanks for the reply. I tried doing what you has mentioned however, I am still getting the same error.

    Br,
    Abubakar
    Friday, August 11, 2017 3:36 AM
  • Hi abubakar.semasaba,

    Since our policy, we could not install oracle on my machine, I could not reproduce your issue on my side. I would suggest that you could post your issue on oracle for suitable support.

    https://community.oracle.com/community/database/developer-tools/windows_and_.net/oracle_developer_tools_for_visual_studio

    Thanks for your understanding.

    Best regards,

    Cole


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, August 21, 2017 1:21 AM
  • Ok sure, let me try that and see how it goes.

    Regards,
    Abubakar
    Monday, August 21, 2017 1:55 AM
  • Hi abubakar.semasaba,

    If you have other entity framework, welcome to post here.

    Best regards,

    Cole


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, August 21, 2017 5:13 AM
  • Hi Cole,

    There has been no response from the forum since I last posted. And the problem is still persisting.

    Regards,
    Abubakar.
    Monday, August 28, 2017 1:50 AM