I recently updated my data model because I added a column to a table, and now for some reason, some code that set a property on one of my data model classes that was working before is now throwing an exception.
The column I added was a simple varchar column that allows nulls and has nothing to do with the values I'm trying to set. The properties that throw the exception are Guids that have foreign key relationships in the database table and thus also have navigation properties that are related to them. This only occurs when creating a new entity. The exception is thrown either when setting those Guid properties or when adding the new entity to the manager (I was trying to play with the order in the hopes it would work).
I have tried deleting the class from the designer and re-adding it, but since it's an essential class to the model, a lot of other classes had navigation properties of that type that were broken and not fixed when adding the class back in through an update of the model, so I had to revert back to the old model.
I even tried reverting back to the model from before I added the new column and forced a code gen, and I still have the same issue, which I find even more bizarre. The stack trace from the exception goes through a whole slew of DevForce method calls, which I've pasted below. We're using DevForce 6.0.4. I appreciate any help that can be given.
System.NullReferenceException was unhandled by user code
Message=Object reference not set to an instance of an object.
StackTrace:
at IdeaBlade.EntityModel.EntityReferenceBase.get_PropertyName()
at IdeaBlade.EntityModel.EntityReferenceBase.set_IsLoaded(Boolean value)
at IdeaBlade.EntityModel.ListEntityReference`1..ctor(EntityWrapper fromWrapper, EntityRelationLink link)
at IdeaBlade.EntityModel.ListEntityReference`1.Clone(EntityWrapper fromWrapper)
at IdeaBlade.EntityModel.EntityReferenceBase.Create(EntityWrapper fromWrapper, EntityRelationLink relationLink)
at IdeaBlade.EntityModel.EntityWrapper.EntityReferenceManager.Get(EntityRelationLink relationLink)
at IdeaBlade.EntityModel.EntityWrapper.EntityReferenceManager.<DiscoverRelations>b__39(EntityRelationLink l)
at IdeaBlade.Core.EnumerableFns.ForEach[T](IEnumerable`1 items, Action`1 action)
at IdeaBlade.EntityModel.EntityWrapper.EntityReferenceManager.DiscoverRelations()
at IdeaBlade.EntityModel.EntityWrapper.EntityReferenceManager.get_InternalReferences()
at IdeaBlade.EntityModel.EntityWrapper.FixupReferences()
at IdeaBlade.EntityModel.EntityWrapper.TrackChanged(EntityChangedEventArgs e)
at IdeaBlade.EntityModel.EntityGroup.OnEntityChanged(EntityChangedEventArgs e)
at IdeaBlade.EntityModel.EntityGroup.AddNewEntity(EntityWrapper wrapper)
at IdeaBlade.EntityModel.EntityManager.AddEntityWrapper(EntityWrapper wrapper)
at IdeaBlade.EntityModel.EntityReferenceBase.AttachIfPossible(EntityWrapper newValueWrapper)
at IdeaBlade.EntityModel.ScalarEntityReference`1.SetEntity(T newValue, Boolean updateFkValues, Boolean updateInverseValues)
at IdeaBlade.EntityModel.ScalarEntityReference`1.IdeaBlade.EntityModel.IScalarEntityReference.RefreshForFkChange()
at IdeaBlade.EntityModel.EntityWrapper.SetValueWithChangeNotification(DataEntityProperty property, Object newValue)
at IdeaBlade.EntityModel.EntityWrapper.IdeaBlade.EntityModel.IStructuralObject.SetValueWithChangeNotification(DataEntityProperty property, Object newValue)
at IdeaBlade.EntityModel.DataEntityProperty`2.SetValueWithVerification(TInstance instance, TValue newValue)
at IdeaBlade.EntityModel.DataEntityProperty`2.<.ctor>b__4(DataEntityPropertySetInterceptorArgs`2 args)
at IdeaBlade.Core.PropertyInterceptor`3.HandleAction(Action`1 action, TArgs args)
at IdeaBlade.Core.PropertyInterceptor`3.<BuildTargetedCombinedAction>b__3(TArgs args)
at IdeaBlade.Core.PropertyInterceptor`3.ExecuteActions(TArgs args)
at IdeaBlade.Core.PropertyInterceptor`3.SetValue(TInstance instance, Object context, TValue value)
at IdeaBlade.Core.PropertyInterceptor`3.SetValue(TInstance instance, TValue value)
at IdeaBlade.EntityModel.DataEntityProperty`2.SetValue(TInstance instance, TValue value)
at AST.ObjectModel.User.set_Rank(Guid value)
at AST.Common.Utilities.SL.StateManagementUtil.CreateUser(ASTEntityManager ASTEM, String akoUserName, String firstName, String lastName, String niprnetEmail, String siprnetEmail, String phone, String accessRequestNotes, Rank rank, Organization org, String dsn, Action`1 savedCallback)
at AST.Web.Home.SL.Views.NewUserRegistrationDialog.OKButton_Click(Object sender, RoutedEventArgs e)
at System.Windows.Controls.Primitives.ButtonBase.OnClick()
at System.Windows.Controls.Button.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnKeyUpInternal(Key key)
at System.Windows.Controls.Primitives.ButtonBase.OnKeyUp(KeyEventArgs e)
at System.Windows.Controls.Control.OnKeyUp(Control ctrl, EventArgs e)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)
InnerException: