Print Page | Close Window

Weird Code First Devforce Error

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=3729
Printed Date: 13-May-2026 at 12:56am


Topic: Weird Code First Devforce Error
Posted By: Vonzkie
Subject: Weird Code First Devforce Error
Date Posted: 18-Oct-2012 at 8:06pm

Here's the link of my Model Project
uploads/1228/For_Devforce_Checking.rar - uploads/1228/For_Devforce_Checking.rar

After having hard time making this work with some unusual error such as "Key 'iRelyReportsEntities_Example' object reference.....' when performing query, we eliminate the error by just doing the relationship via Fluent API.

Now, the problem is, when trying a query "Object Ref is still showing but without the Key part"
I noticed that the problem occurs in the client side unlike the first one w/c occurs in the server side..

Here's the stack trace of the error:

  at IdeaBlade.EntityModel.EntityProperty.GetValueRaw(IStructuralObject so)
   at IdeaBlade.EntityModel.EntityAspect.GetValueRaw(DataEntityProperty property, EntityVersion version)
   at IdeaBlade.EntityModel.EntityAspect.<GetValuesRaw>b__17(DataEntityProperty p)
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at IdeaBlade.EntityModel.EntityAspect.GetValuesRaw(IEnumerable`1 properties)
   at IdeaBlade.EntityModel.EntityAspect.get_EntityKey()
   at IdeaBlade.EntityModel.EntityGroup.LoadEntity(EntityAspect sourceAspect, MergeStrategy mergeStrategy, Boolean& rowUpdated)
   at IdeaBlade.EntityModel.EntityMerger.MergeEntityCore(EntityAspect sourceAspect, EntityGroup targetEntityGroup)
   at IdeaBlade.EntityModel.EntityMerger.MergeEntity(EntityAspect sourceAspect, EntityGroup targetEntityGroup, NavigationContext context)
   at IdeaBlade.EntityModel.EntityMerger.<>c__DisplayClass9.<MergeEntities>b__8(EntityAspect sourceAspect)
   at System.Linq.Enumerable.<>c__DisplayClass12`3.<CombineSelectors>b__11(TSource x)
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at IdeaBlade.Core.EnumerableFns.ForEach[T](IEnumerable`1 items, Action`1 action)
   at IdeaBlade.EntityModel.DataBlockFns.MakeResultList(Type type, IEnumerable items, Boolean isOrdered)
   at IdeaBlade.EntityModel.EntityQueryResult.UpdateDataSet(EntitiesDataBlock block, NavigationContext context)
   at IdeaBlade.EntityModel.EntitiesDataBlock.Resolve(EntityQueryResult helper)
   at IdeaBlade.EntityModel.EntityQueryResultCollection..ctor(DataQueryResultCollection dqResults, EntityManager entityManager, MergeStrategy mergeStrategy)
   at IdeaBlade.EntityModel.EntityManager.MergeAndReturnUsingCache(IEntityFinder finder, DataQueryResultCollection dqResults)
   at IdeaBlade.EntityModel.EntityManager.ProcessFetchedData(DataQueryResultCollection dqResults, IEntityFinder finder)
   at IdeaBlade.EntityModel.EntityManager.ExecuteFetch(IEntityFinder finder)
   at IdeaBlade.EntityModel.EntityQueryFinder.Execute()
   at IdeaBlade.EntityModel.EntityManager.ExecuteQueryCore(IEntityQuery query, Boolean isAsync)
   at IdeaBlade.EntityModel.EntityManager.ExecuteQuery[T](IEntityQuery`1 query)
   at IdeaBlade.EntityModel.EntityQueryExtensions.Execute[T](IEntityQuery`1 query)
   at IdeaBlade.EntityModel.EntityQuery`1.GetEnumerator()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at TestProject.Program.Main(String[] args) in D:\NEW TFS 2\iRely Suite\Development Work\iRely Suite Report\TestProject\Program.cs:line 70
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

I just wonder why it's so complicated using the Devforce Code First over to Database First?
It's just frustrating to have these errors that we didn't experience before we're on Database First.
Not to mention that there are no "user friendly message" when an error occurs.
I hope this can be improved.

Thanks,
Von



Replies:
Posted By: kimj
Date Posted: 19-Oct-2012 at 12:34pm
Hi Von,
 
The iRely.Reports.Model assembly needs to be "enhanced" by PostSharp.  I see that the iRely.BaseModel assembly contains PostSharp enhancements, but the other assembly does not.  I know that the iRely.Reports.Model project does reference the PostSharp assembly and I don't see any settings which indicate PostSharp processing was skipped, but the assembly definitely does not contain the necessary PostSharp changes.   Rebuild the project, and check the build output window for diagnostics.
 
We agree that the errors you'll find with Code First development are often quite inscrutable, and we're trying to fix that.
 
 



Print Page | Close Window