예제 #1
0
파일: GCRoot.cs 프로젝트: lhutyra/clrmd
    public static void Main(string[] args)
    {
        TargetType target = new TargetType();
        SingleRef  s      = new SingleRef();
        DoubleRef  d      = new DoubleRef();
        TripleRef  t      = new TripleRef();

        TheRoot = s;

        object[] arr = new object[42];
        s.Item1 = arr;
        arr[27] = d;

        // parallel path.
        d.Item1 = new SingleRef()
        {
            Item1 = t
        };
        d.Item2 = t;

        s = new SingleRef();

        t.Item1 = new SingleRef()
        {
            Item1 = s
        };
        t.Item2 = s;
        t.Item3 = new object(); // dead path


        _dependent.Add(s, target);
        //s.Item1 = target;
        throw new Exception();
        GC.KeepAlive(target);
    }
예제 #2
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = base.GetHashCode();
         hashCode = (hashCode * 397) ^ (FriendlyName?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (SingleRef?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (SingleSelfRef?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (SingleRecurse?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (ResolveOnly?.GetHashCode() ?? 0);
         return(hashCode);
     }
 }