Please I Have "Object Refrence Not Found" exception in this Function IsReferenced() I have version 4.4.0 Build 7249 ??????

asked May 17 '11 at 10:54

ahmedajlan's gravatar image

ahmedajlan
5111

Hello ahmedajlan,

First of all, I need the stacktrace for the exception. Moreover, I might need a part of your domain model. Hope you understand.

(May 18 '11 at 03:49) Dmitri Maximov Dmitri%20Maximov's gravatar image

3 Answers:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xtensive.Orm;
using Microtech.Andalus.Globalization;
using Microtech.Andalus.Business;
using Microtech.Infinity5.Model.Common;

namespace Microtech.Infinity5.Model.Operations.SC
{
/// <summary>
/// The Unit of measure is one of the most crucial things in defining and
/// maintaining stock items.
/// </summary>    
[DDSettings(PageURL = "~/Operations/SC/FRM_UOM.aspx")]
[HierarchyRoot]
[Index("Code", Unique = true)]
public class UOM : BasicDefinition ///This is inherited from Entity
{
    /// <summary>
    /// list of the unit of measures of the current unit of measure                 
    /// </summary>
    [Field]
    [Association(PairTo = "MasterUOM", OnTargetRemove = OnRemoveAction.Clear, OnOwnerRemove = OnRemoveAction.Clear)]//as per design as there's an association relation
    //[Association(OnTargetRemove = OnRemoveAction.Clear, OnOwnerRemove = OnRemoveAction.Clear)]//as per design as there's an association relation
    public EntitySet<LinkUOM> UOMLinks { private set; get;}

    /// <summary>
    /// the Measure type for the current unit of measure                
    /// </summary>        
   [Field]
   public MeasureType Type {get; set;}

   public bool IsUsed()
   {
       return false;
   }

}//end UnitOfMeasure

}//end namespace StockControl

////////////////////

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xtensive.Orm;
using Microtech.Andalus.Globalization;
using Microtech.Andalus.Business;
using Microtech.Infinity5.Model.Common;
using Microtech.Andalus.Business.BusinessUnitCore;

namespace Microtech.Infinity5.Model.Operations.SC
{
[HierarchyRoot]
public class LinkUOM : BusinessUnitEntityBase ///This is inherited from Entity
{
    /// <summary>
    /// the current Unit of measure
    /// </summary>
    //[Field]
    // [Association(OnOwnerRemove=OnRemoveAction.Clear)]
    //public UOM UOM{
    //    get;
    //    set;
    //}

    ///// <summary>
    ///// the related unit of measure to the current one                
    ///// </summary>
    [Field(Nullable = false)]
    //[Association(OnTargetRemove = OnRemoveAction.Clear)]//as per design as there's an association relation
    public UOM UOMLink
    {
        get;
        set;
    }

    /// <summary>
    /// the operation type for the current unit of measure with the related unit of
    /// measure         
    /// </summary>         
    [Field]
    public LinkedUOM_Operation Operation
    {
        get;
        set;
    }

    /// <summary>
    /// the value with will be (multiply or divide) to  transfer from one unit type to
    /// the other one                
    /// </summary>
    [Field]
    public double Factor
    {
        get;
        set;
    }

    [Field]
    public UOM MasterUOM
    {
        get;
        set;
    }

}//end LinkUOM

}//end namespace StockControl

answered May 31 '11 at 04:56

ahmedajlan's gravatar image

ahmedajlan
5111

edited May 31 '11 at 10:35

Dmitri%20Maximov's gravatar image

Dmitri Maximov
22111211

Hello ahmedajlan,

I tried to make a model with these two classes. It wasn't easy because some stuff was absent, e.g. BusinessUnitEntityBase, BasicDefinition, LinkedUOM_Operation, Code, declaration of Key fields, etc. So I removed references to types and fields that were absent.

After that I was able to write two tests:

// First
Query.All<UOM>().First().Remove();

// Second
Query.All<UOM>().First().UOMLinks.First().Remove();

But they didn't fail. I see the only option for you is to make a sample with these 2 or more classes that will fail so I could debug the case.

(May 31 '11 at 11:04) Dmitri Maximov Dmitri%20Maximov's gravatar image

This bug Appeared also in removing the same entity (UOM):

-Inner stack trace for removing bug

"at Xtensive.Storage.Providers.SessionHandler.BuildReferencingQuery(AssociationInfo association) at Xtensive.Storage.Providers.SessionHandler.<getreferencesto>b__38(Object p) at Xtensive.Threading.ThreadSafeDictionary2.GetValue(TKey key, Func2 generator) at Xtensive.Storage.Providers.SessionHandler.GetReferencesTo(Entity target, AssociationInfo association) at Xtensive.Orm.ReferenceFinder.GetReferencesTo(Entity target, AssociationInfo association) at Xtensive.Orm.ReferentialIntegrity.RemovalProcessor.ProcessItems(IList1 entities) at Xtensive.Orm.ReferentialIntegrity.RemovalProcessor.Remove(IEnumerable1 entities) at Xtensive.Orm.Entity.Remove() at Microtech.Andalus.Web.ManagedObjectConnectorAndalusPage.Delete() in E:\Ahmed Ajlan\2011-05-02\AndalusNew\Framework\trunk\Microtech.Andalus.Web\ManagedObjectConnectorAndalusPage.cs:line 175 at Microtech.Infinity5.Web.Operations.SC.FRM_UOM.Delete() in E:\Ahmed Ajlan\2011-05-02\Infinity5\trunk\Source Code\Microtech.Infinity5.Web\Operations\SC\FRM_UOM.aspx.cs:line 297 at Microtech.Infinity5.Web.UserControls.uc_Navigation.btn_Delete_Click(Object sender, EventArgs e) in E:\Ahmed Ajlan\2011-05-02\Infinity5\trunk\Source Code\Microtech.Infinity5.Web\UserControls\uc_Navigation.ascx.cs:line 101 at DevExpress.Web.ASPxEditors.ASPxButton.OnClick(EventArgs e) at DevExpress.Web.ASPxEditors.ASPxButton.RaisePostBackEvent(String eventArgument) at DevExpress.Web.ASPxClasses.ASPxWebControl.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)"

-Inner stack trace for IsReferenced bug.

" at Xtensive.Storage.Providers.SessionHandler.BuildReferencingQuery(AssociationInfo association) at Xtensive.Storage.Providers.SessionHandler.<getreferencesto>b38(Object p) at Xtensive.Threading.ThreadSafeDictionary2.GetValue(TKey key, Func2 generator) at Xtensive.Storage.Providers.SessionHandler.GetReferencesTo(Entity target, AssociationInfo association) at Xtensive.Orm.ReferenceFinder.<>cDisplayClass1.<getreferencesto>b0(AssociationInfo association) at System.Linq.Enumerable.<selectmanyiterator>d142.MoveNext() at Xtensive.Core.EnumerableExtensions.IsNullOrEmpty[TItem](IEnumerable1 items) at Xtensive.Orm.ReferenceFinder.IsReferenced(Entity target) at Microtech.Infinity5.Model.Operations.SC.UOM.IsUsed() in E:\Ahmed Ajlan\2011-05-02\Infinity5\trunk\Source Code\Microtech.Infinity5.Model\Operations\SC\UOM.cs:line 46 at Microtech.Infinity5.Web.Operations.SC.FRM_UOM.AfterRowIndexChanged() in E:\Ahmed Ajlan\2011-05-02\Infinity5\trunk\Source Code\Microtech.Infinity5.Web\Operations\SC\FRM_UOM.aspx.cs:line 498 at Microtech.Andalus.Web.ManagedObjectConnectorAndalusPage.Event_FocusedRowChanged(Object sender, EventArgs e) in E:\Ahmed Ajlan\2011-05-02\AndalusNew\Framework\trunk\Microtech.Andalus.Web\ManagedObjectConnectorAndalusPage.cs:line 410 at DevExpress.Web.ASPxGridView.ASPxGridView.RaiseFocusedRowChanged(EventArgs e) at DevExpress.Web.ASPxGridView.ASPxGridView.DevExpress.Web.Data.IWebDataEvents.OnFocusedRowChanged() at DevExpress.Web.Data.WebDataProxy.OnFocusedRowChanged() at DevExpress.Web.ASPxGridView.ASPxGridView.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)"

answered May 26 '11 at 11:46

ahmedajlan's gravatar image

ahmedajlan
5111

ahmedajlan, thanks for the stack trace.

Could you make a sample or similar, so I could try reproducing the scenario? I suspect that this one requires deep debugging with DataObjects.Net sources, so I need your model on my side.

Thanks.

(May 27 '11 at 06:48) Dmitri Maximov Dmitri%20Maximov's gravatar image

Stack Trace : CallStack

Data Model DataModel

answered May 23 '11 at 08:19

ahmedajlan's gravatar image

ahmedajlan
5111

edited May 23 '11 at 09:37

Dmitri%20Maximov's gravatar image

Dmitri Maximov
22111211

Hello ahmedajlan,

Good screenshots, but I need the inner exception callstack, the one that would show me what's going on inside DataObjects.Net.

Thanks.

(May 23 '11 at 09:40) Dmitri Maximov Dmitri%20Maximov's gravatar image
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

powered by OSQA