-
Notifications
You must be signed in to change notification settings - Fork 4.9k
/
Copy pathtest35000.cs
53 lines (44 loc) · 1.52 KB
/
test35000.cs
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Reflection;
using Xunit;
public class Test35000
{
public class TestData0
{
public virtual object MyMethod(int a, int b, int c, int d, int e, int f, int g, int h) { return null; }
}
public class TestData1 : TestData0
{
public override object MyMethod(int a, int b, int c, int d, int e, int f, int g, int h) { return null; }
}
[Fact]
public static int TestEntryPoint()
{
var method = typeof(TestData0).GetMethod(nameof(TestData0.MyMethod));
var func = (Func<TestData0, int, int, int, int, int, int, int, int, object>)Delegate.CreateDelegate(typeof(Func<TestData0, int, int, int, int, int, int, int, int, object>), null, method);
TestData0 data = new TestData0();
TestData0 data1 = new TestData1();
int nullRefCount = 0;
const int LoopCount = 10;
for (int j = 0; j < LoopCount; j++)
{
for (int i = 0; i < 50; i++)
{
func(data, 1, 2, 3, 4, 5, 6, 7, 8);
func(data1, 1, 2, 3, 4, 5, 6, 7, 8);
}
try
{
func(null, 1, 2, 3, 4, 5, 6, 7, 8);
}
catch (NullReferenceException e)
{
nullRefCount++;
Console.WriteLine(e);
}
}
return (nullRefCount == LoopCount) ? 100 : 101;
}
}