Click here to Skip to main content
15,886,091 members
Please Sign up or sign in to vote.
1.44/5 (2 votes)
See more:
System.ArgumentNullException: Value cannot be null

Parameter name : Key

Error occurs in conn.open()

The application is not able to connect to the database.
but connection string is provided in webconfig file.

The authentication is through sqlserver
and the database tables of the rest of the application is Oracle.
Provider : Oracle.ManagedDataAccess.Client


Value cannot be null.
Parameter name: key
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.ArgumentNullException: Value cannot be null.
Parameter name: key

Source Error: 


Line 179:                OracleDataAdapter da = new OracleDataAdapter(cmd);
Line 180:                DataSet ds = new DataSet();
Line 181:                conn.Open();
Line 182:                da.Fill(ds);
Line 183:

stack trace:
[ArgumentNullException: Value cannot be null.
Parameter name: key]
   System.Collections.Generic.Dictionary`2.FindEntry(TKey key) +12994473
   OracleInternal.Common.SyncDictionary`2.ContainsKey(K k) +79
   OracleInternal.ConnectionPool.PoolManager`3.CreateServiceCtx(PR pr) +58
   OracleInternal.ConnectionPool.PoolManager`3.PutNewPR(PR pr, Boolean bForPoolPopulation) +288
   OracleInternal.ConnectionPool.PoolManager`3.CreateNewPR(Int32 reqCount, Boolean bForPoolPopulation, ConnectionString csWithDiffOrNewPwd, CriteriaCtx criteriaCtx, String instanceName, List`1 switchFailedInstNames) +3667
   OracleInternal.ConnectionPool.PoolManager`3.Get(ConnectionString csWithDiffOrNewPwd, Boolean bGetForApp, CriteriaCtx criteriaCtx, String affinityInstanceName, Boolean bForceMatch) +8424
   OracleInternal.ConnectionPool.OraclePoolManager.Get(ConnectionString csWithNewPassword, Boolean bGetForApp, CriteriaCtx criteriaCtx, String affinityInstanceName, Boolean bForceMatch) +951
   OracleInternal.ConnectionPool.OracleConnectionDispenser`3.Get(ConnectionString cs, PM conPM, ConnectionString pmCS, SecureString securedPassword, SecureString securedProxyPassword, CriteriaCtx criteriaCtx) +1024
   Oracle.ManagedDataAccess.Client.OracleConnection.Open() +3287
   ********.DAL.GetRequestorID(String currentUserEmail) in C:\Users\*****\Documents\Visual Studio 2015\Projects\Main\******\******\DAL.cs:181
   *******._Default.Page_Load(Object sender, EventArgs e) in C:\Users\*****\Documents\Visual Studio 2015\Projects\Main\******\********\Default.aspx.cs:21
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
   System.Web.UI.Control.OnLoad(EventArgs e) +95
   System.Web.UI.Control.LoadRecursive() +59
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +780


What I have tried:

Changing the oracle provider to ODAC Provider.
Posted
Updated 2-Aug-18 21:51pm
v3
Comments
Dave Kreskowiak 18-Dec-17 11:52am    
Show the connection string. That's probably where the problem is going to be if it throws on the conn.Open() call.
Dave Kreskowiak 18-Dec-17 14:11pm    
Do those "Data Source" names you starred out appear in TNSNAMES.ORA?
UpATL 18-Dec-17 14:52pm    
The Datasource is the server ip address
the connection is not using the tns file
Dave Kreskowiak 18-Dec-17 16:32pm    
Unless I'm missing something, that's not going to work. The Oracle descriptor, which looks something like this:
(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(PORT=MyPort)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=MyOracleSID)))

either has to be in the TNSNAME.ORA file with a name, which your Data Source will use to refer to it, or that stuff has to be the value for Data Source. For example:
Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(PORT=MyPort)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=MyOracleSID)));User Id=******;Password=**************
UpATL 19-Dec-17 12:00pm    
The connection string used to work before
<add name="******ConnectionString" connectionString="Data Source=servername/tst;PASSWORD=***;USER ID=****" providerName="Oracle.ManagedDataAccess.Client" />

A common reason of above error is described here: System.ArgumentNullException: Value cannot be null.[^]
 
Share this answer
 
I had the same problem with this provider.
Unability of archiver to start was the cause of error.
My solution was to increase db_recovery_file_dest_size.

Oracle not sending some parameters (named "AUTH_SC_*") during "handshake" if archiver is not working while database is in archivelog mode. Some of this parameters blindly used by logic of ManagedDataAccess driver.

It looks like fun combination of insignificant errors in OracleRDBMS and "managed"-driver.

See: ArgumentNullException (paramname key)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900