public static int Main(String [] str) { Console.WriteLine("Test should return with ExitCode 100 ..."); GetGenCollect mv_obj = new GetGenCollect(); wf = new WeakReference(mv_obj, true); mv_obj.MakeGCBusy(); mv_obj.Gen = GC.GetGeneration(mv_obj); int g = mv_obj.Gen; mv_obj = null; GC.Collect(g); GC.WaitForPendingFinalizers(); GC.Collect(g); if (retVal) { Console.WriteLine("Test Passed"); return(100); } Console.WriteLine("Test Failed"); return(1); }
public static int Main( String [] str ) { Console.WriteLine("Test should return with ExitCode 100 ..."); GetGenCollect mv_obj = new GetGenCollect(); wf = new WeakReference( mv_obj, true ); mv_obj.MakeGCBusy(); mv_obj.Gen = GC.GetGeneration( mv_obj ); int g = mv_obj.Gen; mv_obj = null; GC.Collect( g ); GC.WaitForPendingFinalizers(); GC.Collect( g ); if (retVal) { Console.WriteLine ("Test Passed" ); return 100; } Console.WriteLine ("Test Failed" ); return 1; }