Selecting struct object throws 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

Selecting struct object throws System.ArgumentNullException

Post by Mac » Tue 06 Jul 2010 11:17

Hi

We have problem with selecting new struct object from linq to oracle query. The code below is throwing System.ArgumentNullException: Value cannot be null. Parameter name: constructor where Address is a struct.

Code: Select all

var test1 = from stloc in oneOfficeData.Stlocs
                            .DefaultIfEmpty()
                        from ndmas in oneOfficeData.Ndmas
                            .Where(x => x.NdmNdcode == stloc.StlocNdcode)
                            .DefaultIfEmpty()
                        select new
                        {
                            Address = new Address
                                                  {
                                                      Address1 = ndmas.NdmAddr1 ?? string.Empty,
                                                      Address2 = ndmas.NdmAddr2 ?? string.Empty,
                                                      Address3 = ndmas.NdmAddr3 ?? string.Empty,
                                                      Address4 = ndmas.NdmAddr4 ?? string.Empty,
                                                      Address5 = ndmas.NdmAddr5 ?? string.Empty,
                                                      Country = ndmas.NdmCountry ?? string.Empty,
                                                      Postcode = ndmas.NdmPostcode ?? string.Empty
                                                  }
                        }.ToList();
Stack trace:
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.h.a(bk A_0)
at Devart.Data.Linq.Provider.g.a(bk A_0)
at Devart.Data.Linq.Provider.h.a(SqlExpression A_0)
at Devart.Data.Linq.Provider.h.a(bk A_0)
at Devart.Data.Linq.Provider.g.a(bk A_0)
at Devart.Data.Linq.Provider.h.a(SqlExpression A_0)
at Devart.Data.Linq.Provider.h.a(SqlExpression A_0, Boolean A_1)
at Devart.Data.Linq.Provider.m.a(u A_0, SqlExpression A_1, Boolean A_2)
at Devart.Data.Linq.Provider.m.a(Type A_0, SqlExpression A_1, u A_2)
at Devart.Data.Linq.Provider.DataProvider.CompiledQuery.GetReaderFactory(List`1 elementInstanceTypes, u services, SqlNode query)
at Devart.Data.Linq.Provider.DataProvider.CompiledQuery..ctor(QueryInfo queryInfo, u services, Boolean isQueryObjectByKey, Object queryObjectKey)
at Devart.Data.Linq.Provider.DataProvider.BuildQuery(Expression query)
at Devart.Data.Linq.Provider.DataProvider.Devart.Data.Linq.Provider.IProvider.Compile(Expression query)
at Devart.Data.Linq.DataQuery`1.i()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList(IEnumerable`1 source)

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Tue 06 Jul 2010 15:52

Thank you for the report, I have reproduced this situation.
I will let you know about the results of our investigation.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Wed 15 Sep 2010 16:21

This problem is fixed in the upcoming build. Follow the announcements at our forum.

Post Reply