Page 1 of 1

Missing Devart.Data.Oracle.resources.dll file?

Posted: Tue 19 Mar 2013 07:57
by Terry
Hi,

We are using Direct mode to connect to databases from C# code in a Windows service.

We regularly get a FileNotFound exception at runtime telling us that a Devart resources DLL cannot be found. Specifically this file:

Devart.Data.Oracle.resources, Version=7.1.58.0, Culture=en-US, PublicKeyToken=09af7300eec23701

We do have Devart.Data.dll and Devart.Data.Oracle.dll present in the same folder as the service executable file but we cannot find the resources DLL anywhere in our installation.

The exception only occurs under certain circumstances which we can reproduce at will. There are 2 scenarios in which we can reproduce the error:

(1) When the target server does not exist on the network and we are trying to connect by the server name (using the IP Address throws the correct exception rather than the FileNotFound exception)

(2) When the target server exists (by name OR IP Address) but the Listener port has been specified incorrectly.

The code we are using is below

Code: Select all


           OracleConnectionStringBuilder connString = new OracleConnectionStringBuilder();
           connString.Direct = true;
           connString.Port = listenerPort;
           connString.Server = hostNameOrIp;
           connString.Sid = sidToUse;
           connString.UserId = username;
           connString.Password = password;

           orclConnection = new OracleConnection(connectionString.ConnectionString);

           try
            {
                orclConnection.Open(); [b]<----- throws FileNotFoundException here[/b]
            }
            catch (OracleException oraEx) // an error connecting
            {
                switch (oraEx.Code)
                {
                    case 12545:
                        // deal with no server found
                        break;
                    case 12541:
                        // deal with no listener on port
                        break;
                    case 1017:
                    case 1005:
                        // code to deal with invalid credentials
                        break;
                    case -1:
                        // code to deal with other issues
                        break;
                }

            }
As you can see from the code above we are expecting a bad server name or bad listener port to be caught as part of an OracleException that is thrown, and at one point when we were using the trial version (last August!) this worked perfectly!

We have built our code around version 7.1.58 but I installed the most recent version (7.6) and went back to the licensed version of 7.1.40 (which was our trial version) and it still throws the error about not finding the Devart.Data.Oracle.resources.dll

Here is the output from our log files with the full exception stack trace:

Code: Select all

18/03/2013 09:34:15 - EXCEPTION: Could not load file or assembly 'Devart.Data.Oracle.resources, Version=7.1.58.0, Culture=en-US, PublicKeyToken=09af7300eec23701' or one of its dependencies. The system cannot find the file specified.
18/03/2013 09:34:15 - STACK:    at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalGetSatelliteAssembly(String name, CultureInfo culture, Version version, Boolean throwOnFileNotFound, StackCrawlMark& stackMark)
   at System.Resources.ManifestBasedResourceGroveler.GetSatelliteAssembly(CultureInfo lookForCulture, StackCrawlMark& stackMark)
   at System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet(CultureInfo culture, Dictionary`2 localResourceSets, Boolean tryParents, Boolean createIfNotExists, StackCrawlMark& stackMark)
   at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo requestedCulture, Boolean createIfNotExists, Boolean tryParents, StackCrawlMark& stackMark)
   at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)
   at System.Resources.ResourceManager.GetString(String name, CultureInfo culture)
   at Devart.Common.ad.a(String A_0)
   at Devart.Data.Oracle.cz.a(String A_0, Int32 A_1, String A_2, String A_3)
   at Devart.Data.Oracle.ao.a(ad A_0, Boolean A_1)
   at Devart.Data.Oracle.ao.a(ad A_0, aj A_1)
   at Devart.Data.Oracle.OracleInternalConnection..ctor(ad connectionOptions, OracleInternalConnection proxyConnection)
   at Devart.Data.Oracle.cx.a(l A_0, Object A_1, DbConnectionBase A_2)
   at Devart.Common.DbConnectionFactory.a(DbConnectionPool A_0, l A_1, DbConnectionBase A_2)
   at Devart.Common.DbConnectionPoolGroup.a(DbConnectionPool A_0, DbConnectionBase A_1)
   at Devart.Common.DbConnectionPool.a(DbConnectionBase A_0)
   at Devart.Common.DbConnectionPool.GetObject(DbConnectionBase owningConnection)
   at Devart.Common.DbConnectionFactory.b(DbConnectionBase A_0)
   at Devart.Common.DbConnectionClosed.Open(DbConnectionBase outerConnection)
   at Devart.Common.DbConnectionBase.Open()
   at Devart.Data.Oracle.OracleConnection.Open()
   at Certero.EndpointServer.Oracle.Model.OracleInstance.validateConnection(OracleConnectionStringBuilder connectionString)
18/03/2013 09:34:15 - INNER_EXCEPTION: Could not load file or assembly 'file:///D:\TFS\ProductSuite\Release\1.0.0.2\Endpoint Server\Website\EndpointServer\bin\Devart.Data.Oracle.resources.dll' or one of its dependencies. The system cannot find the file specified.
18/03/2013 09:34:15 - INNER_STACK:    at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
   at System.Reflection.Assembly.LoadFrom(String assemblyFile)
   at Certero.EndpointServer.Services.Program.AssemblyResolveEventHandler(Object sender, ResolveEventArgs args) in D:\TFS\ProductSuite\Release\1.0.0.2\Endpoint Server\Services\SchedulerService\Program.cs:line 84
   at System.AppDomain.OnAssemblyResolveEvent(RuntimeAssembly assembly, String assemblyFullName)
Any and all help would be sincerely appreciated!

Thanks in advance,
Terry.

Re: Missing Devart.Data.Oracle.resources.dll file?

Posted: Tue 19 Mar 2013 09:10
by Shalex
Please try a solution which is suggested at http://social.msdn.microsoft.com/Forums ... 9b33dfd4f/:

Code: Select all

try
{
  return Assembly.LoadFrom(path);
}
catch (FileNotFoundException ex)
{
  path = path.ToLower();
  if (!path.Contains(".resources"))
  {
    throw;
  }

  return null;
}

Re: Missing Devart.Data.Oracle.resources.dll file?

Posted: Tue 19 Mar 2013 11:02
by Terry
Hi Shalex,

Thanks for your suggestion.

I am assuming that it is one of the Devart DLLs that is trying to load it's own resources (I am not loading any assemblies directly in my code) and is then getting this error. So, in that case, where should I put your suggested code? I obviously cannot amend the Devart DLL code!

Kind regards,
Terry.

Re: Missing Devart.Data.Oracle.resources.dll file?

Posted: Thu 21 Mar 2013 11:27
by Terry
The post from Shalex above has had me looking into the fact that the Devart.Data.Oracle DLL is a .NET 2.0 DLL. The app I have created is a .NET 4.0 app. There are known issues with loading internal resources when DLLs being loaded have been built against different versions of the .NET Framework.

Is there a version of the Devart.Data.Oracle DLL that has been compiled against .NET Framework 4.0? All the other tool vendors that I have 3rd party DLLs for ship their tools in versions compiled against each framework... is there a possibility that Devart could do the same?

In the meantime I'll just wait and wait for some official word.

Regards,
Terry.

Re: Missing Devart.Data.Oracle.resources.dll file?

Posted: Fri 22 Mar 2013 14:47
by Shalex
We are investigating the issue. We will post here about the result as soon as possible.

Re: Missing Devart.Data.Oracle.resources.dll file?

Posted: Mon 08 Apr 2013 08:40
by Terry
I've been patiently waiting... any updates?

Regards,
Terry.

Re: Missing Devart.Data.Oracle.resources.dll file?

Posted: Fri 12 Apr 2013 11:50
by Shalex
Although we could not reproduce the issue in our environment, we have implemented a blind fix. Please contact us via http://www.devart.com/company/contact.html and specify the e-mail you have used when registering dotConnect for Oracle, and we will send our internal build with the fix to this e-mail address.

Re: Missing Devart.Data.Oracle.resources.dll file?

Posted: Thu 18 Apr 2013 14:59
by Shalex
The issue is fixed in the current (7.7.224) build of dotConnect for Oracle.

Re: Missing Devart.Data.Oracle.resources.dll file?

Posted: Fri 19 Apr 2013 14:05
by Terry
Thank you - my issue is resolved.

Kind regards,
Terry.