Could not load file or assembly Devart.Data.Oracle

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
mromeijn
Posts: 2
Joined: Fri 03 Jan 2014 16:11

Could not load file or assembly Devart.Data.Oracle

Post by mromeijn » Mon 20 Jan 2014 10:22

The Devart assemblies in our windows service solution have been upgraded since those assemblies are also upgraded on the buildserver. Devart is installed there because of the licence.

4 devart dll's included in the windows service and upgraded are:

Devart.data.dll (from version 5.0.1.0 to 5.0.536.0)
Devart.data.oracle.dll (from version 5.20.33.0 to 7.2.77.0)
Devart.data.oracle.linq (from version 1.0.13.0 to 4.1.82.0)
Devart.data.oracle.linq (from version 1.0.13.0 to 4.1.82.0)

Everything works fine on our test machines, 32/64 bit machines and with Oracle 10/11.
We have deployed and now things start getting complicated at (pilot)customers sites since upgrading.
The first error we encountered is an InvalidCastException error:

Message : Unable to cast object of type 'Devart.Data.Oracle.OracleConnection' to type 'Devart.Data.Oracle.OracleConnection'.
Source : Devart.Data.Oracle.Linq

These customers appear to have Devart dll's in the GAC (Global Assembly Cache):

Devart.data.dll version 5.0.21.0
Devart.data.oracle version 5.35.62.0

Maybe a reference prefers GAC over what's in its own directory and ignores version numbers. At one site we've boldy asked to remove these Devart assemblies from the GAC.
It changed the error to a FileLoadException:

Message : Could not load file or assembly 'Devart.Data.Oracle, Version=5.35.62.0, Culture=neutral, PublicKeyToken=09af7300eec23701' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Deinstalling and reinstalling the webservice did not help.
The devart references in the referencing project have properties Copy Local ‘True’ and Specific Version ‘False’
What is still referencing this wrong dll version?

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Could not load file or assembly Devart.Data.Oracle

Post by MariiaI » Tue 21 Jan 2014 08:45

These customers appear to have Devart dll's in the GAC (Global Assembly Cache)
Yes, the issue occurs because there are old assemblies in the GAC. You can try adding the corresponding bindingRedirect entries to the *.config file of your application: http://msdn.microsoft.com/en-us/library/eftw1fys.aspx . This should help.
Message : Could not load file or assembly 'Devart.Data.Oracle, Version=5.35.62.0, Culture=neutral, PublicKeyToken=09af7300eec23701' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Make sure that the assemblies with the correct versions are loaded to your application, e.g. that the Modules window (Debug-> Windows-> Modules) displays the following versions:
- Devart.Data.dll - 5.0.536
- Devart.Data.Oracle.dll - 7.2.77
- Devart.Data.Linq.dll - 4.1.82
- Devart.Data.Oracle.Linq.dll - 4.1.82
Check that the correct versions are specified in the *.config file, rebuild your project and check versions of the assemblies in the bin folder of the application.

Please notify us about the results.

mromeijn
Posts: 2
Joined: Fri 03 Jan 2014 16:11

Re: Could not load file or assembly Devart.Data.Oracle

Post by mromeijn » Tue 28 Jan 2014 13:02

In Visual Studio the Devart assemblies are loaded with the correct versions. So nothing is wrong here.
We have instructed to add the bindingRedirects for Devart assemblies in the .config file. The error disappeared in the deployed application. Hip, hip, hurrah! :D

Thank you very much for this solution.

Maybe only the .config file adjustment was required, but we have also instructed to delete the publisher policy files of corresponding Devart assemblies in de GAC. In these files a publisher can specify assembly redirections.

Post Reply