Page 1 of 1

System.ArgumentNullException

Posted: Sun 23 Aug 2009 22:42
by Mac
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.

Posted: Tue 25 Aug 2009 10:57
by Shalex
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.

Posted: Tue 25 Aug 2009 11:27
by Mac
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.

Posted: Wed 26 Aug 2009 15:27
by Shalex
We have answered you by e-mail.

what was the solution?

Posted: Tue 14 Dec 2010 00:13
by vajarov
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.

Posted: Tue 14 Dec 2010 17:11
by StanislavK
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).