Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ApplyChanges throws a error #224

Open
isakatirci opened this issue Dec 27, 2018 · 7 comments
Open

ApplyChanges throws a error #224

isakatirci opened this issue Dec 27, 2018 · 7 comments
Labels

Comments

@isakatirci
Copy link

I have this error. Please help me?

System.NullReferenceException: Object reference not set to an instance of an object.
at TrackableEntities.EF6.DbContextExtensions.IsComplexType(DbContext dbContext, Type entityType)
at TrackableEntities.EF6.DbContextExtensions.SetEntityState(DbContext context, ITrackable item, ITrackable parent, String propertyName, EntityState state, IEnumerable1 interceptors) at TrackableEntities.EF6.DbContextExtensions.ApplyChanges(DbContext context, ITrackable item, ITrackable parent, ObjectVisitationHelper visitationHelper, String propertyName, Nullable1 state, IEnumerable1 interceptors) at TrackableEntities.EF6.DbContextExtensions.ApplyChangesOnCollectionProperties(TrackingState stateFilter, Boolean includeState, EntityNavigationProperty navProp, EntityCollectionProperty1 colProp, DbContext context, ITrackable item, ObjectVisitationHelper visitationHelper, Nullable1 state, IEnumerable1 interceptors)
at TrackableEntities.EF6.DbContextExtensions.ApplyChangesOnProperties(DbContext context, ITrackable item, ObjectVisitationHelper visitationHelper, Nullable1 state, IEnumerable1 interceptors)
at TrackableEntities.EF6.DbContextExtensions.ApplyChanges(DbContext context, ITrackable item, ITrackable parent, ObjectVisitationHelper visitationHelper, String propertyName, Nullable1 state, IEnumerable1 interceptors)
at TrackableEntities.EF6.DbContextExtensions.ApplyChangesOnProperties(DbContext context, ITrackable item, ObjectVisitationHelper visitationHelper, Nullable1 state, IEnumerable1 interceptors)
at TrackableEntities.EF6.DbContextExtensions.ApplyChanges(DbContext context, ITrackable item, ITrackable parent, ObjectVisitationHelper visitationHelper, String propertyName, Nullable1 state, IEnumerable1 interceptors)
at TrackableEntities.EF6.DbContextExtensions.ApplyChanges(DbContext context, ITrackable item)
at Repository.Pattern.Ef6.Repository1.Update(TEntity entity, Boolean traverseGraph) in C:\Users\isa\source\repos\Helezon.FollowMe\Helezon.FollowMe.Repository.Pattern.Ef6\Repository.cs:line 70 at Service.Pattern.Service1.Update(TEntity entity) in C:\Users\isa\source\repos\Helezon.FollowMe\Helezon.FollowMe.Service.Pattern\Service.cs:line 34
at Helezon.FollowMe.Service.CompanyImageService.Update(CompanyImage entity) in C:\Users\isa\source\repos\Helezon.FollowMe\Helezon.FollowMe.Service\CompanyImageService.cs:line 59
at Helezon.FollowMe.Service.CompanyImageService.DeleteByImageName(String imageName) in C:\Users\isa\source\repos\Helezon.FollowMe\Helezon.FollowMe.Service\CompanyImageService.cs:line 78
at Helezon.FollowMe.WebUI.Controllers.FileUploadController.DeleteFile(String file, String entitytype) in C:\Users\isa\source\repos\Helezon.FollowMe\Helezon.FollowMe.WebUI\Controllers\FileUploadController.cs:line 154
at lambda_method(Closure , ControllerBase , Object[] )
at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary2 parameters) at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary2 parameters)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c.b__9_0(IAsyncResult asyncResult, ActionInvocation innerInvokeState)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult2.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase1.End()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.b__11_0()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass11_1.b__2()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass7_0.b__1(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult1.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase1.End()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass3_6.b__3()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass3_1.b__5(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult1.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase1.End()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult)
at System.Web.Mvc.Controller.<>c.b__152_1(IAsyncResult asyncResult, ExecuteCoreState innerState)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase1.End()
at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)
at System.Web.Mvc.Controller.<>c.b__151_2(IAsyncResult asyncResult, Controller controller)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase1.End()
at System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult)
at System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult)
at System.Web.Mvc.MvcHandler.<>c.b__20_1(IAsyncResult asyncResult, ProcessRequestState innerState)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase1.End()
at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

@isakatirci
Copy link
Author

image

@isakatirci
Copy link
Author

I fix this problem with doing debug :D
image

@isakatirci
Copy link
Author

isakatirci commented Dec 27, 2018

The Turkish alphabet character 'I' is pain in the neck. please take precautions for this

@tonysneed
Copy link
Collaborator

@isakatirci Would you be able to open a pull request with your fix?

@emperador-ming
Copy link

emperador-ming commented Jun 4, 2019

Beware! I think ApplyChanges crushes with Dates in Cultures different from English.

[NullReferenceException: Referencia a objeto no establecida como instancia de un objeto.] TrackableEntities.EF6.DbContextExtensions.IsComplexType(DbContext dbContext, Type entityType) +247 TrackableEntities.EF6.DbContextExtensions.SetEntityState(DbContext context, ITrackable item, ITrackable parent, String propertyName, EntityState state, IEnumerable1 interceptors) +96 TrackableEntities.EF6.DbContextExtensions.SetChanges(DbContext context, ITrackable item, EntityState state, ObjectVisitationHelper visitationHelper, ITrackable parent, String propertyName, IEnumerable1 interceptors) +1337 TrackableEntities.EF6.DbContextExtensions.ApplyChanges(DbContext context, ITrackable item, ITrackable parent, ObjectVisitationHelper visitationHelper, String propertyName, Nullable1 state, IEnumerable1 interceptors) +2696 TrackableEntities.EF6.DbContextExtensions.ApplyChanges(DbContext context, ITrackable item) +113 Repository.Pattern.Ef6.Repository`1.Delete(TEntity entity) +31 Registro_Jornada_Laboral.Services.d__8.MoveNext() in C:\Users\pcv\source\repos\Registro Jornada Laboral\Registro Jornada Laboral

It would be great to solve this matter.

@tonysneed
Copy link
Collaborator

Commented in #225. Would like to merge the PR but it needs to be re-done.

@tonysneed tonysneed added the bug label Jun 6, 2019
@tomeks666
Copy link

tomeks666 commented Nov 28, 2019

A release would be very appreciated. I am using URF.NET and this bug forces me to keep it in old version 4.2 . I tried to get development version of TrackableEntities, but it is labeled something below 2.5.7 - and URF.NET requires 2.5.7 at least. So I am stuck with 4.2, and old CommonLocator in turn as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants