Null reference problem

Posts   
 
    
bswami1
User
Posts: 16
Joined: 06-Jan-2005
# Posted on: 05-Aug-2005 19:22:05   

Adapter 1.0.2004.1

This code used to work on my computer. Even now it works on another computer. I have 1.0.2004.1 and 1.0.2004.2 in the GAC if that has anything to do with it. I think it has nothing to do with it.

I get the following error:


IRetrievalQuery selectQuery = DynamicQueryEngine.CreateSelectDQ(fieldsToReturn, DbUtils.DetermineConnectionToUse(containingTransaction), 
selectFilter, maxNumberOfItemsToReturn, sortClauses, relations, false, null, pageNumber, pageSize);
base.ExecuteMultiRowRetrievalQuery(selectQuery, containingTransaction, entityFactoryToUse, collectionToFill, false, validatorToUse


and the stack trace looks like this.


[NullReferenceException: Object reference not set to an instance of an object.]
   SD.LLBLGen.Pro.DQE.SqlServer.DynamicQueryEngine.CreateSelectDQ(IEntityFieldCore[] selectList, IFieldPersistenceInfo[] fieldsPersistenceInfo, IDbConnection connectionToUse, IPredicate selectFilter, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relationsToWalk, Boolean allowDuplicates, IGroupByCollection groupByClause, Int32& uniqueMarker)
   SD.LLBLGen.Pro.DQE.SqlServer.DynamicQueryEngine.CreateSelectDQ(IEntityFieldCore[] selectList, IFieldPersistenceInfo[] fieldsPersistenceInfo, IDbConnection connectionToUse, IPredicate selectFilter, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relationsToWalk, Boolean allowDuplicates, IGroupByCollection groupByClause, Int32 pageNumber, Int32 pageSize)
   SD.LLBLGen.Pro.DQE.SqlServer.DynamicQueryEngine.CreateSelectDQ(IEntityFields selectList, IDbConnection connectionToUse, IPredicate selectFilter, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relationsToWalk, Boolean allowDuplicates, IGroupByCollection groupByClause, Int32 pageNumber, Int32 pageSize)
   CMEDB.DaoClasses.DepartmentDAO.CreateAndRunMultiInstanceRetrievalQuery(IEntityFields fieldsToReturn, ITransaction containingTransaction, IEntityCollection collectionToFill, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses, IEntityFactory entityFactoryToUse, IPredicate selectFilter, IValidator validatorToUse, IRelationCollection relations, Int32 pageNumber, Int32 pageSize) in C:\Inetpub\wwwroot\CME00\CMEDb\DaoClasses\DepartmentDAO.cs:794
   CMEDB.DaoClasses.DepartmentDAO.GetMulti(ITransaction containingTransaction, IEntityCollection collectionToFill, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses, IEntityFactory entityFactoryToUse, IValidator validatorToUse, IPredicate selectFilter, IRelationCollection relations, Int32 pageNumber, Int32 pageSize) in C:\Inetpub\wwwroot\CME00\CMEDb\DaoClasses\DepartmentDAO.cs:244
   CMEDB.CollectionClasses.DepartmentCollection.GetMulti(IPredicate selectFilter, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relations, Int32 pageNumber, Int32 pageSize) in C:\Inetpub\wwwroot\CME00\CMEDb\CollectionClasses\DepartmentCollection.cs:640
   CMEDB.CollectionClasses.DepartmentCollection.GetMulti(IPredicate selectFilter, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses) in C:\Inetpub\wwwroot\CME00\CMEDb\CollectionClasses\DepartmentCollection.cs:589
   CME.Data.DataWrapper.Department_SuperGetAll() in C:\Inetpub\wwwroot\CME00\CMEOffice\DataWrapper.cs:76
   CME.UserControls.DepartAndSub.SuperLoad() in C:\Inetpub\wwwroot\CME00\CMEAppFillIn\UserControls\DepartAndSub.ascx.cs:107
   CME.UserControls.DepartAndSub.Page_Load(Object sender, EventArgs e) in C:\Inetpub\wwwroot\CME00\CMEAppFillIn\UserControls\DepartAndSub.ascx.cs:40
   System.Web.UI.Control.OnLoad(EventArgs e) +67
   System.Web.UI.Control.LoadRecursive() +35
   System.Web.UI.Control.LoadRecursive() +98
   System.Web.UI.Control.LoadRecursive() +98
   System.Web.UI.Page.ProcessRequestMain() +750

I ran the profiler on Sql Server. LLBLGenPro does talk to the database to pull entities. However, I think the problem is with multi-entity pull.

Any help ? Thanks in advance.

bswami1
User
Posts: 16
Joined: 06-Jan-2005
# Posted on: 05-Aug-2005 19:35:36   

Correction. I just tried to pull collections out with no query. That worked out OK.

Another thing. The problem is at more than one place in the sense, it is just not a piece of code which causes this problem but many pieces.

Also, I copied the whole VS set up from the working computer to mine and it has the same problem. (unless I screwed up in the copying)....

bswami1
User
Posts: 16
Joined: 06-Jan-2005
# Posted on: 05-Aug-2005 19:45:57   

For example, this code has same problem....



 CMEDB.CollectionClasses.OrganizationCollection aCollect = new CMEDB.CollectionClasses.OrganizationCollection();

            IPredicateExpression predicate = new PredicateExpression();
            predicate.Add(PredicateFactory.CompareValue(CMEDB.OrganizationFieldIndex.OrgID,ComparisonOperator.Equal,5));

            aCollect.GetMulti(predicate);

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 07-Aug-2005 11:18:15   

Your code looks ok, and I have similar code which works fine, so reproducing it is a bit hard. I also can't find a bug fix related to this.

You have 1.0.2004.2 as well on your system, though you still use 1.0.2004.1 templates and runtimes or a mix?

Frans Bouma | Lead developer LLBLGen Pro
bswami1
User
Posts: 16
Joined: 06-Jan-2005
# Posted on: 08-Aug-2005 17:44:28   

I donot what fixed it but I did add a reference to ORMsupportClasses, removed 1.0.2004.1 from the GAC and ran the VS project. It seems to working OK. (I also put 2004.1 in the GAC and once again, it is running OK). Weird.

Thanks for looking by.....

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 08-Aug-2005 18:12:15   

Glad it's solved! simple_smile

Frans Bouma | Lead developer LLBLGen Pro