5 Replies Latest reply: Apr 12, 2012 5:05 PM by Alex.Keh .Product.Manager-Oracle RSS

    ODP.NET Loading DLLs from incorrect client

    landyman
      Hi,

      I have a multiple Oracle homes on my machine. Recently after some configuration (which I cannot recall all that was changed) my .NET applications stopped working. Visual Studio 2010 SP1 on Windows 7 64-bit.

      I have 3 oracle homes as follows:
      c:\oracle\product\11.2.0\client_1 (full client, used by TOAD)
      c:\oracle\product\11.2.0\dbhome_1 (full 11Gr2 database install for local testing)
      c:\oracle\product\11.2.0\odac_1 (ODP.NET full install for development, this will be installed on target machines as well)

      In my App.Config, I have the following settings:
      <?xml version="1.0" encoding="utf-8"?>
      <configuration>
      <connectionStrings>
      <omitted/>
      <omitted/>
      </connectionStrings>
      <!--
      Configure Oracle ODP.NET for this machine
      -->
      <oracle.dataaccess.client>
      <settings>
      <add name="DllPath" value="C:\oracle\product\11.2.0\odac_1\bin"/>
      <add name="TraceFile" value="c:\temp\odpnet.trc"/>
      <add name="TraceLevel" value="1"/>
      <add name="TraceOption" value="1"/>
      </settings>
      </oracle.dataaccess.client>
      <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>

      however, when starting the application and attempting to open the connection, I receive a System.AccessViolationException.

      It appears that ODP.NET is loading OCI.DLL from the specified path above, but somehow calling other DLLS from multiple homes... Do I need another setting to tell it to always use the correct home?


      here is the output:

      'TestingConsoleApp.exe': Loaded 'ImageAtBase0x52380000', Loading disabled by Include/Exclude setting.
      'TestingConsoleApp.exe': Loaded 'ImageAtBase0x2f60000', Loading disabled by Include/Exclude setting.
      'TestingConsoleApp.exe': Unloaded 'ImageAtBase0x52380000'
      'TestingConsoleApp.exe': Loaded 'C:\Windows\SysWOW64\cryptsp.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\Windows\SysWOW64\rsaenh.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\Oracle.DataAccess\v4.0_4.112.2.0__89b483f429c47342\Oracle.DataAccess.dll'
      'TestingConsoleApp.exe': Loaded 'C:\Windows\assembly\NativeImages_v4.0.30319_32\System\3f34449140ee804046dc451e436b872c\System.ni.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Core\e29240619b5e9f88c28e6880c20e5579\System.Core.ni.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Data\dd664469d5e26317d699da98a048e531\System.Data.ni.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\Windows\Microsoft.NET\assembly\GAC_32\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\Windows\SysWOW64\ws2_32.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\Windows\SysWOW64\nsi.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\Windows\SysWOW64\crypt32.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\Windows\SysWOW64\msasn1.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
      'TestingConsoleApp.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
      'TestingConsoleApp.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
      'TestingConsoleApp.exe': Loaded 'C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Transactions\dfc2c8bc5a4bec2e1a994681c181881b\System.Transactions.ni.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\Windows\Microsoft.NET\assembly\GAC_32\System.Transactions\v4.0_4.0.0.0__b77a5c561934e089\System.Transactions.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\System.Transactions\v4.0_4.0.0.0__b77a5c561934e089\System.Transactions.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
      Step into: Stepping over non-user code 'object.Object'
      'TestingConsoleApp.exe': Loaded 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\diasymreader.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Configuration\20107bfda059504852f72510bdf8a151\System.Configuration.ni.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
      'TestingConsoleApp.exe': Loaded 'C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Xml\0ee7a9d89cc8f6b1610118178165ad2a\System.Xml.ni.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
      'TestingConsoleApp.exe': Loaded 'C:\Windows\SysWOW64\urlmon.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\Windows\SysWOW64\oleaut32.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\Windows\SysWOW64\iertutil.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\Windows\SysWOW64\wininet.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\Windows\SysWOW64\normaliz.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\Windows\SysWOW64\secur32.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\Windows\SysWOW64\ntmarta.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\Windows\SysWOW64\Wldap32.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\oracle\product\11.2.0\odac_1\bin\OraOps11w.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\oracle\product\11.2.0\odac_1\bin\oci.dll', Binary was not built with debug information.
      'TestingConsoleApp.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.4940_none_d08cc06a442b34fc\msvcr80.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\Windows\SysWOW64\psapi.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\oracle\product\11.2.0\client_1\bin\oraclient11.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\oracle\product\11.2.0\client_1\bin\oracore11.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\oracle\product\11.2.0\client_1\bin\oranls11.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\oracle\product\11.2.0\client_1\bin\oraunls11.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\oracle\product\11.2.0\client_1\bin\orauts.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\Windows\SysWOW64\winmm.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\oracle\product\11.2.0\client_1\bin\oracommon11.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\oracle\product\11.2.0\client_1\bin\orasnls11.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\oracle\product\11.2.0\client_1\bin\orageneric11.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\oracle\product\11.2.0\client_1\bin\oraxml11.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.4940_none_d08cc06a442b34fc\msvcp80.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\oracle\product\11.2.0\client_1\bin\oran11.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\oracle\product\11.2.0\client_1\bin\oranl11.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\oracle\product\11.2.0\client_1\bin\orantcp11.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\oracle\product\11.2.0\client_1\bin\oranldap11.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\oracle\product\11.2.0\odac_1\bin\orannzsbb11.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\Windows\SysWOW64\wsock32.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\oracle\product\11.2.0\client_1\bin\oraldapclnt11.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\oracle\product\11.2.0\client_1\bin\orancrypt11.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\Windows\SysWOW64\IPHLPAPI.DLL', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\Windows\SysWOW64\winnsi.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\oracle\product\11.2.0\client_1\bin\orazt11.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\oracle\product\11.2.0\client_1\bin\oranro11.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\oracle\product\11.2.0\client_1\bin\oranhost11.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\oracle\product\11.2.0\client_1\bin\orancds11.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\oracle\product\11.2.0\client_1\bin\orantns11.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\oracle\product\11.2.0\client_1\bin\oraztkg11.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\oracle\product\11.2.0\client_1\bin\orapls11.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\oracle\product\11.2.0\client_1\bin\ORASLAX11.DLL', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\oracle\product\11.2.0\client_1\bin\oravsn11.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\oracle\product\11.2.0\client_1\bin\oraplp11.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\oracle\product\11.2.0\client_1\bin\orahasgen11.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\Windows\SysWOW64\netapi32.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\Windows\SysWOW64\netutils.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\Windows\SysWOW64\srvcli.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\Windows\SysWOW64\wkscli.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\Windows\SysWOW64\logoncli.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\Windows\SysWOW64\samcli.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\oracle\product\11.2.0\client_1\bin\oraocr11.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\oracle\product\11.2.0\client_1\bin\oraocrb11.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\oracle\product\11.2.0\client_1\bin\oraocrutl11.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\Windows\SysWOW64\dbghelp.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\oracle\product\11.2.0\client_1\bin\oracell11.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\oracle\product\11.2.0\client_1\bin\orasql11.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\oracle\product\11.2.0\client_1\bin\oraplc11.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\Windows\SysWOW64\RpcRtRemote.dll', Cannot find or open the PDB file
      Step into: Stepping over non-user code 'Oracle.DataAccess.Client.OracleConnection.OracleConnection'
      'TestingConsoleApp.exe': Loaded 'C:\Windows\assembly\NativeImages_v4.0.30319_32\System.EnterpriseSe#\e0db4e18ac89795e7538f0220455677e\System.EnterpriseServices.ni.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\System.EnterpriseServices\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
      Step into: Stepping over non-user code 'Oracle.DataAccess.Client.OracleConnection.ConnectionString.set'
      Step into: Stepping over non-user code 'Oracle.DataAccess.Client.OracleConnection.Open'
      'TestingConsoleApp.exe': Loaded 'ImageAtBase0x60940000', Loading disabled by Include/Exclude setting.
      'TestingConsoleApp.exe': Loaded 'ImageAtBase0x2dd0000', Loading disabled by Include/Exclude setting.
      'TestingConsoleApp.exe': Unloaded 'ImageAtBase0x60940000'
      'TestingConsoleApp.exe': Loaded 'C:\Windows\assembly\NativeImages_v4.0.30319_32\System.EnterpriseSe#\e0db4e18ac89795e7538f0220455677e\System.EnterpriseServices.Wrapper.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\Windows\Microsoft.NET\assembly\GAC_32\System.EnterpriseServices\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.Wrapper.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\System.EnterpriseServices\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.Wrapper.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
      'TestingConsoleApp.exe': Loaded 'C:\Windows\SysWOW64\mswsock.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\Windows\SysWOW64\wship6.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\Windows\SysWOW64\nlaapi.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\Windows\SysWOW64\NapiNSP.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\Windows\SysWOW64\pnrpnsp.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\Windows\SysWOW64\dnsapi.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\Windows\SysWOW64\winrnr.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\Windows\SysWOW64\wshbth.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\Windows\SysWOW64\WSHTCPIP.DLL', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\Windows\SysWOW64\rasadhlp.dll', Cannot find or open the PDB file
      'TestingConsoleApp.exe': Loaded 'C:\Windows\SysWOW64\FWPUCLNT.DLL', Cannot find or open the PDB file
      First-chance exception at 0x0666deee in TestingConsoleApp.exe: 0xC0000005: Access violation reading location 0x4666e1b0.
      A first chance exception of type 'System.AccessViolationException' occurred in Oracle.DataAccess.dll
      An unhandled exception of type 'System.AccessViolationException' occurred in Oracle.DataAccess.dll

      Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

      Many thanks in advance!

      Kevin
        • 1. Re: ODP.NET Loading DLLs from incorrect client
          landyman
          OP here..

          I uninstalled and re-installed ODP.NET after much googling and the problem seems to have dissapeared, but some insight into what caused this in the first place would still be helpful.
          • 2. Re: ODP.NET Loading DLLs from incorrect client
            orafad
            Is odac now first in PATH after re-installation?
            • 3. Re: ODP.NET Loading DLLs from incorrect client
              Alex.Keh .Product.Manager-Oracle
              ODP.NET consists of managed and unmanaged code. Every time a new ODP.NET version is installed, it inserts its bin directory onto the Windows PATH setting. Thus, all existing ODP.NET apps will then use this new installed version.

              The problem that can arise is if you do not want all your ODP.NET instances using the same version. To support this scenario, you can specify the directory that each individual ODP.NET app should use to find its unmanaged DLLs via the DllPath setting in the Registry or .NET config file:

              DLL search order discussed here:
              http://docs.oracle.com/cd/E20434_01/doc/win.112/e23174/InstallODP.htm#sthref94

              DllPath setting discussed here:
              http://docs.oracle.com/cd/E20434_01/doc/win.112/e23174/featConfig.htm#BABCBFDJ
              • 4. Re: ODP.NET Loading DLLs from incorrect client
                landyman
                Thanks for the reply... as posted above I was specifying the DllPath. The question I had is why was it trying to load all those other DLLs. When I uninstalled and reinstalled this went away and it stopped looking for them. It's almost as though theres another setting or variable somewhere that has impact on this as well.
                • 5. Re: ODP.NET Loading DLLs from incorrect client
                  Alex.Keh .Product.Manager-Oracle
                  It's also possible the older version of oci.dll is being loaded by the Microsoft Distributed Transaction Coordinator. That has been an issue that some other customers have reported. DTC is a non-.NET component. It is controlled exclusively by Microsoft. If it loads oci.dll ahead of your .NET app, then the DllPath setting doesn't come into affect because Windows sees that oci.dll is already loaded into memory.

                  One way to verify this is to use process explorer. Next time you hit this error, see where your app has loaded all its dependent Oracle DLLs, whether they truly come from the same Oracle Home directory, focusing on oci.dll especially.