Page 1 of 1

dotConnect for Oracle 6.30: NullReferenceException

Posted: Thu 19 May 2011 15:18
by marco.schwingel
Hi,

since we switched to the new version of dotConnect for Oracle 6.30.160 we get an NullReferenceException.

Here's the code snippet:

Code: Select all

var lv_result = (from c in lv_context.clsValidCustomerGroups
                 select new DTO.clsDropDownElement()
                 {
                   ID = c.CustomerGroupId,
                   Name = c.CustomerGroupName
                 }).OrderBy(p => p.Name).ToList();
where DTO.clsDropDownElement is a plain object with only two properties (id (integer), name (string)).

If we do NOT create a new clsDropDownElement-object and use an anonymouse type, it works

Code: Select all

var lv_result = (from c in lv_context.clsValidCustomerGroups
                 select new
                 {
                   ID = c.CustomerGroupId,
                   Name = c.CustomerGroupName
                 }).OrderBy(p => p.Name).ToList();

Here's the stack trace:

Code: Select all

Exception: System.NullReferenceException
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Message: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Stack:
--------------------------------------------------------------------------------------------------------------------------------
   bei Devart.Data.Linq.Provider.g.a(bg A_0)
   bei Devart.Data.Linq.Provider.h.a(bg A_0)
   bei Devart.Data.Linq.Provider.g.a(SqlExpression A_0)
   bei Devart.Data.Linq.Provider.g.a(SqlExpression A_0, Boolean A_1)
   bei Devart.Data.Linq.Provider.n.a(IDataServices A_0, SqlExpression A_1, Boolean A_2)
   bei Devart.Data.Linq.Provider.n.a(IDataServices A_0, SqlExpression A_1)
   bei Devart.Data.Linq.Provider.n.a(Type A_0, SqlExpression A_1, IDataServices A_2)
   bei Devart.Data.Linq.Provider.DataProvider.CompiledQuery.GetReaderFactory(List`1 elementInstanceTypes, IDataServices services, SqlNode query)
   bei Devart.Data.Linq.Provider.DataProvider.CompiledQuery..ctor(QueryInfo queryInfo, IDataServices services, Boolean isQueryObjectByKey, Object queryObjectKey)
   bei Devart.Data.Linq.Provider.DataProvider.BuildQuery(Expression query)
   bei Devart.Data.Linq.Provider.DataProvider.Devart.Data.Linq.Provider.IProvider.Compile(Expression query)
   bei Devart.Data.Linq.DataQuery`1.i()
   bei System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   bei System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   bei AxiCenter.QueryProvider.Misc.clsCustomerGroup.GetDropDownListCustomerGroup(String p_defaultEntry) Zeile 45.

It would be nice if you can point me to a solution.

Thank you!
Regards, Marco

Posted: Fri 20 May 2011 13:47
by StanislavK
Thank you for the report. We have reproduced and fixed this problem. The fix will be available in the nearest build.

As a temporary workaround, you can, e.g., use an anonymous type, and then convert the collection to a list of clsDropDownElement's:

Code: Select all

var lv_result = (from c in lv_context.clsValidCustomerGroups 
                 select new  
                 { 
                   ID = c.CustomerGroupId, 
                   Name = c.CustomerGroupName 
                 })
                 .OrderBy(p => p.Name)
                 .Select(a => new DTO.clsDropDownElement() 
                   { ID = a.ID, Name = a.Name })
                 .ToList();
Please tell us if this helps.

Having the same issue

Posted: Thu 26 May 2011 08:48
by Mac
I have the same issue upgrading DevArt to version 6.30.160.0 and it is not practical to change all the existing code to use anonymous types. When will this build be available?

StanislavK wrote:Thank you for the report. We have reproduced and fixed this problem. The fix will be available in the nearest build.

As a temporary workaround, you can, e.g., use an anonymous type, and then convert the collection to a list of clsDropDownElement's:

Code: Select all

var lv_result = (from c in lv_context.clsValidCustomerGroups 
                 select new  
                 { 
                   ID = c.CustomerGroupId, 
                   Name = c.CustomerGroupName 
                 })
                 .OrderBy(p => p.Name)
                 .Select(a => new DTO.clsDropDownElement() 
                   { ID = a.ID, Name = a.Name })
                 .ToList();
Please tell us if this helps.

Posted: Thu 26 May 2011 15:38
by StanislavK
We plan to release the build with the fix next week. We will post here when it is available.

At the moment, you can, e.g., use the 6.10.141 version. Provided that you have an active subscription, you should be able to download it from Registered Users' Area.

Posted: Thu 26 May 2011 15:57
by Mac
Thanks for the reply,

I think I'll wait though, the main reason for upgrading to this version is the template and template editor improvements.

Posted: Fri 03 Jun 2011 17:00
by StanislavK
We have released the new 6.30.165 build of dotConnect for Oracle, which includes the fix for NRE being thrown when selecting non-entity objects. You can download this build from
http://www.devart.com/dotconnect/oracle/download.html
(the trial version) or from Registered Users' Area (for users with active subscription only):
http://secure.devart.com/

For the detailed information about the fixes and improvements available in dotConnect for Oracle 6.30.165, please refer to
http://www.devart.com/forums/viewtopic.php?t=21148