This question is locked. New answers and comments are not allowed.
Hello,
Today I found a pretty weird problem. It started with an error from OpenAccess:
OpenAccessException: "Object reference not set to an instance of an object."
The problem was on a fairly simple entity add action:
The error occurred on the adding of the object (DbC.Add(obj_Item))
And not a selfexplaining error also...
The problem was that the property ItemGroupDefinitionId was 0 instead of the
So, when entering the property Set:
The value was 0, while debugging clearly stated that the If( was returning Nothing!
I changed the
So, for others that may come across this... This was my afternoon... :-)
Erik
Today I found a pretty weird problem. It started with an error from OpenAccess:
OpenAccessException: "Object reference not set to an instance of an object."
The problem was on a fairly simple entity add action:
Dim obj_Item As Entities.App.Com.ItemGroupUsing DbC As New ProoPortal.Connection("ProoPortalConnection01", True, True) obj_Item = New Entities.App.Com.ItemGroup With obj_Item .Number = rtb_Number.Text .Name = rtb_Name.Text.... .ItemGroupDefinitionId = If((rcb_ItemGroupDef.SelectedValue & "") = "", Nothing, rcb_ItemGroupDef.SelectedValue) End With Try>>>>>>> DbC.Add(obj_Item) DbC.SaveChanges(Telerik.OpenAccess.ConcurrencyConflictsProcessingMode.StopOnFirst) Catch ex As Exception If Diagnostics.Debugger.IsAttached Then Diagnostics.Debugger.Break() End TryEnd UsingThe error occurred on the adding of the object (DbC.Add(obj_Item))
And not a selfexplaining error also...
The problem was that the property ItemGroupDefinitionId was 0 instead of the
Nothing that was given back by the If(So, when entering the property Set:
Private l_ItemGroupDefinitionId As Long?Public Property [ItemGroupDefinitionId]() As Long? Get Return l_ItemGroupDefinitionId End Get Set(ByVal aobj_Value As Long?) l_ItemGroupDefinitionId = aobj_Value End SetEnd Property ' ItemGroupDefinitionIdI changed the
If( toIif( and the problem was solved...So, for others that may come across this... This was my afternoon... :-)
Erik