blob: 2f0ebf29168a432c922c56e56cc2838a772e1d02 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
namespace GCTest
{
internal class Test
{
private static int Main()
{
object aref = null;
object[] arr = new object[16];
for (int i = arr.GetLowerBound(0); i <= arr.GetUpperBound(0); i++)
arr[i] = arr;
aref = arr[11];
arr = null; //but keep reference to element
GC.Collect();
Array a2 = (Array)aref;
for (int i = a2.GetLowerBound(0); i <= a2.GetUpperBound(0); i++)
{
if (((Array)a2.GetValue(i)).GetLowerBound(0) != 0 ||
((Array)a2.GetValue(i)).GetUpperBound(0) != 15)
{
Console.WriteLine("TEST FAILED!");
return 1;
}
}
Console.WriteLine("TEST PASSED!");
return 100;
}
}
}
|