none
NullReferenceException in GetUpdateCommand during SubmitChanges() call RRS feed

  • Question

  • I'm getting a NullReferenceException from the GetUpdateCommand() method in StandardChangeDirector when I call SubmitChanges. Can someone help me out with what that means?

    Here is the exception stack trace:
      Message="Object reference not set to an instance of an object."
      Source="System.Data.Linq"
      StackTrace:
           at System.Data.Linq.ChangeDirector.StandardChangeDirector.GetUpdateCommand(TrackedObject tracked)
           at System.Data.Linq.ChangeDirector.StandardChangeDirector.DynamicUpdate(TrackedObject item)
           at System.Data.Linq.ChangeDirector.StandardChangeDirector.Update(TrackedObject item)
           at System.Data.Linq.ChangeProcessor.SubmitChanges(ConflictMode failureMode)
           at System.Data.Linq.DataContext.SubmitChanges(ConflictMode failureMode)
           at System.Data.Linq.DataContext.SubmitChanges()
           at [my code location]

    I will continue to research on my end and post if I figure anything out.

    Thanks,
    Don
    Tuesday, January 13, 2009 4:29 PM

All replies

  • Here is a brief update. The error seems to be data related somehow. I tried with a new set of test data and the code works fine.

    Also, the code preceding the exception is attaching a bunch of entities to the data context and submitting changes. The unattached entities may be relate to the exception in some way, I am not sure. If time permits, I'm going to rework this code because I don't like how it was implemented.

    Long story short: I'm not going to look any further into the exception for now. I have found a way to avoid the exception and the code is due to be rewritten.

    Thanks,
    Don
    Tuesday, January 13, 2009 6:12 PM