System.ArgumentNullException

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
Mac
Posts: 12
Joined: Sun 23 Aug 2009 22:33

System.ArgumentNullException

Post by Mac » Sun 23 Aug 2009 22:42

Hi, I'm running the following linq query against an Oracle 9.2 database

var query = from c in Context.Customers
join ca in Context.CustomerAddress on c.DlcusCustomer equals ca.SmAccount
join a in Context.Address on ca.SmNacode equals a.NdmNdcode
where c.DlcusCode1 == "Y" && a.NdmAdcha1 == "Y"
select new Model.CustomerAddress
{
Code = ca.Address.NdmNdcode,
Email = ca.Address.NdmEmail,
Fax = ca.Address.NdmTelex,
Telephone = ca.Address.NdmTelephone,
Name = ca.Address.NdmName,
IsInvoice = Convert.ToBoolean((c.DlcusAppacc == a.NdmNdcode) ? 1 : 0),
Address =
new Model.Address
{
Address1 = ca.Address.NdmAddr1,
Address2 = ca.Address.NdmAddr2,
Address3 = ca.Address.NdmAddr3,
Address4 = ca.Address.NdmAddr4,
Address5 = ca.Address.NdmAddr5,
Country = ca.Address.NdmCountry,
Postcode = ca.Address.NdmPostcode
}
};

return query.ToList();

The query is generating the following pl/sql

SELECT t15.NDM_NDCODE AS "NdmNdcode", t14.NDM_NAME AS "NdmName", t13.NDM_ADDR1 AS "NdmAddr1", t12.NDM_ADDR2 AS "NdmAddr2", t11.NDM_ADDR3 AS "NdmAddr3", t10.NDM_ADDR4 AS "NdmAddr4", t9.NDM_ADDR5 AS "NdmAddr5", t8.NDM_POSTCODE AS "NdmPostcode", t7.NDM_COUNTRY AS "NdmCountry", t6.NDM_TELEPHONE AS "NdmTelephone", t5.NDM_TELEX AS "NdmTelex", t4.NDM_EMAIL AS "NdmEmail",
(CASE
WHEN t1.DLCUS_APPACC = t3.NDM_NDCODE THEN :p1
ELSE :p2
END) AS C1
FROM MACL.DLCUST t1
INNER JOIN MACL.SMDEL t2 ON t1.DLCUS_CUSTOMER = t2.SM_ACCOUNT
INNER JOIN MACL.NDMAS t3 ON t2.SM_NACODE = t3.NDM_NDCODE
INNER JOIN MACL.NDMAS t4 ON t2.SM_NACODE = t4.NDM_NDCODE
INNER JOIN MACL.NDMAS t5 ON t2.SM_NACODE = t5.NDM_NDCODE
INNER JOIN MACL.NDMAS t6 ON t2.SM_NACODE = t6.NDM_NDCODE
INNER JOIN MACL.NDMAS t7 ON t2.SM_NACODE = t7.NDM_NDCODE
INNER JOIN MACL.NDMAS t8 ON t2.SM_NACODE = t8.NDM_NDCODE
INNER JOIN MACL.NDMAS t9 ON t2.SM_NACODE = t9.NDM_NDCODE
INNER JOIN MACL.NDMAS t10 ON t2.SM_NACODE = t10.NDM_NDCODE
INNER JOIN MACL.NDMAS t11 ON t2.SM_NACODE = t11.NDM_NDCODE
INNER JOIN MACL.NDMAS t12 ON t2.SM_NACODE = t12.NDM_NDCODE
INNER JOIN MACL.NDMAS t13 ON t2.SM_NACODE = t13.NDM_NDCODE
INNER JOIN MACL.NDMAS t14 ON t2.SM_NACODE = t14.NDM_NDCODE
INNER JOIN MACL.NDMAS t15 ON t2.SM_NACODE = t15.NDM_NDCODE
WHERE (t1.DLCUS_CODE1 = :p0) AND (t3.NDM_ADCHA1 = :p0)


ParameterName = p0
DbType = String
Value = Y
ParameterName = p1
DbType = Int32
Value = 1
ParameterName = p2
DbType = Int32
Value = 0

which returns the expected rows when run in oracle sql developer, however the query is throwing the following exception in my unit tests

System.ArgumentNullException: System.ArgumentNullException : Value cannot be null.
Parameter name: constructor
at System.Linq.Expressions.Expression.New(ConstructorInfo constructor, IEnumerable`1 arguments)
at System.Linq.Expressions.Expression.New(ConstructorInfo constructor, Expression[] arguments)
at Devart.Data.Linq.Provider.g.b.a(a0 A_0)
at Devart.Data.Linq.Provider.g.b.a(SqlExpression A_0)
at Devart.Data.Linq.Provider.g.b.a(a0 A_0)
at Devart.Data.Linq.Provider.g.b.a(SqlExpression A_0)
at Devart.Data.Linq.Provider.g.b.b(SqlExpression A_0)
at Devart.Data.Linq.Provider.g.a(d A_0, SqlExpression A_1)
at Devart.Data.Linq.Provider.g.a(Type A_0, SqlExpression A_1, d A_2)
at Devart.Data.Linq.Provider.DataProvider.d.a(Int32 A_0)
at Devart.Data.Linq.Provider.DataProvider.a(d A_0, f A_1, IDbConnection A_2, IDataReader A_3)
at Devart.Data.Linq.Provider.DataProvider.a(d A_0, f A_1, Object[] A_2, Object[] A_3, Object A_4)
at Devart.Data.Linq.Provider.DataProvider.a(d A_0, Object[] A_1)
at Devart.Data.Linq.Provider.DataProvider.h(Expression A_0)
at Devart.Data.Linq.DataQuery`1.i()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)

Any ideas what might be causing this?

Thanks in advance
Mac.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Tue 25 Aug 2009 10:57

Please try using the latest 5.25.39 version of dotConnect for Oracle. Does the problem persist with the 5.25.39 version as well? Could you please send the generated DataContext class to us via our contact form (http://www.devart.com/company/contact.html)? We will look at this issue.

Mac
Posts: 12
Joined: Sun 23 Aug 2009 22:33

Post by Mac » Tue 25 Aug 2009 11:27

I'm currently evaluating the trial copy (5.25.39.0) which I downloaded on Monday last week.

I'll send the generated DataContext file as you suggest though, if you need any further information just let me know.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Wed 26 Aug 2009 15:27

We have answered you by e-mail.

vajarov
Posts: 13
Joined: Mon 19 Jul 2010 18:03

what was the solution?

Post by vajarov » Tue 14 Dec 2010 00:13

Hi - could you please post the actual solution? I am having a very similar problem:

if I use up to a particular number of properties when new-ing up the object, it is all well. However, if I add one more to the list, I get the mentioned exception. Was this resolved ?

Any help is greatly appreciated. G.

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Tue 14 Dec 2010 17:11

We couldn't reproduce the problem with the latest 6.0.58 version. Could you please specify the following:
1) the version of dotConnect for Oracle you are using;
2) the query with which the problem occurs;
3) the definitions of the database objects used (if possible, please send us the model you are working with).

Post Reply