NullReferenceException when creating SQL Query

Posts   
 
    
ZM
User
Posts: 3
Joined: 06-Oct-2023
# Posted on: 06-Aug-2024 22:41:57   

LLBLGen Version + Buildnr: 5.3 (5.3.4) RTM

Runtime Version: v4.0.30319 Version 5.3.0.0

Template Group: Adapter

.NET Version: 4.8

Database: SQL Server 15.0.4382 RTM

The error occurs in the CreateSelectDQ function when attempting to build the query to fetch an entity graph. However, it only occurs if specific prefetch paths have been added. Most of the prefetch paths seem to work correctly. The prefetch paths that cause the exception when added all have FKs to the Parent Entity that is being fetched. I've looked at the relationships between the entities in the database and designer, but they seem to be correct. The only distinct difference I notice between the functioning paths and the non functioning is that all of the paths having issue are 1:n relationships. All relationships m:1 seem to be working.

StackTrace:

System.NullReferenceException
  HResult=0x80004003
  Message=Object reference not set to an instance of an object.
  Source=SD.LLBLGen.Pro.ORMSupportClasses
  StackTrace:
   at SD.LLBLGen.Pro.ORMSupportClasses.DynamicQueryEngineBase.AppendResultsetFields(IEntityFieldCore[] selectList, IFieldPersistenceInfo[] fieldsPersistenceInfo, IRelationCollection relationsToWalk, QueryFragments projection, Boolean sortClausesSpecified, Boolean allowDuplicates, Boolean allowAliasesInSubQuery, UniqueList`1 distinctViolatingTypes, IRetrievalQuery query, UniqueList`1& fieldNamesInSelectList, Boolean& distinctViolatingTypesFound, Boolean& pkFieldSeen)
   at SD.LLBLGen.Pro.DQE.SqlServer.DynamicQueryEngine.CreateSelectDQ(IEntityFieldCore[] selectList, IFieldPersistenceInfo[] fieldsPersistenceInfo, IRetrievalQuery query, IPredicate selectFilter, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relationsToWalk, Boolean allowDuplicates, IGroupByCollection groupByClause, Boolean relationsSpecified, Boolean sortClausesSpecified)
   at SD.LLBLGen.Pro.ORMSupportClasses.DynamicQueryEngineBase.CreateSelectDQ(IEntityFieldCore[] selectList, IFieldPersistenceInfo[] fieldsPersistenceInfo, DbConnection connectionToUse, IPredicate selectFilter, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relationsToWalk, Boolean allowDuplicates, IGroupByCollection groupByClause)
   at SD.LLBLGen.Pro.ORMSupportClasses.DbSpecificCreatorBase.CreateSubQuery(IEntityFieldCore[] selectList, IFieldPersistenceInfo[] fieldPersistenceInfos, IPredicate selectFilter, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relationsToWalk, IGroupByCollection groupByClause, Boolean allowDuplicates)
   at SD.LLBLGen.Pro.ORMSupportClasses.FieldCompareSetPredicate.ToQueryText(Boolean inHavingClause)
   at SD.LLBLGen.Pro.ORMSupportClasses.PredicateExpression.ToQueryText(Boolean inHavingClause)
   at SD.LLBLGen.Pro.ORMSupportClasses.PredicateExpression.ToQueryText(Boolean inHavingClause)
   at SD.LLBLGen.Pro.ORMSupportClasses.PredicateExpression.ToQueryText(Boolean inHavingClause)
   at SD.LLBLGen.Pro.ORMSupportClasses.DynamicQueryEngineBase.AppendWhereClause(IPredicate filter, QueryFragments destination, IQuery query)
   at SD.LLBLGen.Pro.DQE.SqlServer.DynamicQueryEngine.CreateSelectDQ(IEntityFieldCore[] selectList, IFieldPersistenceInfo[] fieldsPersistenceInfo, IRetrievalQuery query, IPredicate selectFilter, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relationsToWalk, Boolean allowDuplicates, IGroupByCollection groupByClause, Boolean relationsSpecified, Boolean sortClausesSpecified)
   at SD.LLBLGen.Pro.ORMSupportClasses.DynamicQueryEngineBase.CreateSelectDQ(IEntityFieldCore[] selectList, IFieldPersistenceInfo[] fieldsPersistenceInfo, DbConnection connectionToUse, IPredicate selectFilter, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relationsToWalk, Boolean allowDuplicates, IGroupByCollection groupByClause)
   at SD.LLBLGen.Pro.DQE.SqlServer.DynamicQueryEngine.CreatePagingSelectDQ(IEntityFieldCore[] selectList, IFieldPersistenceInfo[] fieldsPersistenceInfo, DbConnection connectionToUse, IPredicate selectFilter, Int32 rowsToSkip, Int32 rowsToTake, ISortExpression sortClauses, IRelationCollection relationsToWalk, Boolean allowDuplicates, IGroupByCollection groupByClause)
   at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterCore.CreateSelectDQ(QueryParameters parameters)
   at Coda.DataAccessLayer.DataAccessAdapter.CreateSelectDQ(QueryParameters parameters) in C:\projects\RingMaster\Coda.DataAccessLayer\Custom\DataAccessAdapter.vb:line 219
   at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterCore.FetchEntityCollectionInternal(QueryParameters parameters)
   at SD.LLBLGen.Pro.ORMSupportClasses.PrefetchPathFetcher.FetchPrefetchPath(QueryParameters rootNodeParameters, Boolean forceParameterizedPPath, ITransaction transactionToUse, Int32 parameterisedPrefetchPathThreshold, Action`1 fetchNodeFunc, Action`4 mergeManyToManyFunc)
   at SD.LLBLGen.Pro.ORMSupportClasses.PersistenceCore.FetchPrefetchPath(QueryParameters rootNodeParameters, Boolean forceParameterizedPPath, ITransaction transactionToUse, Int32 parameterisedPrefetchPathThreshold, Action`1 fetchNodeFunc, Action`4 mergeManyToManyFunc)
   at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.<>c__DisplayClass13_0.<FetchPrefetchPath>b__0()
   at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterCore.FetchAdditionalPrefetchPath(IPrefetchPath2 prefetchPath, Context contextToUse, IEntity2 fetchedEntity, IRelationPredicateBucket filterToUse)
   at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterCore.FetchEntityUsingFilter(IEntity2 entityToFetch, IPrefetchPath2 prefetchPath, Context contextToUse, IRelationPredicateBucket filter, ExcludeIncludeFieldsList excludedIncludedFields)
   at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterCore.FetchEntity(IEntity2 entityToFetch, IPrefetchPath2 prefetchPath, Context contextToUse, ExcludeIncludeFieldsList excludedIncludedFields)
   at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.<>c__DisplayClass9_0.<FetchEntity>b__0()
   at Coda.DataAccessLayer.DataAccessAdapter.FetchEntity(IEntity2 entityToFetch, IPrefetchPath2 prefetchPath, Context contextToUse, ExcludeIncludeFieldsList excludedIncludedFields) in C:\projects\RingMaster\Coda.DataAccessLayer\Custom\DataAccessAdapter.vb:line 128
   at Coda.DataAccessGateway.DataAccessGateway.ClientRequestPackage.FetchEntity(IEntity2& entity, PrefetchPath2 prefetchPath, Boolean allowDuplicates, ExcludeIncludeFieldsList ExcludeIncludeFields) in C:\projects\RingMaster\Coda.DataAccessGateway\DataAccessGateway.vb:line 453
   at Coda.DataAccessGateway.DataAccessGateway.FetchEntity(IEntity2& entity, PrefetchPath2 prefetchPath, Boolean allowDuplicates, ExcludeIncludeFieldsList excludeIncludeFields) in C:\projects\RingMaster\Coda.DataAccessGateway\DataAccessGateway.vb:line 61
   at Coda.BusinessServicesProviders.EntityManagers.EntityManagerBase.FetchEntity(CommonEntityBase& entity, PrefetchPath2 prefetchPath, Boolean allowDuplicates, ExcludeIncludeFieldsList& excludeIncludeFields) in C:\projects\RingMaster\Coda.BusinessServicesProviders\EntityManagers\EntityManagerBase.vb:line 40
   at Coda.BusinessServicesProviders.EntityManagers.EntityManagerBase.FetchEntity(CommonEntityBase& entity, PrefetchPath2 prefetchPath) in C:\projects\RingMaster\Coda.BusinessServicesProviders\EntityManagers\EntityManagerBase.vb:line 46
   at Coda.BusinessServicesProviders.EntityManagers.LaborCategoryChangeRequestManager.GetEntity(Guid laborCategoryChangeRequest_ID, LaborCategoryChangeRequestGraphType LaborCategoryChangeRequestGraphType) in C:\projects\RingMaster\Coda.BusinessServicesProviders\EntityManagers\LaborCategoryChangeRequestManager.vb:line 42
   at Coda.BusinessServicesProviders.EntityManagers.LaborCategoryChangeRequestManager.GetEntityForDataEntryForm(Guid LaborCategoryChangeRequest_ID) in C:\projects\RingMaster\Coda.BusinessServicesProviders\EntityManagers\LaborCategoryChangeRequestManager.vb:line 56
   at Coda.UI.LaborCategoryChangeRequestForm.GetEntity(Object entityPK) in C:\projects\RingMaster\Coda\Forms\Labor Category Change Requests\LaborCategoryChangeRequestForm.vb:line 211
   at Coda.UI.ParentDataEntryFormBase.AsyncGetEntityWorker_DoWork(Object Sender, DoWorkEventArgs e) in C:\projects\RingMaster\Coda.UI.Core\Forms\ParentDataEntryFormBase.vb:line 232
   at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)
   at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)
--- End of stack trace from previous location ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Coda.UI.ParentDataEntryFormBase.AsyncGetEntityWorker_RunWorkerCompleted(Object sender, RunWorkerCompletedEventArgs e) in C:\projects\RingMaster\Coda.UI.Core\Forms\ParentDataEntryFormBase.vb:line 251
   at System.ComponentModel.BackgroundWorker.OnRunWorkerCompleted(RunWorkerCompletedEventArgs e)
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39730
Joined: 17-Aug-2003
# Posted on: 07-Aug-2024 07:53:08   

Please try to narrow it down to a small query which fails (so if it fails with fetching orders + customers, then only do that) in a unit test, and it might very well be that your persistence info is out of sync with what's in the designer. This sometimes happens when merging changes in sourcecontrol, so try to reproduce it by generating code in a new empty folder and reference that code in your test.

On disk you have the runtime libraries with .pdb files. Please try to place the ormsupport classes dll + its pdb in your executable folder as well to see where crashes exactly, as there are no line numbers present in your stacktrace

Frans Bouma | Lead developer LLBLGen Pro
ZM
User
Posts: 3
Joined: 06-Oct-2023
# Posted on: 15-Aug-2024 18:27:55   

Otis wrote:

Please try to narrow it down to a small query which fails (so if it fails with fetching orders + customers, then only do that) in a unit test, and it might very well be that your persistence info is out of sync with what's in the designer. This sometimes happens when merging changes in sourcecontrol, so try to reproduce it by generating code in a new empty folder and reference that code in your test.

On disk you have the runtime libraries with .pdb files. Please try to place the ormsupport classes dll + its pdb in your executable folder as well to see where crashes exactly, as there are no line numbers present in your stacktrace

Using .NET Reflector I've narrowed down where the crash is occurring with line numbers. I've also simplified the query to the smallest one that breaks. It seems that the selectList that is passed to AppendResultsetFields contains a singular null value that causes the null reference here: pkFieldSeen = (pkFieldSeen Or selectList(i).IsPrimaryKey)

The code snippet and stack trace are below, do you have any idea what I might be doing wrong that causes that null value in the selectList?

Protected Sub AppendResultsetFields(ByVal selectList As IEntityFieldCore(), ByVal fieldsPersistenceInfo As IFieldPersistenceInfo(), ByVal relationsToWalk As IRelationCollection, ByVal projection As QueryFragments, ByVal sortClausesSpecified As Boolean, ByVal allowDuplicates As Boolean, ByVal allowAliasesInSubQuery As Boolean, ByVal distinctViolatingTypes As UniqueList(Of String), ByVal query As IRetrievalQuery, <Out> ByRef fieldNamesInSelectList As UniqueList(Of String), <Out> ByRef distinctViolatingTypesFound As Boolean, <Out> ByRef pkFieldSeen As Boolean)
            fieldNamesInSelectList = New UniqueList(Of String)(selectList.Length)
            pkFieldSeen = False
            distinctViolatingTypesFound = False
            Dim i As Integer
            For i = 0 To selectList.Length - 1
                pkFieldSeen = (pkFieldSeen Or selectList(i).IsPrimaryKey)
                Dim fragment As String = If((fieldsPersistenceInfo(i) Is Nothing), Me.GetNullInProjectionFragment, Me.Creator.CreateFieldName(selectList(i), fieldsPersistenceInfo(i), selectList(i).Alias, Me.DetermineObjectAliasToUseForSelectListField(selectList(i), relationsToWalk), True))
                Dim str2 As String = String.Empty
**Stack Trace:**
System.NullReferenceException
  HResult=0x80004003
  Message=Object reference not set to an instance of an object.
  Source=SD.LLBLGen.Pro.ORMSupportClasses
  StackTrace:
   at SD.LLBLGen.Pro.ORMSupportClasses.DynamicQueryEngineBase.AppendResultsetFields(IEntityFieldCore[] selectList, IFieldPersistenceInfo[] fieldsPersistenceInfo, IRelationCollection relationsToWalk, QueryFragments projection, Boolean sortClausesSpecified, Boolean allowDuplicates, Boolean allowAliasesInSubQuery, UniqueList`1 distinctViolatingTypes, IRetrievalQuery query, UniqueList`1& fieldNamesInSelectList, Boolean& distinctViolatingTypesFound, Boolean& pkFieldSeen) in C:\Users\ZMinshall\AppData\Local\Red Gate\.NET Reflector\Cache\0\SD.LLBLGen.Pro.ORMSupportClasses.pdb.source\SD\LLBLGen\Pro\ORMSupportClasses\DynamicQueryEngineBase.vb:line 108
   at SD.LLBLGen.Pro.DQE.SqlServer.DynamicQueryEngine.CreateSelectDQ(IEntityFieldCore[] selectList, IFieldPersistenceInfo[] fieldsPersistenceInfo, IRetrievalQuery query, IPredicate selectFilter, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relationsToWalk, Boolean allowDuplicates, IGroupByCollection groupByClause, Boolean relationsSpecified, Boolean sortClausesSpecified) in C:\Users\ZMinshall\AppData\Local\Red Gate\.NET Reflector\Cache\0\SD.LLBLGen.Pro.DQE.SqlServer.pdb.source\SD\LLBLGen\Pro\DQE\SqlServer\DynamicQueryEngine.vb:line 421
   at SD.LLBLGen.Pro.ORMSupportClasses.DynamicQueryEngineBase.CreateSelectDQ(IEntityFieldCore[] selectList, IFieldPersistenceInfo[] fieldsPersistenceInfo, DbConnection connectionToUse, IPredicate selectFilter, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relationsToWalk, Boolean allowDuplicates, IGroupByCollection groupByClause) in C:\Users\ZMinshall\AppData\Local\Red Gate\.NET Reflector\Cache\0\SD.LLBLGen.Pro.ORMSupportClasses.pdb.source\SD\LLBLGen\Pro\ORMSupportClasses\DynamicQueryEngineBase.vb:line 581
   at SD.LLBLGen.Pro.ORMSupportClasses.DbSpecificCreatorBase.CreateSubQuery(IEntityFieldCore[] selectList, IFieldPersistenceInfo[] fieldPersistenceInfos, IPredicate selectFilter, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relationsToWalk, IGroupByCollection groupByClause, Boolean allowDuplicates) in C:\Users\ZMinshall\AppData\Local\Red Gate\.NET Reflector\Cache\0\SD.LLBLGen.Pro.ORMSupportClasses.pdb.source\SD\LLBLGen\Pro\ORMSupportClasses\DbSpecificCreatorBase.vb:line 481
   at SD.LLBLGen.Pro.ORMSupportClasses.FieldCompareSetPredicate.ToQueryText(Boolean inHavingClause) in C:\Users\ZMinshall\AppData\Local\Red Gate\.NET Reflector\Cache\0\SD.LLBLGen.Pro.ORMSupportClasses.pdb.source\SD\LLBLGen\Pro\ORMSupportClasses\FieldCompareSetPredicate.vb:line 226
   at SD.LLBLGen.Pro.ORMSupportClasses.PredicateExpression.ToQueryText(Boolean inHavingClause) in C:\Users\ZMinshall\AppData\Local\Red Gate\.NET Reflector\Cache\0\SD.LLBLGen.Pro.ORMSupportClasses.pdb.source\SD\LLBLGen\Pro\ORMSupportClasses\PredicateExpression.vb:line 178
   at SD.LLBLGen.Pro.ORMSupportClasses.PredicateExpression.ToQueryText(Boolean inHavingClause) in C:\Users\ZMinshall\AppData\Local\Red Gate\.NET Reflector\Cache\0\SD.LLBLGen.Pro.ORMSupportClasses.pdb.source\SD\LLBLGen\Pro\ORMSupportClasses\PredicateExpression.vb:line 178
   at SD.LLBLGen.Pro.ORMSupportClasses.PredicateExpression.ToQueryText(Boolean inHavingClause) in C:\Users\ZMinshall\AppData\Local\Red Gate\.NET Reflector\Cache\0\SD.LLBLGen.Pro.ORMSupportClasses.pdb.source\SD\LLBLGen\Pro\ORMSupportClasses\PredicateExpression.vb:line 178
   at SD.LLBLGen.Pro.ORMSupportClasses.DynamicQueryEngineBase.AppendWhereClause(IPredicate filter, QueryFragments destination, IQuery query) in C:\Users\ZMinshall\AppData\Local\Red Gate\.NET Reflector\Cache\0\SD.LLBLGen.Pro.ORMSupportClasses.pdb.source\SD\LLBLGen\Pro\ORMSupportClasses\DynamicQueryEngineBase.vb:line 171
   at SD.LLBLGen.Pro.DQE.SqlServer.DynamicQueryEngine.CreateSelectDQ(IEntityFieldCore[] selectList, IFieldPersistenceInfo[] fieldsPersistenceInfo, IRetrievalQuery query, IPredicate selectFilter, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relationsToWalk, Boolean allowDuplicates, IGroupByCollection groupByClause, Boolean relationsSpecified, Boolean sortClausesSpecified) in C:\Users\ZMinshall\AppData\Local\Red Gate\.NET Reflector\Cache\0\SD.LLBLGen.Pro.DQE.SqlServer.pdb.source\SD\LLBLGen\Pro\DQE\SqlServer\DynamicQueryEngine.vb:line 450
   at SD.LLBLGen.Pro.ORMSupportClasses.DynamicQueryEngineBase.CreateSelectDQ(IEntityFieldCore[] selectList, IFieldPersistenceInfo[] fieldsPersistenceInfo, DbConnection connectionToUse, IPredicate selectFilter, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relationsToWalk, Boolean allowDuplicates, IGroupByCollection groupByClause) in C:\Users\ZMinshall\AppData\Local\Red Gate\.NET Reflector\Cache\0\SD.LLBLGen.Pro.ORMSupportClasses.pdb.source\SD\LLBLGen\Pro\ORMSupportClasses\DynamicQueryEngineBase.vb:line 581
   at SD.LLBLGen.Pro.DQE.SqlServer.DynamicQueryEngine.CreatePagingSelectDQ(IEntityFieldCore[] selectList, IFieldPersistenceInfo[] fieldsPersistenceInfo, DbConnection connectionToUse, IPredicate selectFilter, Int32 rowsToSkip, Int32 rowsToTake, ISortExpression sortClauses, IRelationCollection relationsToWalk, Boolean allowDuplicates, IGroupByCollection groupByClause) in C:\Users\ZMinshall\AppData\Local\Red Gate\.NET Reflector\Cache\0\SD.LLBLGen.Pro.DQE.SqlServer.pdb.source\SD\LLBLGen\Pro\DQE\SqlServer\DynamicQueryEngine.vb:line 381
   at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterCore.CreateSelectDQ(QueryParameters parameters) in C:\Users\ZMinshall\AppData\Local\Red Gate\.NET Reflector\Cache\0\SD.LLBLGen.Pro.ORMSupportClasses.pdb.source\SD\LLBLGen\Pro\ORMSupportClasses\DataAccessAdapterCore.vb:line 388
   at Coda.DataAccessLayer.DataAccessAdapter.CreateSelectDQ(QueryParameters parameters) in C:\projects\RingMaster\Coda.DataAccessLayer\Custom\DataAccessAdapter.vb:line 219
   at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterCore.FetchEntityCollectionInternal(QueryParameters parameters) in C:\Users\ZMinshall\AppData\Local\Red Gate\.NET Reflector\Cache\0\SD.LLBLGen.Pro.ORMSupportClasses.pdb.source\SD\LLBLGen\Pro\ORMSupportClasses\DataAccessAdapterCore.vb:line 1024
   at SD.LLBLGen.Pro.ORMSupportClasses.PrefetchPathFetcher.FetchPrefetchPath(QueryParameters rootNodeParameters, Boolean forceParameterizedPPath, ITransaction transactionToUse, Int32 parameterisedPrefetchPathThreshold, Action`1 fetchNodeFunc, Action`4 mergeManyToManyFunc) in C:\Users\ZMinshall\AppData\Local\Red Gate\.NET Reflector\Cache\0\SD.LLBLGen.Pro.ORMSupportClasses.pdb.source\SD\LLBLGen\Pro\ORMSupportClasses\PrefetchPathFetcher.vb:line 17
   at SD.LLBLGen.Pro.ORMSupportClasses.PersistenceCore.FetchPrefetchPath(QueryParameters rootNodeParameters, Boolean forceParameterizedPPath, ITransaction transactionToUse, Int32 parameterisedPrefetchPathThreshold, Action`1 fetchNodeFunc, Action`4 mergeManyToManyFunc) in C:\Users\ZMinshall\AppData\Local\Red Gate\.NET Reflector\Cache\0\SD.LLBLGen.Pro.ORMSupportClasses.pdb.source\SD\LLBLGen\Pro\ORMSupportClasses\PersistenceCore.vb:line 703
   at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.<>c__DisplayClass13_0.<FetchPrefetchPath>b__0() in C:\Users\ZMinshall\AppData\Local\Red Gate\.NET Reflector\Cache\0\SD.LLBLGen.Pro.ORMSupportClasses.pdb.source\SD\LLBLGen\Pro\ORMSupportClasses\DataAccessAdapterBase.vb:line 352
   at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterCore.FetchAdditionalPrefetchPath(IPrefetchPath2 prefetchPath, Context contextToUse, IEntity2 fetchedEntity, IRelationPredicateBucket filterToUse) in C:\Users\ZMinshall\AppData\Local\Red Gate\.NET Reflector\Cache\0\SD.LLBLGen.Pro.ORMSupportClasses.pdb.source\SD\LLBLGen\Pro\ORMSupportClasses\DataAccessAdapterCore.vb:line 827
   at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterCore.FetchEntityUsingFilter(IEntity2 entityToFetch, IPrefetchPath2 prefetchPath, Context contextToUse, IRelationPredicateBucket filter, ExcludeIncludeFieldsList excludedIncludedFields) in C:\Users\ZMinshall\AppData\Local\Red Gate\.NET Reflector\Cache\0\SD.LLBLGen.Pro.ORMSupportClasses.pdb.source\SD\LLBLGen\Pro\ORMSupportClasses\DataAccessAdapterCore.vb:line 1113
   at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterCore.FetchEntity(IEntity2 entityToFetch, IPrefetchPath2 prefetchPath, Context contextToUse, ExcludeIncludeFieldsList excludedIncludedFields) in C:\Users\ZMinshall\AppData\Local\Red Gate\.NET Reflector\Cache\0\SD.LLBLGen.Pro.ORMSupportClasses.pdb.source\SD\LLBLGen\Pro\ORMSupportClasses\DataAccessAdapterCore.vb:line 927
   at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.<>c__DisplayClass9_0.<FetchEntity>b__0() in C:\Users\ZMinshall\AppData\Local\Red Gate\.NET Reflector\Cache\0\SD.LLBLGen.Pro.ORMSupportClasses.pdb.source\SD\LLBLGen\Pro\ORMSupportClasses\DataAccessAdapterBase.vb:line 324
   at Coda.DataAccessLayer.DataAccessAdapter.FetchEntity(IEntity2 entityToFetch, IPrefetchPath2 prefetchPath, Context contextToUse, ExcludeIncludeFieldsList excludedIncludedFields) in C:\projects\RingMaster\Coda.DataAccessLayer\Custom\DataAccessAdapter.vb:line 128
   at Coda.DataAccessGateway.DataAccessGateway.ClientRequestPackage.FetchEntity(IEntity2& entity, PrefetchPath2 prefetchPath, Boolean allowDuplicates, ExcludeIncludeFieldsList ExcludeIncludeFields) in C:\projects\RingMaster\Coda.DataAccessGateway\DataAccessGateway.vb:line 453

This exception was originally thrown at this call stack:

    SD.LLBLGen.Pro.ORMSupportClasses.DynamicQueryEngineBase.AppendResultsetFields(SD.LLBLGen.Pro.ORMSupportClasses.IEntityFieldCore(), SD.LLBLGen.Pro.ORMSupportClasses.IFieldPersistenceInfo(), SD.LLBLGen.Pro.ORMSupportClasses.IRelationCollection, SD.LLBLGen.Pro.ORMSupportClasses.QueryFragments, Boolean, Boolean, Boolean, SD.LLBLGen.Pro.ORMSupportClasses.UniqueList(Of String), SD.LLBLGen.Pro.ORMSupportClasses.IRetrievalQuery, SD.LLBLGen.Pro.ORMSupportClasses.UniqueList(Of String), Boolean, Boolean) in DynamicQueryEngineBase.vb
    SD.LLBLGen.Pro.DQE.SqlServer.DynamicQueryEngine.CreateSelectDQ(SD.LLBLGen.Pro.ORMSupportClasses.IEntityFieldCore(), SD.LLBLGen.Pro.ORMSupportClasses.IFieldPersistenceInfo(), SD.LLBLGen.Pro.ORMSupportClasses.IRetrievalQuery, SD.LLBLGen.Pro.ORMSupportClasses.IPredicate, Long, SD.LLBLGen.Pro.ORMSupportClasses.ISortExpression, SD.LLBLGen.Pro.ORMSupportClasses.IRelationCollection, Boolean, SD.LLBLGen.Pro.ORMSupportClasses.IGroupByCollection, Boolean, Boolean) in DynamicQueryEngine.vb
    SD.LLBLGen.Pro.ORMSupportClasses.DynamicQueryEngineBase.CreateSelectDQ(SD.LLBLGen.Pro.ORMSupportClasses.IEntityFieldCore(), SD.LLBLGen.Pro.ORMSupportClasses.IFieldPersistenceInfo(), System.Data.Common.DbConnection, SD.LLBLGen.Pro.ORMSupportClasses.IPredicate, Long, SD.LLBLGen.Pro.ORMSupportClasses.ISortExpression, SD.LLBLGen.Pro.ORMSupportClasses.IRelationCollection, Boolean, SD.LLBLGen.Pro.ORMSupportClasses.IGroupByCollection) in DynamicQueryEngineBase.vb
    SD.LLBLGen.Pro.ORMSupportClasses.DbSpecificCreatorBase.CreateSubQuery(SD.LLBLGen.Pro.ORMSupportClasses.IEntityFieldCore(), SD.LLBLGen.Pro.ORMSupportClasses.IFieldPersistenceInfo(), SD.LLBLGen.Pro.ORMSupportClasses.IPredicate, Long, SD.LLBLGen.Pro.ORMSupportClasses.ISortExpression, SD.LLBLGen.Pro.ORMSupportClasses.IRelationCollection, SD.LLBLGen.Pro.ORMSupportClasses.IGroupByCollection, Boolean) in DbSpecificCreatorBase.vb
    SD.LLBLGen.Pro.ORMSupportClasses.FieldCompareSetPredicate.ToQueryText(Boolean) in FieldCompareSetPredicate.vb
    SD.LLBLGen.Pro.ORMSupportClasses.PredicateExpression.ToQueryText(Boolean) in PredicateExpression.vb
    SD.LLBLGen.Pro.ORMSupportClasses.PredicateExpression.ToQueryText(Boolean) in PredicateExpression.vb
    SD.LLBLGen.Pro.ORMSupportClasses.PredicateExpression.ToQueryText(Boolean) in PredicateExpression.vb
    SD.LLBLGen.Pro.ORMSupportClasses.DynamicQueryEngineBase.AppendWhereClause(SD.LLBLGen.Pro.ORMSupportClasses.IPredicate, SD.LLBLGen.Pro.ORMSupportClasses.QueryFragments, SD.LLBLGen.Pro.ORMSupportClasses.IQuery) in DynamicQueryEngineBase.vb
    SD.LLBLGen.Pro.DQE.SqlServer.DynamicQueryEngine.CreateSelectDQ(SD.LLBLGen.Pro.ORMSupportClasses.IEntityFieldCore(), SD.LLBLGen.Pro.ORMSupportClasses.IFieldPersistenceInfo(), SD.LLBLGen.Pro.ORMSupportClasses.IRetrievalQuery, SD.LLBLGen.Pro.ORMSupportClasses.IPredicate, Long, SD.LLBLGen.Pro.ORMSupportClasses.ISortExpression, SD.LLBLGen.Pro.ORMSupportClasses.IRelationCollection, Boolean, SD.LLBLGen.Pro.ORMSupportClasses.IGroupByCollection, Boolean, Boolean) in DynamicQueryEngine.vb
    ...
    [Call Stack Truncated]
Walaa avatar
Walaa
Support Team
Posts: 14981
Joined: 21-Aug-2005
# Posted on: 16-Aug-2024 01:13:27   

To make sure there is no persistenceInfo mismatch, could you please regenerate the code, and make sure your running project is using/consuming the newly generated code (libraries)?

ZM
User
Posts: 3
Joined: 06-Oct-2023
# Posted on: 21-Aug-2024 17:55:12   

Walaa wrote:

To make sure there is no persistenceInfo mismatch, could you please regenerate the code, and make sure your running project is using/consuming the newly generated code (libraries)?

I've done so, including removing all the current entity code. I've also manually compared the PersistenceInfo to our database schema

Walaa avatar
Walaa
Support Team
Posts: 14981
Joined: 21-Aug-2005
# Posted on: 21-Aug-2024 23:38:18   

Please provide a small repro project along with the LLBLGen project file.