public bool PosTest2()
    {
        bool retVal = true;

        TestFramework.BeginScenario("Test IsAlive with long WeakReference");

        try
        {
            WeakReference extWR = new WeakReference(WRHelper.CreateAnObject("Test"), true);

            if (!extWR.IsAlive)
            {
                TestFramework.LogError("004", "WeakReference IsAlive not as expected. Expected : True; Actual: " + extWR.IsAlive);
                retVal = false;
            }

            GC.Collect();
            GC.WaitForPendingFinalizers();

            if (!extWR.IsAlive)
            {
                TestFramework.LogError("005", "WeakReference IsAlive not as expected. Expected : True; Actual: " + extWR.IsAlive);
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestFramework.LogError("006", "Unexpected exception occured: " + e);
            retVal = false;
        }

        return(retVal);
    }
    // ATTENTION!!! ATTENTION!!! ATTENTION!!!
    //
    // If you encounter issues with object lifetime, please see more comments in WeakReferenceCtor2.cs

    public bool PosTest1()
    {
        bool retVal = true;

        TestFramework.BeginScenario("Test IsAlive with short WeakReference");

        try
        {
            WeakReference extWR = new WeakReference(WRHelper.CreateAnObject("Test"), false);

            if (!extWR.IsAlive)
            {
                TestFramework.LogError("001", "WeakReference IsAlive not as expected. Expected : True; Actual: " + extWR.IsAlive);
                retVal = false;
            }

            GC.Collect();
            GC.WaitForPendingFinalizers();

            //Dev10 Bug #413556: WeakReference object incorrectly kept alive. Enable after the test is fixed.
            //
            //if (extWR.IsAlive)
            //{
            //    TestFramework.LogError("002", "WeakReference IsAlive not as expected. Expected : False; Actual: " + extWR.IsAlive);
            //    retVal = false;
            //}
        }
        catch (Exception e)
        {
            TestFramework.LogError("003", "Unexpected exception occured: " + e);
            retVal = false;
        }

        return(retVal);
    }
    // ATTENTION!!! ATTENTION!!! ATTENTION!!!
    //
    // There is no guarantee that WeakReference objects will be collected after GC.Collect().
    // The bottom line is, compiler generated temps for objects created locally (within the
    // same function), castings, boxing/unboxing will get their lifetimes extended to the
    // end of the function.
    //
    // All these are due to changes related to the MinOpts feature made during the
    // Silverlight/Arrowhead timeframe. For more information, see DevDiv Bugs 170524.
    //
    // Many of these behaviors are not documented. If any of the underlying implementation is
    // changed, the tests will need to be updated as well.

    public bool PosTest1()
    {
        bool retVal = true;

        TestFramework.BeginScenario("Test short WeakReference ctor");

        try
        {
            string        testStr = "Test";
            WeakReference extWR   = new WeakReference(WRHelper.CreateAnObject(testStr), false);

            if (!WRHelper.VerifyObject(extWR, testStr))
            {
                TestFramework.LogError("001", "WeakReference target not as expected. Expected : Test; Actual: " + extWR.Target.ToString());
                retVal = false;
            }

            GC.Collect();
            GC.WaitForPendingFinalizers();

            //Dev10 Bug #413556: WeakReference object incorrectly kept alive. Enable after the test is fixed.
            //
            //if (extWR.Target != null)
            //{
            //    TestFramework.LogError("002", "WeakReference target not as expected. Expected : null; Actual: " + extWR.Target.ToString());
            //    retVal = false;
            //}

            if (extWR.TrackResurrection != false)
            {
                TestFramework.LogError("003", "WeakReference track resurrection not as expected. Expected : false; Actual: " + extWR.TrackResurrection);
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestFramework.LogError("004", "Unexpected exception occurred: " + e);
            retVal = false;
        }

        return(retVal);
    }
    public bool PosTest2()
    {
        bool retVal = true;

        TestFramework.BeginScenario("Test long WeakReference ctor");

        try
        {
            string        testStr = "Test";
            WeakReference extWR   = new WeakReference(WRHelper.CreateAnObject(testStr), true);

            if (!WRHelper.VerifyObject(extWR, testStr))
            {
                TestFramework.LogError("005", "WeakReference target not as expected. Expected : Test; Actual: " + extWR.Target.ToString());
                retVal = false;
            }

            GC.Collect();
            GC.WaitForPendingFinalizers();

            if (!WRHelper.VerifyObject(extWR, testStr))
            {
                TestFramework.LogError("006", "WeakReference target not as expected. Expected : null; Actual: " + extWR.Target.ToString());
                retVal = false;
            }

            if (extWR.TrackResurrection != true)
            {
                TestFramework.LogError("007", "WeakReference track resurrection not as expected. Expected : true; Actual: " + extWR.TrackResurrection);
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestFramework.LogError("008", "Unexpected exception occurred: " + e);
            retVal = false;
        }

        return(retVal);
    }