summaryrefslogtreecommitdiff
path: root/mcs/tests/dtest-error-03.cs
blob: dea56ec61efc0932d51eec86219ad44962a3a50d (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
using System;
using Microsoft.CSharp.RuntimeBinder;
using System.Dynamic;
using System.Runtime.CompilerServices;

public class C
{
}

public class Test
{
	public static int Main ()
	{
		var getter = CallSite<Func<CallSite, object, object>>.Create (
						 Binder.GetMember (
						 CSharpBinderFlags.None, "n", null, new[] {
							 CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null) }));

		try {
			getter.Target (getter, new C ());
		} catch (RuntimeBinderException e) {
			if (e.Message == "`C' does not contain a definition for `n'")
				return 0;

			return 2;
		}

		return 1;
	}
}