Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Managed ODP.NET Bug - Throws IndexOutOfRangeException when creating connection from a path containin

Qinsi.LongApr 11 2014

I find that Managed ODP.Net cannot work with windows path containning non-ascii characters. When I was trying to connect to oracle database using Oracle.ManagedDataAccess.dll from a location with non-ascii characters in its path, I got a System.IndexOutOfRangeException. Via RedGate .Net Reflector, I caught the source error line.

The error source:

OracleInternal.Network.AddressResolution.VetCIDValue(string CIDValue) //The value of CIDValue is @"E:\\Documents\\2014\\GpsMidware\\svn代码

                                                                                                          //\\map_gps\\WcfService\\bin\\Debug\\GpsMidwareService.vshost.exe"

        {

            StringBuilder builder;

            try

            {

                builder = new StringBuilder(CIDValue);

                for (int i = 0; i < builder.Length; i++)

                {

                    if (ValidChars[builder[i]] == 0) //This is where the exception is thrown. The length of the array ValidChars is only 256,

                                                               //and the value of builder[i] is its unicode value, so if the path contains any non-ascii

                                                               //character, then the index will be out of range!!!

                    {

                        builder[i] = '?';

                    }

                }

            }

            catch (Exception)

            {

                return "";

            }

            return builder.ToString();

        }

The production version of Oracle.ManagedDataAccess.dll is 4.121.1.0, the file version is 4.121.1.20131211, coming from

ODAC 12c Release 2 and Oracle Developer Tools for Visual Studio (12.1.0.1.2) http://www.oracle.com/technetwork/cn/topics/dotnet/utilsoft-086879.html

----------------------------------------------------------------------------------------------------

The call stack:

>Oracle.ManagedDataAccess.dll!OracleInternal.Network.AddressResolution.VetCIDValue(string CIDValue) Line 645C#
Oracle.ManagedDataAccess.dll!OracleInternal.Network.AddressResolution.AddressResolution() Line 166C#
[Native to Managed Transition]
Oracle.ManagedDataAccess.dll!OracleInternal.Network.OracleCommunication.Resolve(string tnsAlias) Line 247C#
Oracle.ManagedDataAccess.dll!OracleInternal.ConnectionPool.PoolManager<OracleInternal.ConnectionPool.OraclePoolManager,OracleInternal.ConnectionPool.OraclePool,OracleInternal.ServiceObjects.OracleConnectionImpl>.Initialize(Oracle.ManagedDataAccess.Client.ConnectionString cs) Line 1565C#
Oracle.ManagedDataAccess.dll!OracleInternal.ConnectionPool.OraclePoolManager.Initialize(Oracle.ManagedDataAccess.Client.ConnectionString cs) Line 258C#
Oracle.ManagedDataAccess.dll!OracleInternal.ConnectionPool.OracleConnectionDispenser<OracleInternal.ConnectionPool.OraclePoolManager,OracleInternal.ConnectionPool.OraclePool,OracleInternal.ServiceObjects.OracleConnectionImpl>.GetPM(Oracle.ManagedDataAccess.Client.ConnectionString cs, OracleInternal.ConnectionPool.OraclePoolManager conPM, Oracle.ManagedDataAccess.Client.ConnectionString pmCS, System.Security.SecureString securedPassword, System.Security.SecureString securedProxyPassword, out bool bAuthenticated, out bool newPM) Line 484C#
Oracle.ManagedDataAccess.dll!OracleInternal.ConnectionPool.OracleConnectionDispenser<OracleInternal.ConnectionPool.OraclePoolManager,OracleInternal.ConnectionPool.OraclePool,OracleInternal.ServiceObjects.OracleConnectionImpl>.Get(Oracle.ManagedDataAccess.Client.ConnectionString cs, OracleInternal.ConnectionPool.OraclePoolManager conPM, Oracle.ManagedDataAccess.Client.ConnectionString pmCS, System.Security.SecureString securedPassword, System.Security.SecureString securedProxyPassword) Line 298C#
Oracle.ManagedDataAccess.dll!Oracle.ManagedDataAccess.Client.OracleConnection.Open() Line 1308C#
DBUtility.dll!DBUtility.OracleHelper.PrepareCommand(System.Data.Common.DbCommand cmd, System.Data.Common.DbConnection conn, System.Data.Common.DbTransaction trans, System.Data.CommandType cmdType, string cmdText, System.Data.Common.DbParameter[] cmdParms) Line 238C#
DBUtility.dll!DBUtility.OracleHelper.ExecuteReader(string connectionString, System.Data.CommandType cmdType, string cmdText, System.Data.Common.DbParameter[] cmdParms) Line 155C#
DBUtility.dll!DBUtility.DBHelper.ExecuteReader(System.Data.CommandType cmdType, string cmdText, System.Data.Common.DbParameter[] cmdParms) Line 293C#
DAL.dll!DAL.CARRELATEEQUIPMENT.GetModelByEQUIPMENTID(string eQUIPMENTID) Line 118C#
BLL.dll!BLL.CARRELATEEQUIPMENT.GetModelByEQUIPMENTID(string eQUIPMENTID) Line 118C#
GpsMidwareService.exe!GpsMidwareService.GpsTerminalManager.ReadGPSNetFileData(object parameters) Line 880C#
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(object state)Unknown
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)Unknown
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)Unknown
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state)Unknown
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart(object obj)Unknown
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 9 2014
Added on Apr 11 2014
0 comments
1,761 views