Object Reference Not Set to an Instance of an Object

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
yensid21
Posts: 11
Joined: Fri 17 Sep 2010 16:16

Object Reference Not Set to an Instance of an Object

Post by yensid21 » Thu 28 Apr 2011 14:06

When calling the SaveChanges() method of the entity context I am getting an "Object reference not set to an instance of an object" error. I am using self-tracking entities, dotConnect for Oracle ver 6.10 Professional Trial and VS 2010.

This is the stack trace:

Code: Select all

Devart.Common.Entity.au.a(cq A_0, EntitySetBase A_1)
Devart.Common.Entity.au.b(bp A_0, StringBuilder A_1, a3 A_2)
Devart.Common.Entity.au.a(bp A_0, DbCommand A_1)
Devart.Common.Entity.co.a(bp A_0, DbCommandBase A_1)
Devart.Common.Entity.co.c()
Devart.Data.Oracle.Entity.OracleEntityProviderServices.a(DbProviderManifest A_0, DbCommandTree A_1)
Devart.Data.Oracle.Entity.OracleEntityProviderServices.CreateDbCommandDefinition(DbProviderManifest providerManifest, DbCommandTree commandTree)
System.Data.Common.DbProviderServices.CreateCommandDefinition(DbCommandTree commandTree)
System.Data.Common.DbProviderServices.CreateCommand(DbCommandTree commandTree)
System.Data.Mapping.Update.Internal.UpdateTranslator.CreateCommand(DbModificationCommandTree commandTree)
System.Data.Mapping.Update.Internal.DynamicUpdateCommand.CreateCommand(UpdateTranslator translator, Dictionary`2 identifierValues)
System.Data.Mapping.Update.Internal.DynamicUpdateCommand.Execute(UpdateTranslator translator, EntityConnection connection, Dictionary`2 identifierValues, List`1 generatedValues)
System.Data.Mapping.Update.Internal.UpdateTranslator.Update(IEntityStateManager stateManager, IEntityAdapter adapter)
System.Data.EntityClient.EntityAdapter.Update(IEntityStateManager entityCache)
System.Data.Objects.ObjectContext.SaveChanges(SaveOptions options)
System.Data.Objects.ObjectContext.SaveChanges()
EntityModuleBL.EntityManager.SetDependentRecordsToInactive(LegalEntity value)
EntityModuleBL.EntityManager.UpdateEntity(LegalEntity value, IIdentity identity)
EntityModuleTests.EntityModelBLTests.EntityManagerTests.CanDeleteAnEntity()
And this is an example of the code causing the problem:

Code: Select all

using (EntitiesContext context = new EntitiesContext())
{
	entity = (from le in context.LegalEntities.OfType()		
		where le.EntityId == entityId
		select le).FirstOrDefault();
		entity.StartTracking();
		entity.ReferredTo = "Test";
		
		context.LegalEntities.ApplyChanges(entity);
		context.SaveChanges();
}
The Person object is inherited from LegalEntity in the entity model. The above code is in a procedure which is called by another method which updates data in its own using block and then, outside the using block, it calls this method passing in the EntityId value. I verified that a Person object is being returned by the query and when the ReferredTo value is changed, the change tracking class is showing the object as modified and has the original and new values. I also tried running the code in LINQPad and got the same results.

Thanks!

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

Post by AndreyR » Thu 28 Apr 2011 15:03

Thank you for the report. We have already fixed this error.
The fix will be included in the nearest build.

yensid21
Posts: 11
Joined: Fri 17 Sep 2010 16:16

Any Idea When?

Post by yensid21 » Thu 28 Apr 2011 16:57

Thanks for your quick reply! Do you have any idea when the fix will be released?

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

Post by AndreyR » Fri 29 Apr 2011 10:38

We plan to release the new build in two weeks or so.

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

Post by AndreyR » Thu 19 May 2011 12:59

We have released the new 6.30.160 build of dotConnect for Oracle. This build can be dowloaded from here (the trial version) or from Registered Users' Area (for users with active subscription only).
For the detailed information about the improvements and fixes available in dotConnect for Oracle 6.30.160, please refer to this announcement.

Post Reply