2009-05-14 Gonzalo Paniagua Javier <gonzalo@novell.com>
[mono.git] / mcs / class / corlib / Test / System / TypeTest.cs
1 // TypeTest.cs - NUnit Test Cases for the System.Type class
2 //
3 // Authors:
4 //      Zoltan Varga (vargaz@freemail.hu)
5 //  Patrik Torstensson
6 //
7 // (C) 2003 Ximian, Inc.  http://www.ximian.com
8 // 
9
10 using NUnit.Framework;
11 using System;
12 using System.Collections;
13 #if NET_2_0
14 using System.Collections.Generic;
15 #endif
16 using System.IO;
17 using System.Reflection;
18 using System.Reflection.Emit;
19 using System.Runtime.InteropServices;
20 using System.Text;
21 using System.Globalization;
22
23 class NoNamespaceClass {
24 }
25
26 namespace MonoTests.System
27 {
28         class Super : ICloneable
29         {
30                 public virtual object Clone ()
31                 {
32                         return null;
33                 }
34         }
35
36         class Duper: Super
37         {
38         }
39
40         interface IFace1
41         {
42                 void foo ();
43         }
44
45         interface IFace2 : IFace1
46         {
47                 void bar ();
48         }
49
50         interface IFace3 : IFace2
51         {
52         }
53
54         enum TheEnum
55         {
56                 A,
57                 B,
58                 C
59         };
60
61         abstract class Base
62         {
63                 public int level;
64
65                 public abstract int this [byte i] {
66                         get;
67                 }
68
69                 public abstract int this [int i] {
70                         get;
71                 }
72
73                 public abstract void TestVoid ();
74                 public abstract void TestInt (int i);
75         }
76
77         class DeriveVTable : Base
78         {
79                 public override int this [byte i] {
80                         get { return 1; }
81                 }
82
83                 public override int this [int i] {
84                         get { return 1; }
85                 }
86
87                 public override void TestVoid ()
88                 {
89                         level = 1;
90                 }
91
92                 public override void TestInt (int i)
93                 {
94                         level = 1;
95                 }
96         }
97
98         class NewVTable : DeriveVTable
99         {
100                 public new int this [byte i] {
101                         get { return 2; }
102                 }
103
104                 public new int this [int i] {
105                         get { return 2; }
106                 }
107
108                 public new void TestVoid ()
109                 {
110                         level = 2;
111                 }
112
113                 public new void TestInt (int i)
114                 {
115                         level = 2;
116                 }
117
118                 public void Overload ()
119                 {
120                 }
121
122                 public void Overload (int i)
123                 {
124                 }
125
126                 public NewVTable (out int i)
127                 {
128                         i = 0;
129                 }
130
131                 public void byref_method (out int i)
132                 {
133                         i = 0;
134                 }
135         }
136
137         class Base1
138         {
139                 public virtual int Foo {
140                         get { return 1; }
141                         set { }
142                 }
143         }
144
145         class Derived1 : Base1
146         {
147                 public override int Foo {
148                         set { }
149                 }
150         }
151
152         class Derived2 : Base1
153         {
154                 public new int Foo {
155                         get { return 1; }
156                         set { }
157                 }
158         }
159
160 #if NET_2_0
161         public class Foo<T>
162         {
163                 public T Whatever;
164         
165                 public T Test {
166                         get { throw new NotImplementedException (); }
167                 }
168
169                 public T Execute (T a)
170                 {
171                         return a;
172                 }
173         }
174         
175         class Foo<T, U>
176         {
177         }
178
179         public interface IBar<T>
180         {
181         }
182
183         public class Baz<T> : IBar<T>
184         {
185         }
186 #endif
187         public class Bug348522
188         {
189                 public void Test (int __argument)
190                 {
191                 }
192         }
193
194         public class FirstMethodBinder : Binder
195         {
196                 public override MethodBase BindToMethod (BindingFlags bindingAttr, MethodBase [] match, ref object [] args,
197                                                          ParameterModifier [] modifiers, CultureInfo culture, string [] names,
198                                                          out object state)
199                 {
200                         state = null;
201                         return match [0];
202                 }
203                 
204                 public override object ChangeType (object value, Type type1, CultureInfo culture)
205                 {
206                         return value;
207                 }
208                 
209                 // The rest is just to please the compiler
210                 public override FieldInfo BindToField (BindingFlags a, FieldInfo[] b, object c, CultureInfo d)
211                 {
212                         return null;
213                 }
214                 
215                 public override void ReorderArgumentArray(ref object[] a, object b)
216                 {
217                 }
218                 
219                 public override MethodBase SelectMethod(BindingFlags a, MethodBase[] b, Type[] c, ParameterModifier[] d)
220                 {
221                     return null;
222                 }
223                 
224                 public override PropertyInfo SelectProperty(BindingFlags a, PropertyInfo[] b, Type c, Type[] d, ParameterModifier[] e)
225                 {
226                         return null;
227                 }
228         }
229
230
231         [TestFixture]
232         public class TypeTest
233         {
234                 private AssemblyBuilder assembly;
235                 private ModuleBuilder module;
236                 const string ASSEMBLY_NAME = "MonoTests.System.TypeTest";
237                 static int typeIndexer = 0;
238
239                 [SetUp]
240                 public void SetUp ()
241                 {
242                         AssemblyName assemblyName = new AssemblyName ();
243                         assemblyName.Name = ASSEMBLY_NAME;
244                         assembly = AppDomain.CurrentDomain.DefineDynamicAssembly (
245                                         assemblyName, AssemblyBuilderAccess.RunAndSave, Path.GetTempPath ());
246                         module = assembly.DefineDynamicModule ("module1");
247                 }
248
249                 private string genTypeName ()
250                 {
251                         return "t" + (typeIndexer++);
252                 }
253
254                 private void ByrefMethod (ref int i, ref Derived1 j, ref Base1 k)
255                 {
256                 }
257 #if NET_2_0
258                 private void GenericMethod<Q> (Q q)
259                 {
260                 }
261 #endif
262                 [Test]
263                 public void TestIsAssignableFrom ()
264                 {
265                         // Simple tests for inheritance
266                         Assert.AreEqual (typeof (Super).IsAssignableFrom (typeof (Duper)) , true, "#01");
267                         Assert.AreEqual (typeof (Duper).IsAssignableFrom (typeof (Duper)), true, "#02");
268                         Assert.AreEqual (typeof (Object).IsAssignableFrom (typeof (Duper)), true, "#03");
269                         Assert.AreEqual (typeof (ICloneable).IsAssignableFrom (typeof (Duper)), true, "#04");
270
271                         // Tests for arrays
272                         Assert.AreEqual (typeof (Super[]).IsAssignableFrom (typeof (Duper[])), true, "#05");
273                         Assert.AreEqual (typeof (Duper[]).IsAssignableFrom (typeof (Super[])), false, "#06");
274                         Assert.AreEqual (typeof (Object[]).IsAssignableFrom (typeof (Duper[])), true, "#07");
275                         Assert.AreEqual (typeof (ICloneable[]).IsAssignableFrom (typeof (Duper[])), true, "#08");
276
277                         // Tests for multiple dimensional arrays
278                         Assert.AreEqual (typeof (Super[][]).IsAssignableFrom (typeof (Duper[][])), true, "#09");
279                         Assert.AreEqual (typeof (Duper[][]).IsAssignableFrom (typeof (Super[][])), false, "#10");
280                         Assert.AreEqual (typeof (Object[][]).IsAssignableFrom (typeof (Duper[][])), true, "#11");
281                         Assert.AreEqual (typeof (ICloneable[][]).IsAssignableFrom (typeof (Duper[][])), true, "#12");
282
283                         // Tests for vectors<->one dimensional arrays */
284 #if TARGET_JVM // Lower bounds arrays are not supported for TARGET_JVM.
285                         Array arr1 = Array.CreateInstance (typeof (int), new int[] {1});
286                         Assert.AreEqual (typeof (int[]).IsAssignableFrom (arr1.GetType ()), true, "#13");
287 #else
288                         Array arr1 = Array.CreateInstance (typeof (int), new int[] {1}, new int[] {0});
289                         Array arr2 = Array.CreateInstance (typeof (int), new int[] {1}, new int[] {10});
290
291                         Assert.AreEqual (typeof (int[]).IsAssignableFrom (arr1.GetType ()), true, "#13");
292                         Assert.AreEqual (typeof (int[]).IsAssignableFrom (arr2.GetType ()), false, "#14");
293 #endif // TARGET_JVM
294
295                         // Test that arrays of enums can be cast to their base types
296                         Assert.AreEqual (typeof (int[]).IsAssignableFrom (typeof (TypeCode[])), true, "#15");
297
298                         // Test that arrays of valuetypes can't be cast to arrays of
299                         // references
300                         Assert.AreEqual (typeof (object[]).IsAssignableFrom (typeof (TypeCode[])), false, "#16");
301                         Assert.AreEqual (typeof (ValueType[]).IsAssignableFrom (typeof (TypeCode[])), false, "#17");
302                         Assert.AreEqual (typeof (Enum[]).IsAssignableFrom (typeof (TypeCode[])), false, "#18");
303
304                         // Test that arrays of enums can't be cast to arrays of references
305                         Assert.AreEqual (typeof (object[]).IsAssignableFrom (typeof (TheEnum[])), false, "#19");
306                         Assert.AreEqual (typeof (ValueType[]).IsAssignableFrom (typeof (TheEnum[])), false, "#20");
307                         Assert.AreEqual (typeof (Enum[]).IsAssignableFrom (typeof (TheEnum[])), false, "#21");
308
309                         // Check that ValueType and Enum are recognized as reference types
310                         Assert.AreEqual (typeof (object).IsAssignableFrom (typeof (ValueType)), true, "#22");
311                         Assert.AreEqual (typeof (object).IsAssignableFrom (typeof (Enum)), true, "#23");
312                         Assert.AreEqual (typeof (ValueType).IsAssignableFrom (typeof (Enum)), true, "#24");
313
314                         Assert.AreEqual (typeof (object[]).IsAssignableFrom (typeof (ValueType[])), true, "#25");
315                         Assert.AreEqual (typeof (ValueType[]).IsAssignableFrom (typeof (ValueType[])), true, "#26");
316                         Assert.AreEqual (typeof (Enum[]).IsAssignableFrom (typeof (ValueType[])), false, "#27");
317
318                         Assert.AreEqual (typeof (object[]).IsAssignableFrom (typeof (Enum[])), true, "#28");
319                         Assert.AreEqual (typeof (ValueType[]).IsAssignableFrom (typeof (Enum[])), true, "#29");
320                         Assert.AreEqual (typeof (Enum[]).IsAssignableFrom (typeof (Enum[])), true, "#30");
321
322                         // Tests for byref types
323                         MethodInfo mi = typeof (TypeTest).GetMethod ("ByrefMethod", BindingFlags.Instance|BindingFlags.NonPublic);
324                         Assert.IsTrue (mi.GetParameters ()[2].ParameterType.IsAssignableFrom (mi.GetParameters ()[1].ParameterType));
325                         Assert.IsTrue (mi.GetParameters ()[1].ParameterType.IsAssignableFrom (mi.GetParameters ()[1].ParameterType));
326
327                         // Tests for type parameters
328 #if NET_2_0
329                         mi = typeof (TypeTest).GetMethod ("GenericMethod", BindingFlags.Instance|BindingFlags.NonPublic);
330                         Assert.IsTrue (mi.GetParameters ()[0].ParameterType.IsAssignableFrom (mi.GetParameters ()[0].ParameterType));
331                         Assert.IsFalse (mi.GetParameters ()[0].ParameterType.IsAssignableFrom (typeof (int)));
332 #endif
333                 }
334
335                 [Test]
336                 [ExpectedException (typeof (ArgumentException))]
337                 public void GetInterfaceMapOnInterface ()
338                 {
339                         typeof (IList).GetInterfaceMap (typeof (ICollection));
340                 }
341
342                 [Test]
343                 public void TestIsSubclassOf ()
344                 {
345                         Assert.IsTrue (typeof (ICloneable).IsSubclassOf (typeof (object)), "#01");
346
347                         // Tests for byref types
348                         Type paramType = typeof (TypeTest).GetMethod ("ByrefMethod", BindingFlags.Instance|BindingFlags.NonPublic).GetParameters () [0].ParameterType;
349                         Assert.IsTrue (!paramType.IsSubclassOf (typeof (ValueType)), "#02");
350                         //Assert.IsTrue (paramType.IsSubclassOf (typeof (Object)), "#03");
351                         Assert.IsTrue (!paramType.IsSubclassOf (paramType), "#04");
352                 }
353
354                 [Test]
355                 public void TestGetMethodImpl ()
356                 {
357                         // Test binding of new slot methods (using no types)
358                         Assert.AreEqual (typeof (Base), typeof (Base).GetMethod("TestVoid").DeclaringType, "#01");
359                         Assert.AreEqual (typeof (NewVTable), typeof (NewVTable).GetMethod ("TestVoid").DeclaringType, "#02");
360
361                         // Test binding of new slot methods (using types)
362                         Assert.AreEqual (typeof (Base), typeof (Base).GetMethod ("TestInt", new Type[] { typeof (int) }).DeclaringType, "#03");
363                         Assert.AreEqual (typeof (NewVTable), typeof (NewVTable).GetMethod ("TestInt", new Type[] { typeof (int) }).DeclaringType, "#04");
364
365                         // Test overload resolution
366                         Assert.AreEqual (0, typeof (NewVTable).GetMethod ("Overload", new Type[0]).GetParameters ().Length, "#05");
367
368                         // Test byref parameters
369                         Assert.AreEqual (null, typeof (NewVTable).GetMethod ("byref_method", new Type[] { typeof (int) }), "#06");
370                         Type byrefInt = typeof (NewVTable).GetMethod ("byref_method").GetParameters ()[0].ParameterType;
371                         Assert.IsNotNull (typeof (NewVTable).GetMethod ("byref_method", new Type[] { byrefInt }), "#07");
372                 }
373
374                 [Test]
375                 [Category ("TargetJvmNotWorking")]
376                 public void TestGetPropertyImpl ()
377                 {
378                         // Test getting property that is exact
379                         Assert.AreEqual (typeof (NewVTable), typeof (NewVTable).GetProperty ("Item", new Type[1] { typeof (Int32) }).DeclaringType, "#01");
380
381                         // Test getting property that is not exact
382                         Assert.AreEqual (typeof (NewVTable), typeof (NewVTable).GetProperty ("Item", new Type[1] { typeof (Int16) }).DeclaringType, "#02");
383
384                         // Test overriding of properties when only the set accessor is overriden
385                         Assert.AreEqual (1, typeof (Derived1).GetProperties ().Length, "#03");
386                 }
387
388                 [Test]
389                 public void GetProperties ()
390                 {
391                         // Test hide-by-name-and-signature
392                         Assert.AreEqual (1, typeof (Derived2).GetProperties ().Length);
393                         Assert.AreEqual (typeof (Derived2), typeof (Derived2).GetProperties ()[0].DeclaringType);
394                 }
395
396                 [Test] // GetProperties (BindingFlags)
397                 public void GetProperties_Flags ()
398                 {
399                         PropertyInfo [] props;
400                         Type type = typeof (Bar);
401                         BindingFlags flags;
402
403                         flags = BindingFlags.Instance | BindingFlags.NonPublic;
404                         props = type.GetProperties (flags);
405
406                         Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#A1");
407                         Assert.IsTrue (ContainsProperty (props, "ProtInstBase"), "#A2");
408                         Assert.IsTrue (ContainsProperty (props, "ProIntInstBase"), "#A3");
409                         Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#A4");
410 #if NET_2_0
411                         Assert.IsTrue (ContainsProperty (props, "IntInstBase"), "#A5");
412 #else
413                         Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#A5");
414 #endif
415                         Assert.IsTrue (ContainsProperty (props, "PrivInst"), "#A6");
416                         Assert.IsTrue (ContainsProperty (props, "ProtInst"), "#A7");
417                         Assert.IsTrue (ContainsProperty (props, "ProIntInst"), "#A8");
418                         Assert.IsFalse (ContainsProperty (props, "PubInst"), "#A9");
419                         Assert.IsTrue (ContainsProperty (props, "IntInst"), "#A10");
420                         Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#A11");
421                         Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#A12");
422                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#A13");
423                         Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#A14");
424                         Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#A15");
425                         Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#A16");
426                         Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#A17");
427                         Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#A18");
428                         Assert.IsFalse (ContainsProperty (props, "PubStat"), "#A19");
429                         Assert.IsFalse (ContainsProperty (props, "IntStat"), "#A20");
430                         Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#A21");
431                         Assert.IsTrue (ContainsProperty (props, "ProtInstBlue"), "#A22");
432                         Assert.IsTrue (ContainsProperty (props, "ProIntInstBlue"), "#A23");
433                         Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#A24");
434 #if NET_2_0
435                         Assert.IsTrue (ContainsProperty (props, "IntInstBlue"), "#A25");
436 #else
437                         Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#A25");
438 #endif
439                         Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#A26");
440                         Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#A27");
441                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#A28");
442                         Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#A29");
443                         Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#A30");
444
445                         flags = BindingFlags.Instance | BindingFlags.Public;
446                         props = type.GetProperties (flags);
447
448                         Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#B1");
449                         Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#B2");
450                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#B3");
451                         Assert.IsTrue (ContainsProperty (props, "PubInstBase"), "#B4");
452                         Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#B5");
453                         Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#B6");
454                         Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#B7");
455                         Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#B8");
456                         Assert.IsTrue (ContainsProperty (props, "PubInst"), "#B9");
457                         Assert.IsFalse (ContainsProperty (props, "IntInst"), "#B10");
458                         Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#B11");
459                         Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#B12");
460                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#B13");
461                         Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#B14");
462                         Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#B15");
463                         Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#B16");
464                         Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#B17");
465                         Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#B18");
466                         Assert.IsFalse (ContainsProperty (props, "PubStat"), "#B19");
467                         Assert.IsFalse (ContainsProperty (props, "IntStat"), "#B20");
468                         Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#B21");
469                         Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#B22");
470                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#B23");
471                         Assert.IsTrue (ContainsProperty (props, "PubInstBlue"), "#B24");
472                         Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#B25");
473                         Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#B26");
474                         Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#B27");
475                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#B28");
476                         Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#B29");
477                         Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#B30");
478
479                         flags = BindingFlags.Static | BindingFlags.Public;
480                         props = type.GetProperties (flags);
481
482                         Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#C1");
483                         Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#C2");
484                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#C3");
485                         Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#C4");
486                         Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#C5");
487                         Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#C6");
488                         Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#C7");
489                         Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#C8");
490                         Assert.IsFalse (ContainsProperty (props, "PubInst"), "#C9");
491                         Assert.IsFalse (ContainsProperty (props, "IntInst"), "#C10");
492                         Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#C11");
493                         Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#C12");
494                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#C13");
495                         Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#C14");
496                         Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#C15");
497                         Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#C16");
498                         Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#C17");
499                         Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#C18");
500                         Assert.IsTrue (ContainsProperty (props, "PubStat"), "#C19");
501                         Assert.IsFalse (ContainsProperty (props, "IntStat"), "#C20");
502                         Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#C21");
503                         Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#C22");
504                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#C23");
505                         Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#C24");
506                         Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#C25");
507                         Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#C26");
508                         Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#C27");
509                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#C28");
510                         Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#C29");
511                         Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#C30");
512
513                         flags = BindingFlags.Static | BindingFlags.NonPublic;
514                         props = type.GetProperties (flags);
515
516                         Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#D1");
517                         Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#D2");
518                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#D3");
519                         Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#D4");
520                         Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#D5");
521                         Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#D6");
522                         Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#D7");
523                         Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#D8");
524                         Assert.IsFalse (ContainsProperty (props, "PubInst"), "#D9");
525                         Assert.IsFalse (ContainsProperty (props, "IntInst"), "#D10");
526                         Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#D11");
527                         Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#D12");
528                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#D13");
529                         Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#D14");
530                         Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#D15");
531                         Assert.IsTrue (ContainsProperty (props, "PrivStat"), "#D16");
532                         Assert.IsTrue (ContainsProperty (props, "ProtStat"), "#D17");
533                         Assert.IsTrue (ContainsProperty (props, "ProIntStat"), "#D18");
534                         Assert.IsFalse (ContainsProperty (props, "PubStat"), "#D19");
535                         Assert.IsTrue (ContainsProperty (props, "IntStat"), "#D20");
536                         Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#D21");
537                         Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#D22");
538                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#D23");
539                         Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#D24");
540                         Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#D25");
541                         Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#D26");
542                         Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#D27");
543                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#D28");
544                         Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#D29");
545                         Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#D30");
546
547                         flags = BindingFlags.Instance | BindingFlags.NonPublic |
548                                 BindingFlags.FlattenHierarchy;
549                         props = type.GetProperties (flags);
550
551                         Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#E1");
552                         Assert.IsTrue (ContainsProperty (props, "ProtInstBase"), "#E2");
553                         Assert.IsTrue (ContainsProperty (props, "ProIntInstBase"), "#E3");
554                         Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#E4");
555 #if NET_2_0
556                         Assert.IsTrue (ContainsProperty (props, "IntInstBase"), "#E5");
557 #else
558                         Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#E5");
559 #endif
560                         Assert.IsTrue (ContainsProperty (props, "PrivInst"), "#E6");
561                         Assert.IsTrue (ContainsProperty (props, "ProtInst"), "#E7");
562                         Assert.IsTrue (ContainsProperty (props, "ProIntInst"), "#E8");
563                         Assert.IsFalse (ContainsProperty (props, "PubInst"), "#E9");
564                         Assert.IsTrue (ContainsProperty (props, "IntInst"), "#E10");
565                         Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#E11");
566                         Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#E12");
567                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#E13");
568                         Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#E14");
569                         Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#E15");
570                         Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#E16");
571                         Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#E17");
572                         Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#E18");
573                         Assert.IsFalse (ContainsProperty (props, "PubStat"), "#E19");
574                         Assert.IsFalse (ContainsProperty (props, "IntStat"), "#E20");
575                         Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#E21");
576                         Assert.IsTrue (ContainsProperty (props, "ProtInstBlue"), "#E22");
577                         Assert.IsTrue (ContainsProperty (props, "ProIntInstBlue"), "#E23");
578                         Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#E24");
579 #if NET_2_0
580                         Assert.IsTrue (ContainsProperty (props, "IntInstBlue"), "#E25");
581 #else
582                         Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#E25");
583 #endif
584                         Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#E26");
585                         Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#E27");
586                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#E28");
587                         Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#E29");
588                         Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#E30");
589
590                         flags = BindingFlags.Instance | BindingFlags.Public |
591                                 BindingFlags.FlattenHierarchy;
592                         props = type.GetProperties (flags);
593
594                         Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#F1");
595                         Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#F2");
596                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#F3");
597                         Assert.IsTrue (ContainsProperty (props, "PubInstBase"), "#F4");
598                         Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#F5");
599                         Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#F6");
600                         Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#F7");
601                         Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#F8");
602                         Assert.IsTrue (ContainsProperty (props, "PubInst"), "#F9");
603                         Assert.IsFalse (ContainsProperty (props, "IntInst"), "#F10");
604                         Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#F11");
605                         Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#F12");
606                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#F13");
607                         Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#F14");
608                         Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#F15");
609                         Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#F16");
610                         Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#F17");
611                         Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#F18");
612                         Assert.IsFalse (ContainsProperty (props, "PubStat"), "#F19");
613                         Assert.IsFalse (ContainsProperty (props, "IntStat"), "#F20");
614                         Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#F21");
615                         Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#F22");
616                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#F23");
617                         Assert.IsTrue (ContainsProperty (props, "PubInstBlue"), "#F24");
618                         Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#F25");
619                         Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#F26");
620                         Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#F27");
621                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#F28");
622                         Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#F29");
623                         Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#F30");
624
625                         flags = BindingFlags.Static | BindingFlags.Public |
626                                 BindingFlags.FlattenHierarchy;
627                         props = type.GetProperties (flags);
628
629                         Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#G1");
630                         Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#G2");
631                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#G3");
632                         Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#G4");
633                         Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#G5");
634                         Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#G6");
635                         Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#G7");
636                         Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#G8");
637                         Assert.IsFalse (ContainsProperty (props, "PubInst"), "#G9");
638                         Assert.IsFalse (ContainsProperty (props, "IntInst"), "#G10");
639                         Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#G11");
640                         Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#G12");
641                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#G13");
642                         Assert.IsTrue (ContainsProperty (props, "PubStatBase"), "#G14");
643                         Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#G15");
644                         Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#G16");
645                         Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#G17");
646                         Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#G18");
647                         Assert.IsTrue (ContainsProperty (props, "PubStat"), "#G19");
648                         Assert.IsFalse (ContainsProperty (props, "IntStat"), "#G20");
649                         Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#G21");
650                         Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#G22");
651                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#G23");
652                         Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#G24");
653                         Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#G25");
654                         Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#G26");
655                         Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#G27");
656                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#G28");
657                         Assert.IsTrue (ContainsProperty (props, "PubStatBlue"), "#G29");
658                         Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#G30");
659
660                         flags = BindingFlags.Static | BindingFlags.NonPublic |
661                                 BindingFlags.FlattenHierarchy;
662                         props = type.GetProperties (flags);
663
664                         Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#H1");
665                         Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#H2");
666                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#H3");
667                         Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#H4");
668                         Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#H5");
669                         Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#H6");
670                         Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#H7");
671                         Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#H8");
672                         Assert.IsFalse (ContainsProperty (props, "PubInst"), "#H9");
673                         Assert.IsFalse (ContainsProperty (props, "IntInst"), "#H10");
674                         Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#H11");
675                         Assert.IsTrue (ContainsProperty (props, "ProtStatBase"), "#H12");
676                         Assert.IsTrue (ContainsProperty (props, "ProIntStatBase"), "#H13");
677                         Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#H14");
678 #if NET_2_0
679                         Assert.IsTrue (ContainsProperty (props, "IntStatBase"), "#H15");
680 #else
681                         Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#H15");
682 #endif
683                         Assert.IsTrue (ContainsProperty (props, "PrivStat"), "#H16");
684                         Assert.IsTrue (ContainsProperty (props, "ProtStat"), "#H17");
685                         Assert.IsTrue (ContainsProperty (props, "ProIntStat"), "#H18");
686                         Assert.IsFalse (ContainsProperty (props, "PubStat"), "#H19");
687                         Assert.IsTrue (ContainsProperty (props, "IntStat"), "#H20");
688                         Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#H21");
689                         Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#H22");
690                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#H23");
691                         Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#H24");
692                         Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#H25");
693                         Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#H26");
694                         Assert.IsTrue (ContainsProperty (props, "ProtStatBlue"), "#H27");
695                         Assert.IsTrue (ContainsProperty (props, "ProIntStatBlue"), "#H28");
696                         Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#H29");
697 #if NET_2_0
698                         Assert.IsTrue (ContainsProperty (props, "IntStatBlue"), "#H30");
699 #else
700                         Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#H50");
701 #endif
702
703                         flags = BindingFlags.Instance | BindingFlags.NonPublic |
704                                 BindingFlags.DeclaredOnly;
705                         props = type.GetProperties (flags);
706
707                         Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#I1");
708                         Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#I2");
709                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#I3");
710                         Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#I4");
711                         Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#I5");
712                         Assert.IsTrue (ContainsProperty (props, "PrivInst"), "#I6");
713                         Assert.IsTrue (ContainsProperty (props, "ProtInst"), "#I7");
714                         Assert.IsTrue (ContainsProperty (props, "ProIntInst"), "#I8");
715                         Assert.IsFalse (ContainsProperty (props, "PubInst"), "#I9");
716                         Assert.IsTrue (ContainsProperty (props, "IntInst"), "#I10");
717                         Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#I11");
718                         Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#I12");
719                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#I13");
720                         Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#I14");
721                         Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#I15");
722                         Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#I16");
723                         Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#I17");
724                         Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#I18");
725                         Assert.IsFalse (ContainsProperty (props, "PubStat"), "#I19");
726                         Assert.IsFalse (ContainsProperty (props, "IntStat"), "#I20");
727                         Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#I21");
728                         Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#I22");
729                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#I23");
730                         Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#I24");
731                         Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#I25");
732                         Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#I26");
733                         Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#I27");
734                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#I28");
735                         Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#I29");
736                         Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#I30");
737
738                         flags = BindingFlags.Instance | BindingFlags.Public |
739                                 BindingFlags.DeclaredOnly;
740                         props = type.GetProperties (flags);
741
742                         Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#J1");
743                         Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#J2");
744                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#J3");
745                         Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#J4");
746                         Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#J5");
747                         Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#J6");
748                         Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#J7");
749                         Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#J8");
750                         Assert.IsTrue (ContainsProperty (props, "PubInst"), "#J9");
751                         Assert.IsFalse (ContainsProperty (props, "IntInst"), "#J10");
752                         Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#J11");
753                         Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#J12");
754                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#J13");
755                         Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#J14");
756                         Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#J15");
757                         Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#J16");
758                         Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#J17");
759                         Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#J18");
760                         Assert.IsFalse (ContainsProperty (props, "PubStat"), "#J19");
761                         Assert.IsFalse (ContainsProperty (props, "IntStat"), "#J20");
762                         Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#J21");
763                         Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#J22");
764                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#J23");
765                         Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#J24");
766                         Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#J25");
767                         Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#J26");
768                         Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#J27");
769                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#J28");
770                         Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#J29");
771                         Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#J30");
772
773                         flags = BindingFlags.Static | BindingFlags.Public |
774                                 BindingFlags.DeclaredOnly;
775                         props = type.GetProperties (flags);
776
777                         Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#K1");
778                         Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#K2");
779                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#K3");
780                         Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#K4");
781                         Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#K5");
782                         Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#K6");
783                         Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#K7");
784                         Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#K8");
785                         Assert.IsFalse (ContainsProperty (props, "PubInst"), "#K9");
786                         Assert.IsFalse (ContainsProperty (props, "IntInst"), "#K10");
787                         Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#K11");
788                         Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#K12");
789                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#K13");
790                         Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#K14");
791                         Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#K15");
792                         Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#K16");
793                         Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#K17");
794                         Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#K18");
795                         Assert.IsTrue (ContainsProperty (props, "PubStat"), "#K19");
796                         Assert.IsFalse (ContainsProperty (props, "IntStat"), "#K20");
797                         Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#K21");
798                         Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#K22");
799                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#K23");
800                         Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#K24");
801                         Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#K25");
802                         Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#K26");
803                         Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#K27");
804                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#K28");
805                         Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#K29");
806                         Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#K30");
807
808                         flags = BindingFlags.Static | BindingFlags.NonPublic |
809                                 BindingFlags.DeclaredOnly;
810                         props = type.GetProperties (flags);
811
812                         Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#L1");
813                         Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#L2");
814                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#L3");
815                         Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#L4");
816                         Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#L5");
817                         Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#L6");
818                         Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#L7");
819                         Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#L8");
820                         Assert.IsFalse (ContainsProperty (props, "PubInst"), "#L9");
821                         Assert.IsFalse (ContainsProperty (props, "IntInst"), "#L10");
822                         Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#L11");
823                         Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#L12");
824                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#L13");
825                         Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#L14");
826                         Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#L15");
827                         Assert.IsTrue (ContainsProperty (props, "PrivStat"), "#L16");
828                         Assert.IsTrue (ContainsProperty (props, "ProtStat"), "#L17");
829                         Assert.IsTrue (ContainsProperty (props, "ProIntStat"), "#L18");
830                         Assert.IsFalse (ContainsProperty (props, "PubStat"), "#L19");
831                         Assert.IsTrue (ContainsProperty (props, "IntStat"), "#L20");
832                         Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#L21");
833                         Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#L22");
834                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#L23");
835                         Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#L24");
836                         Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#L25");
837                         Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#L26");
838                         Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#L27");
839                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#L28");
840                         Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#L29");
841                         Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#L30");
842
843                         flags = BindingFlags.Instance | BindingFlags.NonPublic |
844                                 BindingFlags.Public;
845                         props = type.GetProperties (flags);
846
847                         Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#M1");
848                         Assert.IsTrue (ContainsProperty (props, "ProtInstBase"), "#M2");
849                         Assert.IsTrue (ContainsProperty (props, "ProIntInstBase"), "#M3");
850                         Assert.IsTrue (ContainsProperty (props, "PubInstBase"), "#M4");
851 #if NET_2_0
852                         Assert.IsTrue (ContainsProperty (props, "IntInstBase"), "#M5");
853 #else
854                         Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#M5");
855 #endif
856                         Assert.IsTrue (ContainsProperty (props, "PrivInst"), "#M6");
857                         Assert.IsTrue (ContainsProperty (props, "ProtInst"), "#M7");
858                         Assert.IsTrue (ContainsProperty (props, "ProIntInst"), "#M8");
859                         Assert.IsTrue (ContainsProperty (props, "PubInst"), "#M9");
860                         Assert.IsTrue (ContainsProperty (props, "IntInst"), "#M10");
861                         Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#M11");
862                         Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#M12");
863                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#M13");
864                         Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#M14");
865                         Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#M15");
866                         Assert.IsFalse (ContainsProperty (props, "PrivStat"), "#M16");
867                         Assert.IsFalse (ContainsProperty (props, "ProtStat"), "#M17");
868                         Assert.IsFalse (ContainsProperty (props, "ProIntStat"), "#M18");
869                         Assert.IsFalse (ContainsProperty (props, "PubStat"), "#M19");
870                         Assert.IsFalse (ContainsProperty (props, "IntStat"), "#M20");
871                         Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#M21");
872                         Assert.IsTrue (ContainsProperty (props, "ProtInstBlue"), "#M22");
873                         Assert.IsTrue (ContainsProperty (props, "ProIntInstBlue"), "#M23");
874                         Assert.IsTrue (ContainsProperty (props, "PubInstBlue"), "#M24");
875 #if NET_2_0
876                         Assert.IsTrue (ContainsProperty (props, "IntInstBlue"), "#M25");
877 #else
878                         Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#M25");
879 #endif
880                         Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#M26");
881                         Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#M27");
882                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#M28");
883                         Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#M29");
884                         Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#M30");
885
886                         flags = BindingFlags.Static | BindingFlags.NonPublic |
887                                 BindingFlags.Public;
888                         props = type.GetProperties (flags);
889
890                         Assert.IsFalse (ContainsProperty (props, "PrivInstBase"), "#N1");
891                         Assert.IsFalse (ContainsProperty (props, "ProtInstBase"), "#N2");
892                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBase"), "#N3");
893                         Assert.IsFalse (ContainsProperty (props, "PubInstBase"), "#N4");
894                         Assert.IsFalse (ContainsProperty (props, "IntInstBase"), "#N5");
895                         Assert.IsFalse (ContainsProperty (props, "PrivInst"), "#N6");
896                         Assert.IsFalse (ContainsProperty (props, "ProtInst"), "#N7");
897                         Assert.IsFalse (ContainsProperty (props, "ProIntInst"), "#N8");
898                         Assert.IsFalse (ContainsProperty (props, "PubInst"), "#N9");
899                         Assert.IsFalse (ContainsProperty (props, "IntInst"), "#N10");
900                         Assert.IsFalse (ContainsProperty (props, "PrivStatBase"), "#N11");
901                         Assert.IsFalse (ContainsProperty (props, "ProtStatBase"), "#N12");
902                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBase"), "#N13");
903                         Assert.IsFalse (ContainsProperty (props, "PubStatBase"), "#N14");
904                         Assert.IsFalse (ContainsProperty (props, "IntStatBase"), "#N15");
905                         Assert.IsTrue (ContainsProperty (props, "PrivStat"), "#N16");
906                         Assert.IsTrue (ContainsProperty (props, "ProtStat"), "#N17");
907                         Assert.IsTrue (ContainsProperty (props, "ProIntStat"), "#N18");
908                         Assert.IsTrue (ContainsProperty (props, "PubStat"), "#N19");
909                         Assert.IsTrue (ContainsProperty (props, "IntStat"), "#N20");
910                         Assert.IsFalse (ContainsProperty (props, "PrivInstBlue"), "#N21");
911                         Assert.IsFalse (ContainsProperty (props, "ProtInstBlue"), "#N22");
912                         Assert.IsFalse (ContainsProperty (props, "ProIntInstBlue"), "#N23");
913                         Assert.IsFalse (ContainsProperty (props, "PubInstBlue"), "#N24");
914                         Assert.IsFalse (ContainsProperty (props, "IntInstBlue"), "#N25");
915                         Assert.IsFalse (ContainsProperty (props, "PrivStatBlue"), "#N26");
916                         Assert.IsFalse (ContainsProperty (props, "ProtStatBlue"), "#N27");
917                         Assert.IsFalse (ContainsProperty (props, "ProIntStatBlue"), "#N28");
918                         Assert.IsFalse (ContainsProperty (props, "PubStatBlue"), "#N29");
919                         Assert.IsFalse (ContainsProperty (props, "IntStatBlue"), "#N30");
920                 }
921
922                 [Test] // GetProperty (String)
923                 public void GetProperty1_Name_Null ()
924                 {
925                         Type type = typeof (Bar);
926                         try {
927                                 type.GetProperty ((string) null);
928                                 Assert.Fail ("#1");
929                         } catch (ArgumentNullException ex) {
930                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
931                                 Assert.IsNull (ex.InnerException, "#3");
932                                 Assert.IsNotNull (ex.Message, "#4");
933                                 Assert.IsNotNull (ex.ParamName, "#5");
934                                 Assert.AreEqual ("name", ex.ParamName, "#6");
935                         }
936                 }
937
938                 [Test] // GetProperty (String, BindingFlags)
939                 public void GetProperty2 ()
940                 {
941                         Type type = typeof (Bar);
942                         BindingFlags flags;
943
944                         flags = BindingFlags.Instance | BindingFlags.NonPublic;
945
946                         Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#A1");
947                         Assert.IsNotNull (type.GetProperty ("ProtInstBase", flags), "#A2");
948                         Assert.IsNotNull (type.GetProperty ("ProIntInstBase", flags), "#A3");
949                         Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#A4");
950 #if NET_2_0
951                         Assert.IsNotNull (type.GetProperty ("IntInstBase", flags), "#A5");
952 #else
953                         Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#A5");
954 #endif
955                         Assert.IsNotNull (type.GetProperty ("PrivInst", flags), "#A6");
956                         Assert.IsNotNull (type.GetProperty ("ProtInst", flags), "#A7");
957                         Assert.IsNotNull (type.GetProperty ("ProIntInst", flags), "#A8");
958                         Assert.IsNull (type.GetProperty ("PubInst", flags), "#A9");
959                         Assert.IsNotNull (type.GetProperty ("IntInst", flags), "#A10");
960                         Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#A11");
961                         Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#A12");
962                         Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#A13");
963                         Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#A14");
964                         Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#A15");
965                         Assert.IsNull (type.GetProperty ("PrivStat", flags), "#A16");
966                         Assert.IsNull (type.GetProperty ("ProtStat", flags), "#A17");
967                         Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#A18");
968                         Assert.IsNull (type.GetProperty ("PubStat", flags), "#A19");
969                         Assert.IsNull (type.GetProperty ("IntStat", flags), "#A20");
970                         Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#A21");
971                         Assert.IsNotNull (type.GetProperty ("ProtInstBlue", flags), "#A22");
972                         Assert.IsNotNull (type.GetProperty ("ProIntInstBlue", flags), "#A23");
973                         Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#A24");
974 #if NET_2_0
975                         Assert.IsNotNull (type.GetProperty ("IntInstBlue", flags), "#A25");
976 #else
977                         Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#A25");
978 #endif
979                         Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#A26");
980                         Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#A27");
981                         Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#A28");
982                         Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#A29");
983                         Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#A30");
984
985                         flags = BindingFlags.Instance | BindingFlags.Public;
986
987                         Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#B1");
988                         Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#B2");
989                         Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#B3");
990                         Assert.IsNotNull (type.GetProperty ("PubInstBase", flags), "#B4");
991                         Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#B5");
992                         Assert.IsNull (type.GetProperty ("PrivInst", flags), "#B6");
993                         Assert.IsNull (type.GetProperty ("ProtInst", flags), "#B7");
994                         Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#B8");
995                         Assert.IsNotNull (type.GetProperty ("PubInst", flags), "#B9");
996                         Assert.IsNull (type.GetProperty ("IntInst", flags), "#B10");
997                         Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#B11");
998                         Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#B12");
999                         Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#B13");
1000                         Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#B14");
1001                         Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#B15");
1002                         Assert.IsNull (type.GetProperty ("PrivStat", flags), "#B16");
1003                         Assert.IsNull (type.GetProperty ("ProtStat", flags), "#B17");
1004                         Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#B18");
1005                         Assert.IsNull (type.GetProperty ("PubStat", flags), "#B19");
1006                         Assert.IsNull (type.GetProperty ("IntStat", flags), "#B20");
1007                         Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#B21");
1008                         Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#B22");
1009                         Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#B23");
1010                         Assert.IsNotNull (type.GetProperty ("PubInstBlue", flags), "#B24");
1011                         Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#B25");
1012                         Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#B26");
1013                         Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#B27");
1014                         Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#B28");
1015                         Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#B29");
1016                         Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#B30");
1017
1018                         flags = BindingFlags.Static | BindingFlags.Public;
1019
1020                         Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#C1");
1021                         Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#C2");
1022                         Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#C3");
1023                         Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#C4");
1024                         Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#C5");
1025                         Assert.IsNull (type.GetProperty ("PrivInst", flags), "#C6");
1026                         Assert.IsNull (type.GetProperty ("ProtInst", flags), "#C7");
1027                         Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#C8");
1028                         Assert.IsNull (type.GetProperty ("PubInst", flags), "#C9");
1029                         Assert.IsNull (type.GetProperty ("IntInst", flags), "#C10");
1030                         Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#C11");
1031                         Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#C12");
1032                         Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#C13");
1033                         Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#C14");
1034                         Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#C15");
1035                         Assert.IsNull (type.GetProperty ("PrivStat", flags), "#C16");
1036                         Assert.IsNull (type.GetProperty ("ProtStat", flags), "#C17");
1037                         Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#C18");
1038                         Assert.IsNotNull (type.GetProperty ("PubStat", flags), "#C19");
1039                         Assert.IsNull (type.GetProperty ("IntStat", flags), "#C20");
1040                         Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#C21");
1041                         Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#C22");
1042                         Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#C23");
1043                         Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#C24");
1044                         Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#C25");
1045                         Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#C26");
1046                         Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#C27");
1047                         Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#C28");
1048                         Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#C29");
1049                         Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#C30");
1050
1051                         flags = BindingFlags.Static | BindingFlags.NonPublic;
1052
1053                         Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#D1");
1054                         Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#D2");
1055                         Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#D3");
1056                         Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#D4");
1057                         Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#D5");
1058                         Assert.IsNull (type.GetProperty ("PrivInst", flags), "#D6");
1059                         Assert.IsNull (type.GetProperty ("ProtInst", flags), "#D7");
1060                         Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#D8");
1061                         Assert.IsNull (type.GetProperty ("PubInst", flags), "#D9");
1062                         Assert.IsNull (type.GetProperty ("IntInst", flags), "#D10");
1063                         Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#D11");
1064                         Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#D12");
1065                         Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#D13");
1066                         Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#D14");
1067                         Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#D15");
1068                         Assert.IsNotNull (type.GetProperty ("PrivStat", flags), "#D16");
1069                         Assert.IsNotNull (type.GetProperty ("ProtStat", flags), "#D17");
1070                         Assert.IsNotNull (type.GetProperty ("ProIntStat", flags), "#D18");
1071                         Assert.IsNull (type.GetProperty ("PubStat", flags), "#D19");
1072                         Assert.IsNotNull (type.GetProperty ("IntStat", flags), "#D20");
1073                         Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#D21");
1074                         Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#D22");
1075                         Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#D23");
1076                         Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#D24");
1077                         Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#D25");
1078                         Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#D26");
1079                         Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#D27");
1080                         Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#D28");
1081                         Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#D29");
1082                         Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#D30");
1083
1084                         flags = BindingFlags.Instance | BindingFlags.NonPublic |
1085                                 BindingFlags.FlattenHierarchy;
1086
1087                         Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#E1");
1088                         Assert.IsNotNull (type.GetProperty ("ProtInstBase", flags), "#E2");
1089                         Assert.IsNotNull (type.GetProperty ("ProIntInstBase", flags), "#E3");
1090                         Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#E4");
1091 #if NET_2_0
1092                         Assert.IsNotNull (type.GetProperty ("IntInstBase", flags), "#E5");
1093 #else
1094                         Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#E5");
1095 #endif
1096                         Assert.IsNotNull (type.GetProperty ("PrivInst", flags), "#E6");
1097                         Assert.IsNotNull (type.GetProperty ("ProtInst", flags), "#E7");
1098                         Assert.IsNotNull (type.GetProperty ("ProIntInst", flags), "#E8");
1099                         Assert.IsNull (type.GetProperty ("PubInst", flags), "#E9");
1100                         Assert.IsNotNull (type.GetProperty ("IntInst", flags), "#E10");
1101                         Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#E11");
1102                         Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#E12");
1103                         Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#E13");
1104                         Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#E14");
1105                         Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#E15");
1106                         Assert.IsNull (type.GetProperty ("PrivStat", flags), "#E16");
1107                         Assert.IsNull (type.GetProperty ("ProtStat", flags), "#E17");
1108                         Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#E18");
1109                         Assert.IsNull (type.GetProperty ("PubStat", flags), "#E19");
1110                         Assert.IsNull (type.GetProperty ("IntStat", flags), "#E20");
1111                         Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#E21");
1112                         Assert.IsNotNull (type.GetProperty ("ProtInstBlue", flags), "#E22");
1113                         Assert.IsNotNull (type.GetProperty ("ProIntInstBlue", flags), "#E23");
1114                         Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#E24");
1115 #if NET_2_0
1116                         Assert.IsNotNull (type.GetProperty ("IntInstBlue", flags), "#E25");
1117 #else
1118                         Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#E25");
1119 #endif
1120                         Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#E26");
1121                         Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#E27");
1122                         Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#E28");
1123                         Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#E29");
1124                         Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#E30");
1125
1126                         flags = BindingFlags.Instance | BindingFlags.Public |
1127                                 BindingFlags.FlattenHierarchy;
1128
1129                         Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#F1");
1130                         Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#F2");
1131                         Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#F3");
1132                         Assert.IsNotNull (type.GetProperty ("PubInstBase", flags), "#F4");
1133                         Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#F5");
1134                         Assert.IsNull (type.GetProperty ("PrivInst", flags), "#F6");
1135                         Assert.IsNull (type.GetProperty ("ProtInst", flags), "#F7");
1136                         Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#F8");
1137                         Assert.IsNotNull (type.GetProperty ("PubInst", flags), "#F9");
1138                         Assert.IsNull (type.GetProperty ("IntInst", flags), "#F10");
1139                         Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#F11");
1140                         Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#F12");
1141                         Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#F13");
1142                         Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#F14");
1143                         Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#F15");
1144                         Assert.IsNull (type.GetProperty ("PrivStat", flags), "#F16");
1145                         Assert.IsNull (type.GetProperty ("ProtStat", flags), "#F17");
1146                         Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#F18");
1147                         Assert.IsNull (type.GetProperty ("PubStat", flags), "#F19");
1148                         Assert.IsNull (type.GetProperty ("IntStat", flags), "#F20");
1149                         Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#F21");
1150                         Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#F22");
1151                         Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#F23");
1152                         Assert.IsNotNull (type.GetProperty ("PubInstBlue", flags), "#F24");
1153                         Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#F25");
1154                         Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#F26");
1155                         Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#F27");
1156                         Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#F28");
1157                         Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#F29");
1158                         Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#F30");
1159
1160                         flags = BindingFlags.Static | BindingFlags.Public |
1161                                 BindingFlags.FlattenHierarchy;
1162
1163                         Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#G1");
1164                         Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#G2");
1165                         Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#G3");
1166                         Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#G4");
1167                         Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#G5");
1168                         Assert.IsNull (type.GetProperty ("PrivInst", flags), "#G6");
1169                         Assert.IsNull (type.GetProperty ("ProtInst", flags), "#G7");
1170                         Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#G8");
1171                         Assert.IsNull (type.GetProperty ("PubInst", flags), "#G9");
1172                         Assert.IsNull (type.GetProperty ("IntInst", flags), "#G10");
1173                         Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#G11");
1174                         Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#G12");
1175                         Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#G13");
1176                         Assert.IsNotNull (type.GetProperty ("PubStatBase", flags), "#G14");
1177                         Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#G15");
1178                         Assert.IsNull (type.GetProperty ("PrivStat", flags), "#G16");
1179                         Assert.IsNull (type.GetProperty ("ProtStat", flags), "#G17");
1180                         Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#G18");
1181                         Assert.IsNotNull (type.GetProperty ("PubStat", flags), "#G19");
1182                         Assert.IsNull (type.GetProperty ("IntStat", flags), "#G20");
1183                         Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#G21");
1184                         Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#G22");
1185                         Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#G23");
1186                         Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#G24");
1187                         Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#G25");
1188                         Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#G26");
1189                         Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#G27");
1190                         Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#G28");
1191                         Assert.IsNotNull (type.GetProperty ("PubStatBlue", flags), "#G29");
1192                         Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#G30");
1193
1194                         flags = BindingFlags.Static | BindingFlags.NonPublic |
1195                                 BindingFlags.FlattenHierarchy;
1196
1197                         Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#H1");
1198                         Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#H2");
1199                         Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#H3");
1200                         Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#H4");
1201                         Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#H5");
1202                         Assert.IsNull (type.GetProperty ("PrivInst", flags), "#H6");
1203                         Assert.IsNull (type.GetProperty ("ProtInst", flags), "#H7");
1204                         Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#H8");
1205                         Assert.IsNull (type.GetProperty ("PubInst", flags), "#H9");
1206                         Assert.IsNull (type.GetProperty ("IntInst", flags), "#H10");
1207                         Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#H11");
1208                         Assert.IsNotNull (type.GetProperty ("ProtStatBase", flags), "#H12");
1209                         Assert.IsNotNull (type.GetProperty ("ProIntStatBase", flags), "#H13");
1210                         Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#H14");
1211 #if NET_2_0
1212                         Assert.IsNotNull (type.GetProperty ("IntStatBase", flags), "#H15");
1213 #else
1214                         Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#H15");
1215 #endif
1216                         Assert.IsNotNull (type.GetProperty ("PrivStat", flags), "#H16");
1217                         Assert.IsNotNull (type.GetProperty ("ProtStat", flags), "#H17");
1218                         Assert.IsNotNull (type.GetProperty ("ProIntStat", flags), "#H18");
1219                         Assert.IsNull (type.GetProperty ("PubStat", flags), "#H19");
1220                         Assert.IsNotNull (type.GetProperty ("IntStat", flags), "#H20");
1221                         Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#H21");
1222                         Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#H22");
1223                         Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#H23");
1224                         Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#H24");
1225                         Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#H25");
1226                         Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#H26");
1227                         Assert.IsNotNull (type.GetProperty ("ProtStatBlue", flags), "#H27");
1228                         Assert.IsNotNull (type.GetProperty ("ProIntStatBlue", flags), "#H28");
1229                         Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#H29");
1230 #if NET_2_0
1231                         Assert.IsNotNull (type.GetProperty ("IntStatBlue", flags), "#H30");
1232 #else
1233                         Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#H60");
1234 #endif
1235
1236                         flags = BindingFlags.Instance | BindingFlags.NonPublic |
1237                                 BindingFlags.DeclaredOnly;
1238
1239                         Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#I1");
1240                         Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#I2");
1241                         Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#I3");
1242                         Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#I4");
1243                         Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#I5");
1244                         Assert.IsNotNull (type.GetProperty ("PrivInst", flags), "#I6");
1245                         Assert.IsNotNull (type.GetProperty ("ProtInst", flags), "#I7");
1246                         Assert.IsNotNull (type.GetProperty ("ProIntInst", flags), "#I8");
1247                         Assert.IsNull (type.GetProperty ("PubInst", flags), "#I9");
1248                         Assert.IsNotNull (type.GetProperty ("IntInst", flags), "#I10");
1249                         Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#I11");
1250                         Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#I12");
1251                         Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#I13");
1252                         Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#I14");
1253                         Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#I15");
1254                         Assert.IsNull (type.GetProperty ("PrivStat", flags), "#I16");
1255                         Assert.IsNull (type.GetProperty ("ProtStat", flags), "#I17");
1256                         Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#I18");
1257                         Assert.IsNull (type.GetProperty ("PubStat", flags), "#I19");
1258                         Assert.IsNull (type.GetProperty ("IntStat", flags), "#I20");
1259                         Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#I21");
1260                         Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#I22");
1261                         Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#I23");
1262                         Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#I24");
1263                         Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#I25");
1264                         Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#I26");
1265                         Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#I27");
1266                         Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#I28");
1267                         Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#I29");
1268                         Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#I30");
1269
1270                         flags = BindingFlags.Instance | BindingFlags.Public |
1271                                 BindingFlags.DeclaredOnly;
1272
1273                         Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#J1");
1274                         Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#J2");
1275                         Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#J3");
1276                         Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#J4");
1277                         Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#J5");
1278                         Assert.IsNull (type.GetProperty ("PrivInst", flags), "#J6");
1279                         Assert.IsNull (type.GetProperty ("ProtInst", flags), "#J7");
1280                         Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#J8");
1281                         Assert.IsNotNull (type.GetProperty ("PubInst", flags), "#J9");
1282                         Assert.IsNull (type.GetProperty ("IntInst", flags), "#J10");
1283                         Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#J11");
1284                         Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#J12");
1285                         Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#J13");
1286                         Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#J14");
1287                         Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#J15");
1288                         Assert.IsNull (type.GetProperty ("PrivStat", flags), "#J16");
1289                         Assert.IsNull (type.GetProperty ("ProtStat", flags), "#J17");
1290                         Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#J18");
1291                         Assert.IsNull (type.GetProperty ("PubStat", flags), "#J19");
1292                         Assert.IsNull (type.GetProperty ("IntStat", flags), "#J20");
1293                         Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#J21");
1294                         Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#J22");
1295                         Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#J23");
1296                         Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#J24");
1297                         Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#J25");
1298                         Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#J26");
1299                         Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#J27");
1300                         Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#J28");
1301                         Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#J29");
1302                         Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#J30");
1303
1304                         flags = BindingFlags.Static | BindingFlags.Public |
1305                                 BindingFlags.DeclaredOnly;
1306
1307                         Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#K1");
1308                         Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#K2");
1309                         Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#K3");
1310                         Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#K4");
1311                         Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#K5");
1312                         Assert.IsNull (type.GetProperty ("PrivInst", flags), "#K6");
1313                         Assert.IsNull (type.GetProperty ("ProtInst", flags), "#K7");
1314                         Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#K8");
1315                         Assert.IsNull (type.GetProperty ("PubInst", flags), "#K9");
1316                         Assert.IsNull (type.GetProperty ("IntInst", flags), "#K10");
1317                         Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#K11");
1318                         Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#K12");
1319                         Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#K13");
1320                         Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#K14");
1321                         Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#K15");
1322                         Assert.IsNull (type.GetProperty ("PrivStat", flags), "#K16");
1323                         Assert.IsNull (type.GetProperty ("ProtStat", flags), "#K17");
1324                         Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#K18");
1325                         Assert.IsNotNull (type.GetProperty ("PubStat", flags), "#K19");
1326                         Assert.IsNull (type.GetProperty ("IntStat", flags), "#K20");
1327                         Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#K21");
1328                         Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#K22");
1329                         Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#K23");
1330                         Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#K24");
1331                         Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#K25");
1332                         Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#K26");
1333                         Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#K27");
1334                         Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#K28");
1335                         Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#K29");
1336                         Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#K30");
1337
1338                         flags = BindingFlags.Static | BindingFlags.NonPublic |
1339                                 BindingFlags.DeclaredOnly;
1340
1341                         Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#L1");
1342                         Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#L2");
1343                         Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#L3");
1344                         Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#L4");
1345                         Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#L5");
1346                         Assert.IsNull (type.GetProperty ("PrivInst", flags), "#L6");
1347                         Assert.IsNull (type.GetProperty ("ProtInst", flags), "#L7");
1348                         Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#L8");
1349                         Assert.IsNull (type.GetProperty ("PubInst", flags), "#L9");
1350                         Assert.IsNull (type.GetProperty ("IntInst", flags), "#L10");
1351                         Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#L11");
1352                         Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#L12");
1353                         Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#L13");
1354                         Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#L14");
1355                         Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#L15");
1356                         Assert.IsNotNull (type.GetProperty ("PrivStat", flags), "#L16");
1357                         Assert.IsNotNull (type.GetProperty ("ProtStat", flags), "#L17");
1358                         Assert.IsNotNull (type.GetProperty ("ProIntStat", flags), "#L18");
1359                         Assert.IsNull (type.GetProperty ("PubStat", flags), "#L19");
1360                         Assert.IsNotNull (type.GetProperty ("IntStat", flags), "#L20");
1361                         Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#L21");
1362                         Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#L22");
1363                         Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#L23");
1364                         Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#L24");
1365                         Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#L25");
1366                         Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#L26");
1367                         Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#L27");
1368                         Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#L28");
1369                         Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#L29");
1370                         Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#L30");
1371
1372                         flags = BindingFlags.Instance | BindingFlags.NonPublic |
1373                                 BindingFlags.Public;
1374
1375                         Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#M1");
1376                         Assert.IsNotNull (type.GetProperty ("ProtInstBase", flags), "#M2");
1377                         Assert.IsNotNull (type.GetProperty ("ProIntInstBase", flags), "#M3");
1378                         Assert.IsNotNull (type.GetProperty ("PubInstBase", flags), "#M4");
1379 #if NET_2_0
1380                         Assert.IsNotNull (type.GetProperty ("IntInstBase", flags), "#M5");
1381 #else
1382                         Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#M5");
1383 #endif
1384                         Assert.IsNotNull (type.GetProperty ("PrivInst", flags), "#M6");
1385                         Assert.IsNotNull (type.GetProperty ("ProtInst", flags), "#M7");
1386                         Assert.IsNotNull (type.GetProperty ("ProIntInst", flags), "#M8");
1387                         Assert.IsNotNull (type.GetProperty ("PubInst", flags), "#M9");
1388                         Assert.IsNotNull (type.GetProperty ("IntInst", flags), "#M10");
1389                         Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#M11");
1390                         Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#M12");
1391                         Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#M13");
1392                         Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#M14");
1393                         Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#M15");
1394                         Assert.IsNull (type.GetProperty ("PrivStat", flags), "#M16");
1395                         Assert.IsNull (type.GetProperty ("ProtStat", flags), "#M17");
1396                         Assert.IsNull (type.GetProperty ("ProIntStat", flags), "#M18");
1397                         Assert.IsNull (type.GetProperty ("PubStat", flags), "#M19");
1398                         Assert.IsNull (type.GetProperty ("IntStat", flags), "#M20");
1399                         Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#M21");
1400                         Assert.IsNotNull (type.GetProperty ("ProtInstBlue", flags), "#M22");
1401                         Assert.IsNotNull (type.GetProperty ("ProIntInstBlue", flags), "#M23");
1402                         Assert.IsNotNull (type.GetProperty ("PubInstBlue", flags), "#M24");
1403 #if NET_2_0
1404                         Assert.IsNotNull (type.GetProperty ("IntInstBlue", flags), "#M25");
1405 #else
1406                         Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#M25");
1407 #endif
1408                         Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#M26");
1409                         Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#M27");
1410                         Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#M28");
1411                         Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#M29");
1412                         Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#M30");
1413
1414                         flags = BindingFlags.Static | BindingFlags.NonPublic |
1415                                 BindingFlags.Public;
1416
1417                         Assert.IsNull (type.GetProperty ("PrivInstBase", flags), "#N1");
1418                         Assert.IsNull (type.GetProperty ("ProtInstBase", flags), "#N2");
1419                         Assert.IsNull (type.GetProperty ("ProIntInstBase", flags), "#N3");
1420                         Assert.IsNull (type.GetProperty ("PubInstBase", flags), "#N4");
1421                         Assert.IsNull (type.GetProperty ("IntInstBase", flags), "#N5");
1422                         Assert.IsNull (type.GetProperty ("PrivInst", flags), "#N6");
1423                         Assert.IsNull (type.GetProperty ("ProtInst", flags), "#N7");
1424                         Assert.IsNull (type.GetProperty ("ProIntInst", flags), "#N8");
1425                         Assert.IsNull (type.GetProperty ("PubInst", flags), "#N9");
1426                         Assert.IsNull (type.GetProperty ("IntInst", flags), "#N10");
1427                         Assert.IsNull (type.GetProperty ("PrivStatBase", flags), "#N11");
1428                         Assert.IsNull (type.GetProperty ("ProtStatBase", flags), "#N12");
1429                         Assert.IsNull (type.GetProperty ("ProIntStatBase", flags), "#N13");
1430                         Assert.IsNull (type.GetProperty ("PubStatBase", flags), "#N14");
1431                         Assert.IsNull (type.GetProperty ("IntStatBase", flags), "#N15");
1432                         Assert.IsNotNull (type.GetProperty ("PrivStat", flags), "#N16");
1433                         Assert.IsNotNull (type.GetProperty ("ProtStat", flags), "#N17");
1434                         Assert.IsNotNull (type.GetProperty ("ProIntStat", flags), "#N18");
1435                         Assert.IsNotNull (type.GetProperty ("PubStat", flags), "#N19");
1436                         Assert.IsNotNull (type.GetProperty ("IntStat", flags), "#N20");
1437                         Assert.IsNull (type.GetProperty ("PrivInstBlue", flags), "#N21");
1438                         Assert.IsNull (type.GetProperty ("ProtInstBlue", flags), "#N22");
1439                         Assert.IsNull (type.GetProperty ("ProIntInstBlue", flags), "#N23");
1440                         Assert.IsNull (type.GetProperty ("PubInstBlue", flags), "#N24");
1441                         Assert.IsNull (type.GetProperty ("IntInstBlue", flags), "#N25");
1442                         Assert.IsNull (type.GetProperty ("PrivStatBlue", flags), "#N26");
1443                         Assert.IsNull (type.GetProperty ("ProtStatBlue", flags), "#N27");
1444                         Assert.IsNull (type.GetProperty ("ProIntStatBlue", flags), "#N28");
1445                         Assert.IsNull (type.GetProperty ("PubStatBlue", flags), "#N29");
1446                         Assert.IsNull (type.GetProperty ("IntStatBlue", flags), "#N30");
1447                 }
1448
1449                 [Test] // GetProperty (String, BindingFlags)
1450                 public void GetProperty2_Name_Null ()
1451                 {
1452                         Type type = typeof (Bar);
1453                         try {
1454                                 type.GetProperty ((string) null);
1455                                 Assert.Fail ("#1");
1456                         } catch (ArgumentNullException ex) {
1457                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
1458                                 Assert.IsNull (ex.InnerException, "#3");
1459                                 Assert.IsNotNull (ex.Message, "#4");
1460                                 Assert.IsNotNull (ex.ParamName, "#5");
1461                                 Assert.AreEqual ("name", ex.ParamName, "#6");
1462                         }
1463                 }
1464
1465                 [Test] // GetProperty (String, Type)
1466                 public void GetProperty3_Name_Null ()
1467                 {
1468                         Type type = typeof (Bar);
1469                         try {
1470                                 type.GetProperty ((string) null, typeof (int));
1471                                 Assert.Fail ("#1");
1472                         } catch (ArgumentNullException ex) {
1473                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
1474                                 Assert.IsNull (ex.InnerException, "#3");
1475                                 Assert.IsNotNull (ex.Message, "#4");
1476                                 Assert.IsNotNull (ex.ParamName, "#5");
1477                                 Assert.AreEqual ("name", ex.ParamName, "#6");
1478                         }
1479                 }
1480
1481                 [Test] // GetProperty (String, Type [])
1482                 public void GetProperty4_Name_Null ()
1483                 {
1484                         Type type = typeof (Bar);
1485                         try {
1486                                 type.GetProperty ((string) null, Type.EmptyTypes);
1487                                 Assert.Fail ("#1");
1488                         } catch (ArgumentNullException ex) {
1489                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
1490                                 Assert.IsNull (ex.InnerException, "#3");
1491                                 Assert.IsNotNull (ex.Message, "#4");
1492                                 Assert.IsNotNull (ex.ParamName, "#5");
1493                                 Assert.AreEqual ("name", ex.ParamName, "#6");
1494                         }
1495                 }
1496
1497                 [Test] // GetProperty (String, Type, Type [])
1498                 public void GetProperty5_Name_Null ()
1499                 {
1500                         Type type = typeof (Bar);
1501                         try {
1502                                 type.GetProperty ((string) null, typeof (int),
1503                                         Type.EmptyTypes);
1504                                 Assert.Fail ("#1");
1505                         } catch (ArgumentNullException ex) {
1506                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
1507                                 Assert.IsNull (ex.InnerException, "#3");
1508                                 Assert.IsNotNull (ex.Message, "#4");
1509                                 Assert.IsNotNull (ex.ParamName, "#5");
1510                                 Assert.AreEqual ("name", ex.ParamName, "#6");
1511                         }
1512                 }
1513
1514                 [Test] // GetProperty (String, Type, Type [], ParameterModifier [])
1515                 public void GetProperty6_Name_Null ()
1516                 {
1517                         Type type = typeof (Bar);
1518                         try {
1519                                 type.GetProperty ((string) null, typeof (int),
1520                                         Type.EmptyTypes, null);
1521                                 Assert.Fail ("#1");
1522                         } catch (ArgumentNullException ex) {
1523                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
1524                                 Assert.IsNull (ex.InnerException, "#3");
1525                                 Assert.IsNotNull (ex.Message, "#4");
1526                                 Assert.IsNotNull (ex.ParamName, "#5");
1527                                 Assert.AreEqual ("name", ex.ParamName, "#6");
1528                         }
1529                 }
1530
1531                 [Test] // GetProperty (String, BindingFlags, Binder, Type, Type [], ParameterModifier [])
1532                 public void GetProperty7_Name_Null ()
1533                 {
1534                         Type type = typeof (Bar);
1535                         try {
1536                                 type.GetProperty ((string) null, BindingFlags.Public,
1537                                         null, typeof (int), Type.EmptyTypes, null);
1538                                 Assert.Fail ("#1");
1539                         } catch (ArgumentNullException ex) {
1540                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
1541                                 Assert.IsNull (ex.InnerException, "#3");
1542                                 Assert.IsNotNull (ex.Message, "#4");
1543                                 Assert.IsNotNull (ex.ParamName, "#5");
1544                                 Assert.AreEqual ("name", ex.ParamName, "#6");
1545                         }
1546                 }
1547
1548                 [Test]
1549                 public void GetProperty8_PropertyType ()
1550                 {
1551                         Type type = typeof (Bar);
1552                         Assert.IsNull (type.GetProperty ("PubInst", BindingFlags.Public | BindingFlags.Instance,
1553                                                          null, typeof (int), Type.EmptyTypes, null), "#1");
1554                         Assert.IsNotNull (type.GetProperty ("PubInst", BindingFlags.Public | BindingFlags.Instance, null, 
1555                                                             typeof (long), new Type[0], null), "#2");
1556                 }
1557
1558 #if !TARGET_JVM // StructLayout not supported for TARGET_JVM
1559                 [StructLayout(LayoutKind.Explicit, Pack = 4, Size = 64)]
1560                 public class Class1
1561                 {
1562                 }
1563
1564                 [StructLayout(LayoutKind.Explicit, CharSet=CharSet.Unicode)]
1565                 public class Class2
1566                 {
1567                 }
1568
1569 #if NET_2_0
1570                 [Test]
1571                 public void StructLayoutAttribute ()
1572                 {
1573                         StructLayoutAttribute attr1 = typeof (TypeTest).StructLayoutAttribute;
1574                         Assert.AreEqual (LayoutKind.Auto, attr1.Value);
1575
1576                         StructLayoutAttribute attr2 = typeof (Class1).StructLayoutAttribute;
1577                         Assert.AreEqual (LayoutKind.Explicit, attr2.Value);
1578                         Assert.AreEqual (4, attr2.Pack);
1579                         Assert.AreEqual (64, attr2.Size);
1580
1581                         StructLayoutAttribute attr3 = typeof (Class2).StructLayoutAttribute;
1582                         Assert.AreEqual (LayoutKind.Explicit, attr3.Value);
1583                         Assert.AreEqual (CharSet.Unicode, attr3.CharSet);
1584                 }
1585 #endif
1586 #endif // TARGET_JVM
1587
1588                 [Test]
1589                 public void Namespace ()
1590                 {
1591                         Assert.AreEqual (null, typeof (NoNamespaceClass).Namespace);
1592                 }
1593
1594                 public static void Reflected (ref int a)
1595                 {
1596                 }
1597
1598                 [Test]
1599                 public void Name ()
1600                 {
1601                         Assert.AreEqual ("Int32&", typeof (TypeTest).GetMethod ("Reflected").GetParameters () [0].ParameterType.Name);
1602                         Assert.AreEqual ("String[*]", Array.CreateInstance (typeof(string), new int[] { 1 }, new int[] { 1 }).GetType ().Name);
1603                 }
1604
1605                 [Test]
1606                 public void GetInterfaces ()
1607                 {
1608                         Type[] t = typeof (Duper).GetInterfaces ();
1609                         Assert.AreEqual (1, t.Length);
1610                         Assert.AreEqual (typeof (ICloneable), t[0]);
1611
1612                         Type[] t2 = typeof (IFace3).GetInterfaces ();
1613                         Assert.AreEqual (2, t2.Length);
1614                 }
1615
1616                 public int AField;
1617
1618                 [Test]
1619                 public void GetFieldIgnoreCase ()
1620                 {
1621                         Assert.IsNotNull (typeof (TypeTest).GetField ("afield", BindingFlags.Instance|BindingFlags.Public|BindingFlags.IgnoreCase));
1622                 }
1623
1624 #if NET_2_0
1625                 public int Count {
1626                         internal get {
1627                                 return 0;
1628                         }
1629
1630                         set {
1631                         }
1632                 }
1633
1634                 [Test]
1635                 public void GetPropertyAccessorModifiers ()
1636                 {
1637                         Assert.IsNotNull (typeof (TypeTest).GetProperty ("Count", BindingFlags.Instance | BindingFlags.Public));
1638                         Assert.IsNull (typeof (TypeTest).GetProperty ("Count", BindingFlags.Instance | BindingFlags.NonPublic));
1639                 }
1640 #endif
1641
1642                 [Test]
1643                 public void IsAbstract ()
1644                 {
1645                         Assert.IsFalse (typeof (string).IsAbstract, "#1");
1646                         Assert.IsTrue (typeof (ICloneable).IsAbstract, "#2");
1647                         Assert.IsTrue (typeof (ValueType).IsAbstract, "#3");
1648                         Assert.IsTrue (typeof (Enum).IsAbstract, "#4");
1649                         Assert.IsFalse (typeof (TimeSpan).IsAbstract, "#5");
1650                         Assert.IsTrue (typeof (TextReader).IsAbstract, "#6");
1651
1652 #if NET_2_0
1653                         // LAMESPEC:
1654                         // https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=286308
1655                         Type [] typeArgs = typeof (List<>).GetGenericArguments ();
1656                         Assert.IsFalse (typeArgs [0].IsAbstract, "#7");
1657 #endif
1658                 }
1659
1660                 [Test]
1661                 public void IsCOMObject ()
1662                 {
1663                         Type type = typeof (string);
1664                         Assert.IsFalse (type.IsCOMObject, "#1");
1665
1666                         TypeBuilder tb = module.DefineType (genTypeName ());
1667                         type = tb.CreateType ();
1668                         Assert.IsFalse (type.IsCOMObject, "#2");
1669                 }
1670
1671                 [Test]
1672                 public void IsImport ()
1673                 {
1674                         Type type = typeof (string);
1675                         Assert.IsFalse (type.IsImport, "#1");
1676
1677                         TypeBuilder tb = module.DefineType (genTypeName ());
1678                         type = tb.CreateType ();
1679                         Assert.IsFalse (type.IsImport, "#2");
1680
1681                         tb = module.DefineType (genTypeName (), TypeAttributes.Import |
1682                                 TypeAttributes.Interface | TypeAttributes.Abstract);
1683                         type = tb.CreateType ();
1684                         Assert.IsTrue (type.IsImport, "#3");
1685                 }
1686
1687                 [Test]
1688                 public void IsInterface ()
1689                 {
1690                         Assert.IsFalse (typeof (string).IsInterface, "#1");
1691                         Assert.IsTrue (typeof (ICloneable).IsInterface, "#2");
1692                 }
1693
1694                 [Test]
1695                 public void IsPrimitive () {
1696                         Assert.IsTrue (typeof (IntPtr).IsPrimitive, "#1");
1697                         Assert.IsTrue (typeof (int).IsPrimitive, "#2");
1698                         Assert.IsFalse (typeof (string).IsPrimitive, "#2");
1699                 }
1700
1701                 [Test]
1702                 public void IsValueType ()
1703                 {
1704                         Assert.IsTrue (typeof (int).IsValueType, "#1");
1705                         Assert.IsFalse (typeof (Enum).IsValueType, "#2");
1706                         Assert.IsFalse (typeof (ValueType).IsValueType, "#3");
1707                         Assert.IsTrue (typeof (AttributeTargets).IsValueType, "#4");
1708                         Assert.IsFalse (typeof (string).IsValueType, "#5");
1709                         Assert.IsTrue (typeof (TimeSpan).IsValueType, "#6");
1710                 }
1711
1712                 [Test]
1713                 [Category("NotDotNet")]
1714                 // Depends on the GAC working, which it doesn't durring make distcheck.
1715                 [Category ("NotWorking")]
1716                 public void GetTypeWithWhitespace ()
1717                 {
1718                         Assert.IsNotNull (Type.GetType
1719                                                    (@"System.Configuration.NameValueSectionHandler,
1720                         System,
1721 Version=1.0.5000.0,
1722 Culture=neutral
1723 ,
1724 PublicKeyToken=b77a5c561934e089"));
1725                 }
1726
1727                 [Test]
1728                 public void GetTypeNonVectorArray ()
1729                 {
1730                         Type t = Type.GetType ("System.String[*]");
1731                         Assert.AreEqual ("System.String[*]", t.ToString ());
1732                 }
1733                 
1734                 [Test]
1735                 public void ExerciseFilterName ()
1736                 {
1737                         MemberInfo[] mi = typeof(Base).FindMembers(
1738                                 MemberTypes.Method, 
1739                                 BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic |
1740                                 BindingFlags.Instance | BindingFlags.DeclaredOnly,
1741                                 Type.FilterName, "*");
1742                         Assert.AreEqual (4, mi.Length);
1743                         mi = typeof(Base).FindMembers(
1744                                 MemberTypes.Method, 
1745                                 BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic |
1746                                 BindingFlags.Instance | BindingFlags.DeclaredOnly,
1747                                 Type.FilterName, "Test*");
1748                         Assert.AreEqual (2, mi.Length);
1749                         mi = typeof(Base).FindMembers(
1750                                 MemberTypes.Method, 
1751                                 BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic |
1752                                 BindingFlags.Instance | BindingFlags.DeclaredOnly,
1753                                 Type.FilterName, "TestVoid");
1754                         Assert.AreEqual (1, mi.Length);
1755                         mi = typeof(Base).FindMembers(
1756                                 MemberTypes.Method, 
1757                                 BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic |
1758                                 BindingFlags.Instance | BindingFlags.DeclaredOnly,
1759                                 Type.FilterName, "NonExistingMethod");
1760                         Assert.AreEqual (0, mi.Length);
1761                 }
1762                 
1763                 [Test]
1764                 public void ExerciseFilterNameIgnoreCase ()
1765                 {
1766                         MemberInfo[] mi = typeof(Base).FindMembers(
1767                                 MemberTypes.Method, 
1768                                 BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic |
1769                                 BindingFlags.Instance | BindingFlags.DeclaredOnly,
1770                                 Type.FilterNameIgnoreCase, "*");
1771                         Assert.AreEqual (4, mi.Length);
1772                         mi = typeof(Base).FindMembers(
1773                                 MemberTypes.Method, 
1774                                 BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic |
1775                                 BindingFlags.Instance | BindingFlags.DeclaredOnly,
1776                                 Type.FilterNameIgnoreCase, "test*");
1777                         Assert.AreEqual (2, mi.Length);
1778                         mi = typeof(Base).FindMembers(
1779                                 MemberTypes.Method, 
1780                                 BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic |
1781                                 BindingFlags.Instance | BindingFlags.DeclaredOnly,
1782                                 Type.FilterNameIgnoreCase, "TESTVOID");
1783                         Assert.AreEqual (1, mi.Length);
1784                         mi = typeof(Base).FindMembers(
1785                                 MemberTypes.Method, 
1786                                 BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic |
1787                                 BindingFlags.Instance | BindingFlags.DeclaredOnly,
1788                                 Type.FilterNameIgnoreCase, "NonExistingMethod");
1789                         Assert.AreEqual (0, mi.Length);
1790                 }
1791
1792                 public class ByRef0
1793                 {
1794                         public int field;
1795                         public int property {
1796                                 get { return 0; }
1797                         }
1798                         public ByRef0 (int i) {}
1799                         public void f (int i) {}
1800                 }
1801
1802                 [Test]
1803                 public void ByrefTypes ()
1804                 {
1805                         Type t = Type.GetType ("MonoTests.System.TypeTest+ByRef0&");
1806                         Assert.IsNotNull (t);
1807                         Assert.IsTrue (t.IsByRef);
1808                         Assert.AreEqual (0, t.GetMethods (BindingFlags.Public | BindingFlags.Instance).Length);
1809                         Assert.AreEqual (0, t.GetConstructors (BindingFlags.Public | BindingFlags.Instance).Length);
1810                         Assert.AreEqual (0, t.GetEvents (BindingFlags.Public | BindingFlags.Instance).Length);
1811                         Assert.AreEqual (0, t.GetProperties (BindingFlags.Public | BindingFlags.Instance).Length);
1812
1813                         Assert.IsNull (t.GetMethod ("f"));
1814                         Assert.IsNull (t.GetField ("field"));
1815                         Assert.IsNull (t.GetProperty ("property"));
1816                 }
1817                 
1818                 [Test]
1819                 public void TestAssemblyQualifiedName ()
1820                 {
1821                         Type t = Type.GetType ("System.Byte[]&");
1822                         Assert.IsTrue (t.AssemblyQualifiedName.StartsWith ("System.Byte[]&"));
1823                         
1824                         t = Type.GetType ("System.Byte*&");
1825                         Assert.IsTrue (t.AssemblyQualifiedName.StartsWith ("System.Byte*&"));
1826                         
1827                         t = Type.GetType ("System.Byte&");
1828                         Assert.IsTrue (t.AssemblyQualifiedName.StartsWith ("System.Byte&"));
1829                 }
1830
1831                 struct B
1832                 {
1833                         int value;
1834                 }
1835
1836                 [Test]
1837                 public void CreateValueTypeNoCtor ()
1838                 {
1839                         typeof(B).InvokeMember ("", BindingFlags.CreateInstance, null, null, null);
1840                 }
1841
1842                 [Test]
1843                 [ExpectedException (typeof (MissingMethodException))]
1844                 public void CreateValueTypeNoCtorArgs ()
1845                 {
1846                         typeof(B).InvokeMember ("", BindingFlags.CreateInstance, null, null, new object [] { 1 });
1847                 }
1848
1849                 internal static string bug336841 (string param1, params string [] param2)
1850                 {
1851                         StringBuilder sb = new StringBuilder ();
1852                         sb.Append ("#A:");
1853                         sb.Append (param1);
1854                         sb.Append ("|");
1855                         for (int i = 0; i < param2.Length; i++) {
1856                                 if (i > 0)
1857                                         sb.Append (",");
1858                                 sb.Append (param2 [i]);
1859                         }
1860                         return sb.ToString ();
1861                 }
1862
1863                 internal static string bug336841 (string param1)
1864                 {
1865                         return "#B:" + param1;
1866                 }
1867
1868                 internal static string bug336841 (params string [] param1)
1869                 {
1870                         StringBuilder sb = new StringBuilder ();
1871                         sb.Append ("#C:");
1872                         for (int i = 0; i < param1.Length; i++) {
1873                                 if (i > 0)
1874                                         sb.Append (";");
1875                                 sb.Append (param1 [i]);
1876                         }
1877                         return sb.ToString ();
1878                 }
1879
1880                 [Test]
1881                 public void InvokeMember_GetSetField ()
1882                 {
1883                         typeof (X).InvokeMember ("Value", BindingFlags.Public |
1884                                 BindingFlags.Static | BindingFlags.FlattenHierarchy |
1885                                 BindingFlags.SetField, null, null, new object [] { 5 });
1886
1887                         Assert.AreEqual (5, X.Value, "#A1");
1888                         Assert.AreEqual (5, typeof (X).InvokeMember ("Value",
1889                                 BindingFlags.Public | BindingFlags.Static |
1890                                 BindingFlags.FlattenHierarchy | BindingFlags.GetField,
1891                                 null, null, new object [0]), "#A2");
1892                         Assert.AreEqual (5, Y.Value, "#A3");
1893                         Assert.AreEqual (5, typeof (Y).InvokeMember ("Value",
1894                                 BindingFlags.Public | BindingFlags.Static |
1895                                 BindingFlags.FlattenHierarchy | BindingFlags.GetField,
1896                                 null, null, new object [0]), "#A4");
1897
1898                         try {
1899                                 typeof (X).InvokeMember ("Value", BindingFlags.Public |
1900                                         BindingFlags.Static | BindingFlags.FlattenHierarchy |
1901                                         BindingFlags.GetField | BindingFlags.SetField,
1902                                         null, null, new object [] { 5 });
1903                                 Assert.Fail ("#B1");
1904                         } catch (ArgumentException ex) {
1905                                 // Cannot specify both Get and Set on a field
1906                                 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#B2");
1907                                 Assert.IsNull (ex.InnerException, "#B3");
1908                                 Assert.IsNotNull (ex.Message, "#B4");
1909                                 Assert.IsNotNull (ex.ParamName, "#B5");
1910 #if NET_2_0
1911                                 Assert.AreEqual ("bindingFlags", ex.ParamName, "#B6");
1912 #else
1913                                 Assert.AreEqual ("invokeAttr", ex.ParamName, "#B6");
1914 #endif
1915                         }
1916                 }
1917
1918                 [Test]
1919                 public void InvokeMember_GetSetProperty ()
1920                 {
1921                         try {
1922                                 typeof (ArrayList).InvokeMember ("Item",
1923                                         BindingFlags.GetProperty | BindingFlags.SetProperty |
1924                                         BindingFlags.Instance | BindingFlags.Public,
1925                                         null, new ArrayList (), new object [] { 0, "bar" });
1926                                 Assert.Fail ("#1");
1927                         } catch (ArgumentException ex) {
1928                                 // Cannot specify both Get and Set on a property
1929                                 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
1930                                 Assert.IsNull (ex.InnerException, "#3");
1931                                 Assert.IsNotNull (ex.Message, "#4");
1932                                 Assert.IsNotNull (ex.ParamName, "#5");
1933 #if NET_2_0
1934                                 Assert.AreEqual ("bindingFlags", ex.ParamName, "#6");
1935 #else
1936                                 Assert.AreEqual ("invokeAttr", ex.ParamName, "#6");
1937 #endif
1938                         }
1939                 }
1940
1941
1942                 [Test]
1943                 public void InvokeMember_InvokeMethod_Set ()
1944                 {
1945                         try {
1946                                 typeof (ArrayList).InvokeMember ("ToString",
1947                                         BindingFlags.InvokeMethod | BindingFlags.SetField |
1948                                         BindingFlags.Instance | BindingFlags.Public,
1949                                         null, new ArrayList (), new object [0]);
1950                                 Assert.Fail ("#A1");
1951                         } catch (ArgumentException ex) {
1952                                 // Cannot specify Set on a field and Invoke on a method
1953                                 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#A2");
1954                                 Assert.IsNull (ex.InnerException, "#A3");
1955                                 Assert.IsNotNull (ex.Message, "#A4");
1956                                 Assert.IsNotNull (ex.ParamName, "#A5");
1957 #if NET_2_0
1958                                 Assert.AreEqual ("bindingFlags", ex.ParamName, "#A6");
1959 #else
1960                                 Assert.AreEqual ("invokeAttr", ex.ParamName, "#A6");
1961 #endif
1962                         }
1963
1964                         try {
1965                                 typeof (ArrayList).InvokeMember ("ToString",
1966                                         BindingFlags.InvokeMethod | BindingFlags.SetProperty |
1967                                         BindingFlags.Instance | BindingFlags.Public,
1968                                         null, new ArrayList (), new object [0]);
1969                                 Assert.Fail ("#B1");
1970                         } catch (ArgumentException ex) {
1971                                 // Cannot specify Set on a property and Invoke on a method
1972                                 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#B2");
1973                                 Assert.IsNull (ex.InnerException, "#B3");
1974                                 Assert.IsNotNull (ex.Message, "#B4");
1975                                 Assert.IsNotNull (ex.ParamName, "#B5");
1976 #if NET_2_0
1977                                 Assert.AreEqual ("bindingFlags", ex.ParamName, "#B6");
1978 #else
1979                                 Assert.AreEqual ("invokeAttr", ex.ParamName, "#B6");
1980 #endif
1981                         }
1982                 }
1983
1984                 [Test]
1985                 public void InvokeMember_MatchPrimitiveTypeWithInterface ()
1986                 {
1987                         object [] invokeargs = { 1 };
1988                         typeof (Z).InvokeMember ("", BindingFlags.DeclaredOnly |
1989                                 BindingFlags.Public | BindingFlags.NonPublic |
1990                                 BindingFlags.Instance | BindingFlags.CreateInstance,
1991                                 null, null, invokeargs);
1992                 }
1993
1994                 [Test]
1995                 public void InvokeMember_Name_Null ()
1996                 {
1997                         try {
1998                                 typeof (X).InvokeMember ((string) null,
1999                                         BindingFlags.Public | BindingFlags.Static |
2000                                         BindingFlags.FlattenHierarchy | BindingFlags.SetField,
2001                                         null, null, new object [] { 5 });
2002                                 Assert.Fail ("#1");
2003                         } catch (ArgumentNullException ex) {
2004                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2005                                 Assert.IsNull (ex.InnerException, "#3");
2006                                 Assert.IsNotNull (ex.Message, "#4");
2007                                 Assert.IsNotNull (ex.ParamName, "#5");
2008                                 Assert.AreEqual ("name", ex.ParamName, "#6");
2009                         }
2010                 }
2011
2012                 [Test]
2013                 public void InvokeMember_NoOperation ()
2014                 {
2015                         try {
2016                                 typeof (TypeTest).InvokeMember ("Run", BindingFlags.Public |
2017                                         BindingFlags.Static, null, null, new object [0]);
2018                                 Assert.Fail ("#1");
2019                         } catch (ArgumentException ex) {
2020                                 // Must specify binding flags describing the
2021                                 // invoke operation required
2022                                 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
2023                                 Assert.IsNull (ex.InnerException, "#3");
2024                                 Assert.IsNotNull (ex.Message, "#4");
2025                                 Assert.IsNotNull (ex.ParamName, "#5");
2026 #if NET_2_0
2027                                 Assert.AreEqual ("bindingFlags", ex.ParamName, "#6");
2028 #else
2029                                 Assert.AreEqual ("invokeAttr", ex.ParamName, "#6");
2030 #endif
2031                         }
2032                 }
2033
2034                 [Test] // bug #321735
2035                 public void InvokeMember_SetFieldProperty ()
2036                 {
2037                         ArrayList list = new ArrayList ();
2038                         list.Add ("foo");
2039                         list.GetType ().InvokeMember ("Item",
2040                                 BindingFlags.SetField | BindingFlags.SetProperty |
2041                                 BindingFlags.Instance | BindingFlags.Public,
2042                                 null, list, new object [] { 0, "bar" });
2043                         Assert.AreEqual ("bar", list [0]);
2044                 }
2045
2046                 [Test]
2047                 public void InvokeMember_SetField_ProvidedArgs ()
2048                 {
2049                         try {
2050                                 typeof (X).InvokeMember ("Value", BindingFlags.Public |
2051                                         BindingFlags.Static | BindingFlags.SetField,
2052                                         null, null, new object [0]);
2053                                 Assert.Fail ("#A1");
2054                         } catch (ArgumentException ex) {
2055                                 // Only the field value can be specified to set
2056                                 // a field value
2057                                 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#A2");
2058                                 Assert.IsNull (ex.InnerException, "#A3");
2059                                 Assert.IsNotNull (ex.Message, "#A4");
2060                                 Assert.IsNotNull (ex.ParamName, "#A5");
2061 #if NET_2_0
2062                                 Assert.AreEqual ("bindingFlags", ex.ParamName, "#6");
2063 #else
2064                                 Assert.AreEqual ("invokeAttr", ex.ParamName, "#6");
2065 #endif
2066                         }
2067
2068                         try {
2069                                 typeof (X).InvokeMember ("Value", BindingFlags.Public |
2070                                         BindingFlags.Static | BindingFlags.SetField,
2071                                         null, null, null);
2072                                 Assert.Fail ("#B1");
2073 #if NET_2_0
2074                         } catch (ArgumentNullException ex) {
2075                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#B2");
2076                                 Assert.IsNull (ex.InnerException, "#B3");
2077                                 Assert.IsNotNull (ex.Message, "#B4");
2078                                 Assert.IsNotNull (ex.ParamName, "#B5");
2079                                 Assert.AreEqual ("providedArgs", ex.ParamName, "#B6");
2080                         }
2081 #else
2082                         } catch (ArgumentException ex) {
2083                                 // Only the field value can be specified to set
2084                                 // a field value
2085                                 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#B2");
2086                                 Assert.IsNull (ex.InnerException, "#B3");
2087                                 Assert.IsNotNull (ex.Message, "#B4");
2088                                 Assert.IsNotNull (ex.ParamName, "#B5");
2089 #if NET_2_0
2090                                 Assert.AreEqual ("bindingFlags", ex.ParamName, "#B6");
2091 #else
2092                                 Assert.AreEqual ("invokeAttr", ex.ParamName, "#B6");
2093 #endif
2094                         }
2095 #endif
2096                 }
2097
2098                 [Test] // bug #336841
2099                 [Category ("NotDotNet")] // https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=306797
2100                 public void InvokeMember_VarArgs ()
2101                 {
2102                         BindingFlags flags = BindingFlags.InvokeMethod | BindingFlags.Public |
2103                                 BindingFlags.NonPublic | BindingFlags.OptionalParamBinding |
2104                                 BindingFlags.Static | BindingFlags.FlattenHierarchy |
2105                                 BindingFlags.Instance;
2106
2107                         Type type = typeof (TypeTest);
2108                         string result = (string) type.InvokeMember ("bug336841",
2109                                 flags, null, null, new object [] { "1" });
2110                         Assert.IsNotNull (result, "#A1");
2111                         Assert.AreEqual ("#B:1", result, "#A2");
2112
2113                         result = (string) type.InvokeMember ("bug336841", flags,
2114                                 null, null, new object [] { "1", "2", "3", "4" });
2115                         Assert.IsNotNull (result, "#B1");
2116                         Assert.AreEqual ("#A:1|2,3,4", result, "#B2");
2117                 }
2118
2119         
2120                 [Test] // bug #348522
2121                 public void InvokeMember_WithoutDefaultValue ()
2122                 {
2123                         BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod;;
2124                         try {
2125                                 typeof (Bug348522).InvokeMember ("Test", flags, new FirstMethodBinder (), new Bug348522(),
2126                                         new object [] {Missing.Value}, null, null, null);
2127                                 Assert.Fail ("#1");
2128                         } catch (ArgumentException ex) {
2129                                 // Missing parameter does not have a default value
2130                                 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
2131                                 Assert.IsNull (ex.InnerException, "#3");
2132                                 Assert.IsNotNull (ex.Message, "#4");
2133                                 Assert.IsNotNull (ex.ParamName, "#5");
2134                                 Assert.AreEqual ("parameters", ex.ParamName, "#6");
2135                         }
2136                 }
2137
2138                 class X
2139                 {
2140                         public static int Value;
2141                 }
2142
2143                 class Y : X
2144                 {
2145                 }
2146
2147                 class Z
2148                 {
2149                         public Z (IComparable value)
2150                         {
2151                         }
2152                 }
2153         
2154                 public static void Run ()
2155                 {
2156                 }
2157
2158                 class TakesInt
2159                 {
2160                         private int i;
2161
2162                         public TakesInt (int x)
2163                         {
2164                                 i = x;
2165                         }
2166
2167                         public int Integer {
2168                                 get { return i; }
2169                         }
2170                 }
2171
2172                 class TakesObject
2173                 {
2174                         public TakesObject (object x) {}
2175                 }
2176
2177                 [Test] // bug #75241
2178                 public void GetConstructorNullInTypes ()
2179                 {
2180                         // This ends up calling type.GetConstructor ()
2181                         Activator.CreateInstance (typeof (TakesInt), new object [] { null });
2182                         Activator.CreateInstance (typeof (TakesObject), new object [] { null });
2183                 }
2184
2185                 [Test]
2186                 public void GetConstructor_TakeInt_Object ()
2187                 {
2188                         Assert.IsNull (typeof (TakesInt).GetConstructor (new Type[1] { typeof (object) }));
2189                 }
2190
2191                 [Test]
2192                 public void GetCustomAttributes_All ()
2193                 {
2194                         object [] attrs = typeof (A).GetCustomAttributes (false);
2195                         Assert.AreEqual (2, attrs.Length, "#A1");
2196                         Assert.IsTrue (HasAttribute (attrs, typeof (FooAttribute)), "#A2");
2197                         Assert.IsTrue (HasAttribute (attrs, typeof (VolatileModifier)), "#A3");
2198
2199                         attrs = typeof (BA).GetCustomAttributes (false);
2200                         Assert.AreEqual (1, attrs.Length, "#B1");
2201                         Assert.AreEqual (typeof (BarAttribute), attrs [0].GetType (), "#B2");
2202
2203                         attrs = typeof (BA).GetCustomAttributes (true);
2204                         Assert.AreEqual (2, attrs.Length, "#C1");
2205                         Assert.IsTrue (HasAttribute (attrs, typeof (BarAttribute)), "#C2");
2206                         Assert.IsTrue (HasAttribute (attrs, typeof (VolatileModifier)), "#C3");
2207
2208                         attrs = typeof (CA).GetCustomAttributes (false);
2209                         Assert.AreEqual (0, attrs.Length, "#D");
2210
2211                         attrs = typeof (CA).GetCustomAttributes (true);
2212                         Assert.AreEqual (1, attrs.Length, "#E1");
2213                         Assert.AreEqual (typeof (VolatileModifier), attrs [0].GetType (), "#E2");
2214                 }
2215
2216                 static bool HasAttribute (object [] attrs, Type attributeType)
2217                 {
2218                         foreach (object attr in attrs)
2219                                 if (attr.GetType () == attributeType)
2220                                         return true;
2221                         return false;
2222                 }
2223
2224                 [Test]
2225                 public void GetCustomAttributes_Type ()
2226                 {
2227                         object [] attrs = null;
2228
2229                         attrs = typeof (A).GetCustomAttributes (
2230                                 typeof (VolatileModifier), false);
2231                         Assert.AreEqual (1, attrs.Length, "#A1");
2232                         Assert.AreEqual (typeof (VolatileModifier), attrs [0].GetType (), "#A2");
2233                         attrs = typeof (A).GetCustomAttributes (
2234                                 typeof (VolatileModifier), true);
2235                         Assert.AreEqual (1, attrs.Length, "#A3");
2236                         Assert.AreEqual (typeof (VolatileModifier), attrs [0].GetType (), "#A4");
2237
2238                         attrs = typeof (A).GetCustomAttributes (
2239                                 typeof (NemerleAttribute), false);
2240                         Assert.AreEqual (1, attrs.Length, "#B1");
2241                         Assert.AreEqual (typeof (VolatileModifier), attrs [0].GetType (), "#B2");
2242                         attrs = typeof (A).GetCustomAttributes (
2243                                 typeof (NemerleAttribute), true);
2244                         Assert.AreEqual (1, attrs.Length, "#B3");
2245                         Assert.AreEqual (typeof (VolatileModifier), attrs [0].GetType (), "#B4");
2246
2247                         attrs = typeof (A).GetCustomAttributes (
2248                                 typeof (FooAttribute), false);
2249                         Assert.AreEqual (1, attrs.Length, "#C1");
2250                         Assert.AreEqual (typeof (FooAttribute), attrs [0].GetType (), "#C2");
2251                         attrs = typeof (A).GetCustomAttributes (
2252                                 typeof (FooAttribute), false);
2253                         Assert.AreEqual (1, attrs.Length, "#C3");
2254                         Assert.AreEqual (typeof (FooAttribute), attrs [0].GetType (), "#C4");
2255
2256                         attrs = typeof (BA).GetCustomAttributes (
2257                                 typeof (VolatileModifier), false);
2258                         Assert.AreEqual (0, attrs.Length, "#D1");
2259                         attrs = typeof (BA).GetCustomAttributes (
2260                                 typeof (VolatileModifier), true);
2261                         Assert.AreEqual (1, attrs.Length, "#D2");
2262                         Assert.AreEqual (typeof (VolatileModifier), attrs [0].GetType (), "#D3");
2263
2264                         attrs = typeof (BA).GetCustomAttributes (
2265                                 typeof (NemerleAttribute), false);
2266                         Assert.AreEqual (0, attrs.Length, "#E1");
2267                         attrs = typeof (BA).GetCustomAttributes (
2268                                 typeof (NemerleAttribute), true);
2269                         Assert.AreEqual (1, attrs.Length, "#E2");
2270                         Assert.AreEqual (typeof (VolatileModifier), attrs [0].GetType (), "#E3");
2271
2272                         attrs = typeof (BA).GetCustomAttributes (
2273                                 typeof (FooAttribute), false);
2274                         Assert.AreEqual (1, attrs.Length, "#F1");
2275                         Assert.AreEqual (typeof (BarAttribute), attrs [0].GetType (), "#F2");
2276                         attrs = typeof (BA).GetCustomAttributes (
2277                                 typeof (FooAttribute), true);
2278                         Assert.AreEqual (1, attrs.Length, "#F3");
2279                         Assert.AreEqual (typeof (BarAttribute), attrs [0].GetType (), "#F4");
2280
2281                         attrs = typeof (bug82431A1).GetCustomAttributes (
2282                                 typeof (InheritAttribute), false);
2283                         Assert.AreEqual (1, attrs.Length, "#G1");
2284                         Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#G2");
2285                         attrs = typeof (bug82431A1).GetCustomAttributes (
2286                                 typeof (InheritAttribute), true);
2287                         Assert.AreEqual (1, attrs.Length, "#G3");
2288                         Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#G4");
2289
2290                         attrs = typeof (bug82431A1).GetCustomAttributes (
2291                                 typeof (NotInheritAttribute), false);
2292                         Assert.AreEqual (1, attrs.Length, "#H1");
2293                         Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#H2");
2294                         attrs = typeof (bug82431A1).GetCustomAttributes (
2295                                 typeof (InheritAttribute), true);
2296                         Assert.AreEqual (1, attrs.Length, "#H3");
2297                         Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#H4");
2298
2299                         attrs = typeof (bug82431A2).GetCustomAttributes (
2300                                 typeof (InheritAttribute), false);
2301                         Assert.AreEqual (0, attrs.Length, "#I1");
2302                         attrs = typeof (bug82431A2).GetCustomAttributes (
2303                                 typeof (InheritAttribute), true);
2304                         Assert.AreEqual (0, attrs.Length, "#I2");
2305
2306                         attrs = typeof (bug82431A2).GetCustomAttributes (
2307                                 typeof (NotInheritAttribute), false);
2308                         Assert.AreEqual (0, attrs.Length, "#J1");
2309                         attrs = typeof (bug82431A2).GetCustomAttributes (
2310                                 typeof (NotInheritAttribute), true);
2311                         Assert.AreEqual (0, attrs.Length, "#J2");
2312
2313                         attrs = typeof (bug82431A3).GetCustomAttributes (
2314                                 typeof (InheritAttribute), false);
2315                         Assert.AreEqual (2, attrs.Length, "#K1");
2316                         Assert.IsTrue (HasAttribute (attrs, typeof (InheritAttribute)), "#K2");
2317                         Assert.IsTrue (HasAttribute (attrs, typeof (NotInheritAttribute)), "#K3");
2318                         attrs = typeof (bug82431A3).GetCustomAttributes (
2319                                 typeof (InheritAttribute), true);
2320                         Assert.AreEqual (2, attrs.Length, "#K4");
2321                         Assert.IsTrue (HasAttribute (attrs, typeof (InheritAttribute)), "#K5");
2322                         Assert.IsTrue (HasAttribute (attrs, typeof (NotInheritAttribute)), "#K6");
2323
2324                         attrs = typeof (bug82431A3).GetCustomAttributes (
2325                                 typeof (NotInheritAttribute), false);
2326                         Assert.AreEqual (1, attrs.Length, "#L1");
2327                         Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#L2");
2328                         attrs = typeof (bug82431A3).GetCustomAttributes (
2329                                 typeof (NotInheritAttribute), true);
2330                         Assert.AreEqual (1, attrs.Length, "#L3");
2331                         Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#L4");
2332
2333                         attrs = typeof (bug82431B1).GetCustomAttributes (
2334                                 typeof (InheritAttribute), false);
2335                         Assert.AreEqual (1, attrs.Length, "#M1");
2336                         Assert.AreEqual (typeof (InheritAttribute), attrs [0].GetType (), "#M2");
2337                         attrs = typeof (bug82431B1).GetCustomAttributes (
2338                                 typeof (InheritAttribute), true);
2339                         Assert.AreEqual (1, attrs.Length, "#M3");
2340                         Assert.AreEqual (typeof (InheritAttribute), attrs [0].GetType (), "#M4");
2341
2342                         attrs = typeof (bug82431B1).GetCustomAttributes (
2343                                 typeof (NotInheritAttribute), false);
2344                         Assert.AreEqual (0, attrs.Length, "#N1");
2345                         attrs = typeof (bug82431B1).GetCustomAttributes (
2346                                 typeof (NotInheritAttribute), true);
2347                         Assert.AreEqual (0, attrs.Length, "#N2");
2348
2349                         attrs = typeof (bug82431B2).GetCustomAttributes (
2350                                 typeof (InheritAttribute), false);
2351                         Assert.AreEqual (0, attrs.Length, "#O1");
2352                         attrs = typeof (bug82431B2).GetCustomAttributes (
2353                                 typeof (InheritAttribute), true);
2354                         Assert.AreEqual (1, attrs.Length, "#O2");
2355                         Assert.AreEqual (typeof (InheritAttribute), attrs [0].GetType (), "#O3");
2356
2357                         attrs = typeof (bug82431B2).GetCustomAttributes (
2358                                 typeof (NotInheritAttribute), false);
2359                         Assert.AreEqual (0, attrs.Length, "#P1");
2360                         attrs = typeof (bug82431B2).GetCustomAttributes (
2361                                 typeof (NotInheritAttribute), true);
2362                         Assert.AreEqual (0, attrs.Length, "#P2");
2363
2364                         attrs = typeof (bug82431B3).GetCustomAttributes (
2365                                 typeof (InheritAttribute), false);
2366                         Assert.AreEqual (1, attrs.Length, "#Q1");
2367                         Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#Q2");
2368                         attrs = typeof (bug82431B3).GetCustomAttributes (
2369                                 typeof (InheritAttribute), true);
2370                         Assert.AreEqual (2, attrs.Length, "#Q3");
2371                         Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#Q4");
2372                         Assert.AreEqual (typeof (InheritAttribute), attrs [1].GetType (), "#Q5");
2373
2374                         attrs = typeof (bug82431B3).GetCustomAttributes (
2375                                 typeof (NotInheritAttribute), false);
2376                         Assert.AreEqual (1, attrs.Length, "#R1");
2377                         Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#R2");
2378                         attrs = typeof (bug82431B3).GetCustomAttributes (
2379                                 typeof (NotInheritAttribute), true);
2380                         Assert.AreEqual (1, attrs.Length, "#R3");
2381                         Assert.AreEqual (typeof (NotInheritAttribute), attrs [0].GetType (), "#R4");
2382
2383                         attrs = typeof (bug82431B4).GetCustomAttributes (
2384                                 typeof (InheritAttribute), false);
2385                         Assert.AreEqual (0, attrs.Length, "#S1");
2386                         attrs = typeof (bug82431B4).GetCustomAttributes (
2387                                 typeof (InheritAttribute), true);
2388                         Assert.AreEqual (1, attrs.Length, "#S2");
2389                         Assert.AreEqual (typeof (InheritAttribute), attrs [0].GetType (), "#S3");
2390
2391                         attrs = typeof (bug82431B4).GetCustomAttributes (
2392                                 typeof (NotInheritAttribute), false);
2393                         Assert.AreEqual (0, attrs.Length, "#T1");
2394                         attrs = typeof (bug82431B4).GetCustomAttributes (
2395                                 typeof (NotInheritAttribute), true);
2396                         Assert.AreEqual (0, attrs.Length, "#T2");
2397
2398                         attrs = typeof (A).GetCustomAttributes (
2399                                 typeof (string), false);
2400                         Assert.AreEqual (0, attrs.Length, "#U1");
2401                         attrs = typeof (A).GetCustomAttributes (
2402                                 typeof (string), true);
2403                         Assert.AreEqual (0, attrs.Length, "#U2");
2404                 }
2405
2406                 [Test] // bug #76150
2407                 public void IsDefined ()
2408                 {
2409                         Assert.IsTrue (typeof (A).IsDefined (typeof (NemerleAttribute), false), "#A1");
2410                         Assert.IsTrue (typeof (A).IsDefined (typeof (VolatileModifier), false), "#A2");
2411                         Assert.IsTrue (typeof (A).IsDefined (typeof (FooAttribute), false), "#A3");
2412                         Assert.IsFalse (typeof (A).IsDefined (typeof (BarAttribute), false), "#A4");
2413
2414                         Assert.IsFalse (typeof (BA).IsDefined (typeof (NemerleAttribute), false), "#B1");
2415                         Assert.IsFalse (typeof (BA).IsDefined (typeof (VolatileModifier), false), "#B2");
2416                         Assert.IsTrue (typeof (BA).IsDefined (typeof (FooAttribute), false), "#B3");
2417                         Assert.IsTrue (typeof (BA).IsDefined (typeof (BarAttribute), false), "#B4");
2418                         Assert.IsFalse (typeof (BA).IsDefined (typeof (string), false), "#B5");
2419                         Assert.IsFalse (typeof (BA).IsDefined (typeof (int), false), "#B6");
2420                         Assert.IsTrue (typeof (BA).IsDefined (typeof (NemerleAttribute), true), "#B7");
2421                         Assert.IsTrue (typeof (BA).IsDefined (typeof (VolatileModifier), true), "#B8");
2422                         Assert.IsTrue (typeof (BA).IsDefined (typeof (FooAttribute), true), "#B9");
2423                         Assert.IsTrue (typeof (BA).IsDefined (typeof (BarAttribute), true), "#B10");
2424                         Assert.IsFalse (typeof (BA).IsDefined (typeof (string), true), "#B11");
2425                         Assert.IsFalse (typeof (BA).IsDefined (typeof (int), true), "#B12");
2426                 }
2427
2428                 [Test]
2429                 public void IsDefined_AttributeType_Null ()
2430                 {
2431                         try {
2432                                 typeof (BA).IsDefined ((Type) null, false);
2433                                 Assert.Fail ("#1");
2434                         } catch (ArgumentNullException ex) {
2435                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2436                                 Assert.IsNull (ex.InnerException, "#3");
2437                                 Assert.IsNotNull (ex.Message, "#4");
2438                                 Assert.IsNotNull (ex.ParamName, "#5");
2439                                 Assert.AreEqual ("attributeType", ex.ParamName, "#6");
2440                         }
2441                 }
2442
2443                 [Test] // bug #82431
2444 #if NET_2_0
2445                 [Category ("NotWorking")]
2446 #endif
2447                 public void IsDefined_Inherited ()
2448                 {
2449                         Assert.IsFalse (typeof (CA).IsDefined (typeof (NemerleAttribute), false), "#C1");
2450                         Assert.IsFalse (typeof (CA).IsDefined (typeof (VolatileModifier), false), "#C2");
2451                         Assert.IsFalse (typeof (CA).IsDefined (typeof (FooAttribute), false), "#C3");
2452                         Assert.IsFalse (typeof (CA).IsDefined (typeof (BarAttribute), false), "#C4");
2453                         Assert.IsTrue (typeof (CA).IsDefined (typeof (NemerleAttribute), true), "#C5");
2454                         Assert.IsTrue (typeof (CA).IsDefined (typeof (VolatileModifier), true), "#C6");
2455                         Assert.IsFalse (typeof (CA).IsDefined (typeof (FooAttribute), true), "#C7");
2456                         Assert.IsFalse (typeof (CA).IsDefined (typeof (BarAttribute), true), "#C8");
2457
2458                         Assert.IsFalse (typeof (BBA).IsDefined (typeof (NemerleAttribute), false), "#D1");
2459                         Assert.IsFalse (typeof (BBA).IsDefined (typeof (VolatileModifier), false), "#D2");
2460                         Assert.IsFalse (typeof (BBA).IsDefined (typeof (FooAttribute), false), "#D3");
2461                         Assert.IsFalse (typeof (BBA).IsDefined (typeof (BarAttribute), false), "#D4");
2462                         Assert.IsTrue (typeof (BBA).IsDefined (typeof (NemerleAttribute), true), "#D5");
2463                         Assert.IsTrue (typeof (BBA).IsDefined (typeof (VolatileModifier), true), "#D6");
2464 #if NET_2_0
2465                         Assert.IsTrue (typeof (BBA).IsDefined (typeof (FooAttribute), true), "#D7");
2466                         Assert.IsTrue (typeof (BBA).IsDefined (typeof (BarAttribute), true), "#D8");
2467 #else
2468                         Assert.IsFalse (typeof (BBA).IsDefined (typeof (FooAttribute), true), "#D7");
2469                         Assert.IsFalse (typeof (BBA).IsDefined (typeof (BarAttribute), true), "#D8");
2470 #endif
2471
2472                         Assert.IsTrue (typeof (bug82431A1).IsDefined (typeof (InheritAttribute), false), "#E1");
2473                         Assert.IsTrue (typeof (bug82431A1).IsDefined (typeof (NotInheritAttribute), false), "#E2");
2474                         Assert.IsTrue (typeof (bug82431A1).IsDefined (typeof (InheritAttribute), true), "#E3");
2475                         Assert.IsTrue (typeof (bug82431A1).IsDefined (typeof (NotInheritAttribute), true), "#E4");
2476
2477                         Assert.IsFalse (typeof (bug82431A2).IsDefined (typeof (InheritAttribute), false), "#F1");
2478                         Assert.IsFalse (typeof (bug82431A2).IsDefined (typeof (NotInheritAttribute), false), "#F2");
2479 #if NET_2_0
2480                         Assert.IsFalse (typeof (bug82431A2).IsDefined (typeof (InheritAttribute), true), "#F3");
2481 #else
2482                         Assert.IsTrue (typeof (bug82431A2).IsDefined (typeof (InheritAttribute), true), "#F3");
2483 #endif
2484                         Assert.IsFalse (typeof (bug82431A2).IsDefined (typeof (NotInheritAttribute), true), "#F4");
2485
2486                         Assert.IsTrue (typeof (bug82431A3).IsDefined (typeof (InheritAttribute), false), "#G1");
2487                         Assert.IsTrue (typeof (bug82431A3).IsDefined (typeof (NotInheritAttribute), false), "#G2");
2488                         Assert.IsTrue (typeof (bug82431A3).IsDefined (typeof (InheritAttribute), true), "#G3");
2489                         Assert.IsTrue (typeof (bug82431A3).IsDefined (typeof (NotInheritAttribute), true), "#G4");
2490
2491                         Assert.IsTrue (typeof (bug82431B1).IsDefined (typeof (InheritAttribute), false), "#H1");
2492                         Assert.IsFalse (typeof (bug82431B1).IsDefined (typeof (NotInheritAttribute), false), "#H2");
2493                         Assert.IsTrue (typeof (bug82431B1).IsDefined (typeof (InheritAttribute), true), "#H3");
2494                         Assert.IsFalse (typeof (bug82431B1).IsDefined (typeof (NotInheritAttribute), true), "#H4");
2495
2496                         Assert.IsFalse (typeof (bug82431B2).IsDefined (typeof (InheritAttribute), false), "#I1");
2497                         Assert.IsFalse (typeof (bug82431B2).IsDefined (typeof (NotInheritAttribute), false), "#I2");
2498                         Assert.IsTrue (typeof (bug82431B2).IsDefined (typeof (InheritAttribute), true), "#I3");
2499                         Assert.IsFalse (typeof (bug82431B2).IsDefined (typeof (NotInheritAttribute), true), "#I4");
2500
2501                         Assert.IsTrue (typeof (bug82431B3).IsDefined (typeof (InheritAttribute), false), "#J1");
2502                         Assert.IsTrue (typeof (bug82431B3).IsDefined (typeof (NotInheritAttribute), false), "#J2");
2503                         Assert.IsTrue (typeof (bug82431B3).IsDefined (typeof (InheritAttribute), true), "#J3");
2504                         Assert.IsTrue (typeof (bug82431B3).IsDefined (typeof (NotInheritAttribute), true), "#J4");
2505
2506                         Assert.IsFalse (typeof (bug82431B4).IsDefined (typeof (InheritAttribute), false), "#K2");
2507                         Assert.IsFalse (typeof (bug82431B4).IsDefined (typeof (NotInheritAttribute), false), "#K2");
2508                         Assert.IsTrue (typeof (bug82431B4).IsDefined (typeof (InheritAttribute), true), "#K3");
2509                         Assert.IsFalse (typeof (bug82431B4).IsDefined (typeof (NotInheritAttribute), true), "#K4");
2510                 }
2511
2512                 [Test] // GetType (String)
2513                 public void GetType1_TypeName_Null ()
2514                 {
2515                         try {
2516                                 Type.GetType ((string) null);
2517                                 Assert.Fail ("#1");
2518                         } catch (ArgumentNullException ex) {
2519                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2520                                 Assert.IsNull (ex.InnerException, "#3");
2521                                 Assert.IsNotNull (ex.Message, "#4");
2522 #if NET_2_0
2523                                 Assert.AreEqual ("TypeName", ex.ParamName, "#5");
2524 #else
2525                                 Assert.AreEqual ("className", ex.ParamName, "#5");
2526 #endif
2527                         }
2528                 }
2529
2530                 [Test] // GetType (String, Boolean)
2531                 public void GetType2_TypeName_Null ()
2532                 {
2533                         try {
2534                                 Type.GetType ((string) null, false);
2535                                 Assert.Fail ("#1");
2536                         } catch (ArgumentNullException ex) {
2537                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2538                                 Assert.IsNull (ex.InnerException, "#3");
2539                                 Assert.IsNotNull (ex.Message, "#4");
2540 #if NET_2_0
2541                                 Assert.AreEqual ("TypeName", ex.ParamName, "#5");
2542 #else
2543                                 Assert.AreEqual ("className", ex.ParamName, "#5");
2544 #endif
2545                         }
2546                 }
2547
2548                 [Test] // GetType (String, Boolean, Boolean)
2549                 public void GetType3_TypeName_Null ()
2550                 {
2551                         try {
2552                                 Type.GetType ((string) null, false, false);
2553                                 Assert.Fail ("#1");
2554                         } catch (ArgumentNullException ex) {
2555                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2556                                 Assert.IsNull (ex.InnerException, "#3");
2557                                 Assert.IsNotNull (ex.Message, "#4");
2558 #if NET_2_0
2559                                 Assert.AreEqual ("TypeName", ex.ParamName, "#5");
2560 #else
2561                                 Assert.AreEqual ("className", ex.ParamName, "#5");
2562 #endif
2563                         }
2564                 }
2565
2566                 [Test]
2567                 public void GetTypeArray_Args_Null ()
2568                 {
2569                         try {
2570                                 Type.GetTypeArray ((object []) null);
2571                                 Assert.Fail ("#1");
2572                         } catch (ArgumentNullException ex) {
2573                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2574                                 Assert.IsNull (ex.InnerException, "#3");
2575                                 Assert.IsNotNull (ex.Message, "#4");
2576                                 Assert.AreEqual ("args", ex.ParamName, "#5");
2577                         }
2578                 }
2579
2580                 [Test]
2581                 public void GetTypeCode ()
2582                 {
2583                         Assert.AreEqual (TypeCode.Boolean, Type.GetTypeCode (typeof (bool)), "#1");
2584                         Assert.AreEqual (TypeCode.Byte, Type.GetTypeCode (typeof (byte)), "#2");
2585                         Assert.AreEqual (TypeCode.Char, Type.GetTypeCode (typeof (char)), "#3");
2586                         Assert.AreEqual (TypeCode.DateTime, Type.GetTypeCode (typeof (DateTime)), "#4");
2587                         Assert.AreEqual (TypeCode.DBNull, Type.GetTypeCode (typeof (DBNull)), "#5");
2588                         Assert.AreEqual (TypeCode.Decimal, Type.GetTypeCode (typeof (decimal)), "#6");
2589                         Assert.AreEqual (TypeCode.Double, Type.GetTypeCode (typeof (double)), "#7");
2590                         Assert.AreEqual (TypeCode.Empty, Type.GetTypeCode (null), "#8");
2591                         Assert.AreEqual (TypeCode.Int16, Type.GetTypeCode (typeof (short)), "#9");
2592                         Assert.AreEqual (TypeCode.Int32, Type.GetTypeCode (typeof (int)), "#10");
2593                         Assert.AreEqual (TypeCode.Int64, Type.GetTypeCode (typeof (long)), "#11");
2594                         Assert.AreEqual (TypeCode.Object, Type.GetTypeCode (typeof (TakesInt)), "#12");
2595                         Assert.AreEqual (TypeCode.SByte, Type.GetTypeCode (typeof (sbyte)), "#13");
2596                         Assert.AreEqual (TypeCode.Single, Type.GetTypeCode (typeof (float)), "#14");
2597                         Assert.AreEqual (TypeCode.String, Type.GetTypeCode (typeof (string)), "#15");
2598                         Assert.AreEqual (TypeCode.UInt16, Type.GetTypeCode (typeof (ushort)), "#16");
2599                         Assert.AreEqual (TypeCode.UInt32, Type.GetTypeCode (typeof (uint)), "#17");
2600                         Assert.AreEqual (TypeCode.UInt64, Type.GetTypeCode (typeof (ulong)), "#18");
2601                 }
2602
2603                 [Test]
2604                 public void GetTypeFromHandle_Handle_Zero ()
2605                 {
2606                         RuntimeTypeHandle handle = new RuntimeTypeHandle ();
2607
2608 #if NET_2_0
2609                         Assert.IsNull (Type.GetTypeFromHandle (handle));
2610 #else
2611                         try {
2612                                 Type.GetTypeFromHandle (handle);
2613                                 Assert.Fail ("#1");
2614                         } catch (ArgumentException ex) {
2615                                 // Handle is not initialized
2616                                 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
2617                                 Assert.IsNull (ex.InnerException, "#3");
2618                                 Assert.IsNotNull (ex.Message, "#4");
2619                                 Assert.IsNull (ex.ParamName, "#5");
2620                         }
2621 #endif
2622                 }
2623
2624                 [Test]
2625                 public void GetTypeHandle_O_Null ()
2626                 {
2627                         try {
2628                                 Type.GetTypeHandle (null);
2629                                 Assert.Fail ("#1");
2630                         } catch (ArgumentNullException ex) {
2631                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2632                                 Assert.IsNull (ex.InnerException, "#3");
2633                                 Assert.IsNotNull (ex.Message, "#4");
2634 #if NET_2_0
2635                                 Assert.IsNull (ex.ParamName, "#5");
2636 #else
2637                                 Assert.AreEqual ("o", ex.ParamName, "#5");
2638 #endif
2639                         }
2640                 }
2641
2642                 [Test] // GetConstructor (Type [])
2643                 public void GetConstructor1 ()
2644                 {
2645                         Type type;
2646                         ConstructorInfo ctor;
2647
2648                         type = typeof (CtorsA);
2649                         ctor = type.GetConstructor (Type.EmptyTypes);
2650                         Assert.IsNotNull (ctor, "#A1");
2651                         Assert.AreEqual (0, ctor.GetParameters ().Length, "#A2");
2652                         Assert.IsFalse (ctor.IsStatic, "#A3");
2653                         Assert.IsTrue (ctor.IsPublic, "#A4");
2654                         Assert.AreEqual (".ctor", ctor.Name, "#A5");
2655
2656                         type = typeof (CtorsB);
2657                         ctor = type.GetConstructor (Type.EmptyTypes);
2658                         Assert.IsNotNull (ctor, "#B1");
2659                         Assert.AreEqual (0, ctor.GetParameters ().Length, "#B2");
2660                         Assert.IsFalse (ctor.IsStatic, "#B3");
2661                         Assert.IsTrue (ctor.IsPublic, "#B4");
2662                         Assert.AreEqual (".ctor", ctor.Name, "#B5");
2663
2664                         type = typeof (CtorsC);
2665                         ctor = type.GetConstructor (Type.EmptyTypes);
2666                         Assert.IsNull (ctor, "#C");
2667
2668                         type = typeof (CtorsC);
2669                         ctor = type.GetConstructor (new Type [] { typeof (int) });
2670                         Assert.IsNotNull (ctor, "#D1");
2671                         Assert.AreEqual (1, ctor.GetParameters ().Length, "#D2");
2672                         Assert.IsFalse (ctor.IsStatic, "#D3");
2673                         Assert.IsTrue (ctor.IsPublic, "#D4");
2674                         Assert.AreEqual (".ctor", ctor.Name, "#D5");
2675                 }
2676
2677                 [Test] // GetConstructor (Type [])
2678                 public void GetConstructor1_Types_Null ()
2679                 {
2680                         try {
2681                                 typeof (BindingFlags).GetConstructor (null);
2682                                 Assert.Fail ("#1");
2683                         } catch (ArgumentNullException ex) {
2684                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2685                                 Assert.IsNull (ex.InnerException, "#3");
2686                                 Assert.IsNotNull (ex.Message, "#4");
2687                                 Assert.IsNotNull (ex.ParamName, "#5");
2688                                 Assert.AreEqual ("types", ex.ParamName, "#6");
2689                         }
2690                 }
2691
2692                 [Test] // GetConstructor (Type [])
2693                 public void GetConstructor1_Types_ItemNull ()
2694                 {
2695                         Type type = typeof (BindingFlags);
2696                         try {
2697                                 type.GetConstructor (new Type[1] { null });
2698                                 Assert.Fail ("#A1");
2699                         } catch (ArgumentNullException ex) {
2700                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#A2");
2701                                 Assert.IsNull (ex.InnerException, "#A3");
2702                                 Assert.IsNotNull (ex.Message, "#A4");
2703                                 Assert.IsNotNull (ex.ParamName, "#A5");
2704                                 Assert.AreEqual ("types", ex.ParamName, "#A6");
2705                         }
2706
2707                         type = typeof (TakesInt);
2708                         try {
2709                                 type.GetConstructor (new Type [1] { null });
2710                                 Assert.Fail ("#B1");
2711                         } catch (ArgumentNullException ex) {
2712                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#B2");
2713                                 Assert.IsNull (ex.InnerException, "#B3");
2714                                 Assert.IsNotNull (ex.Message, "#B4");
2715                                 Assert.IsNotNull (ex.ParamName, "#B5");
2716                                 Assert.AreEqual ("types", ex.ParamName, "#B6");
2717                         }
2718                 }
2719
2720                 [Test] // GetConstructor (BindingFlags, Binder, Type [], ParameterModifier [])
2721                 public void GetConstructor2_Types_ItemNull ()
2722                 {
2723                         Type type = typeof (BindingFlags);
2724                         try {
2725                                 type.GetConstructor (BindingFlags.Default, null,
2726                                         new Type[1] { null }, null);
2727                                 Assert.Fail ("#1");
2728                         } catch (ArgumentNullException ex) {
2729                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2730                                 Assert.IsNull (ex.InnerException, "#3");
2731                                 Assert.IsNotNull (ex.Message, "#4");
2732                                 Assert.IsNotNull (ex.ParamName, "#5");
2733                                 Assert.AreEqual ("types", ex.ParamName, "#6");
2734                         }
2735                 }
2736
2737                 [Test] // GetConstructor (BindingFlags, Binder, CallingConventions, Type [], ParameterModifier [])
2738                 public void GetConstructor3_Types_ItemNull ()
2739                 {
2740                         Type type = typeof (BindingFlags);
2741                         try {
2742                                 type.GetConstructor (BindingFlags.Default,
2743                                         null, CallingConventions.Any,
2744                                         new Type[1] { null }, null);
2745                                 Assert.Fail ("#1");
2746                         } catch (ArgumentNullException ex) {
2747                                 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
2748                                 Assert.IsNull (ex.InnerException, "#3");
2749                                 Assert.IsNotNull (ex.Message, "#4");
2750                                 Assert.IsNotNull (ex.ParamName, "#5");
2751                                 Assert.AreEqual ("types", ex.ParamName, "#6");
2752                         }
2753                 }
2754
2755                 [Test]
2756                 public void GetMethod_Bug77367 ()
2757                 {
2758                         MethodInfo i = typeof (Bug77367).GetMethod ("Run", Type.EmptyTypes);
2759                         Assert.IsNull (i);
2760                 }
2761
2762 #if !TARGET_JVM // Reflection.Emit is not supported for TARGET_JVM
2763                 [Test]
2764                 public void EqualsUnderlyingType ()
2765                 {
2766                         AssemblyBuilderAccess access = AssemblyBuilderAccess.RunAndSave;
2767                         TypeAttributes attribs = TypeAttributes.Public;
2768
2769                         AssemblyName name = new AssemblyName ();
2770                         name.Name = "enumtest";
2771                         AssemblyBuilder assembly = 
2772                                 AppDomain.CurrentDomain.DefineDynamicAssembly (
2773                                         name, access);
2774
2775                         ModuleBuilder module = assembly.DefineDynamicModule 
2776                                 ("m", "enumtest.dll");
2777                         EnumBuilder e = module.DefineEnum ("E", attribs, typeof (int));
2778
2779                         Assert.IsTrue (typeof (int).Equals (e));
2780                 }
2781 #endif // TARGET_JVM
2782
2783                 [Test]
2784                 public void Equals_Type_Null ()
2785                 {
2786                         Assert.IsFalse (typeof (int).Equals ((Type) null), "#1");
2787                         Assert.IsFalse (typeof (int).Equals ((object) null), "#2");
2788                 }
2789
2790                 [Test]
2791                 public void GetElementType_Bug63841 ()
2792                 {
2793                         Assert.IsNull (typeof (TheEnum).GetElementType (), "#1");
2794                 }
2795
2796 #if NET_2_0
2797                 [Test]
2798                 public void FullNameGenerics ()
2799                 {
2800                         Type fooType = typeof (Foo<>);
2801                         FieldInfo [] fields = fooType.GetFields ();
2802
2803                         Assert.AreEqual (1, fields.Length, "#0");
2804
2805                         Assert.IsNotNull (fooType.FullName, "#1");
2806                         Assert.IsNotNull (fooType.AssemblyQualifiedName, "#1a");
2807
2808                         FieldInfo field = fooType.GetField ("Whatever");
2809                         Assert.IsNotNull (field, "#2");
2810                         Assert.AreEqual (field, fields [0], "#2a");
2811                         Assert.IsNull (field.FieldType.FullName, "#3");
2812                         Assert.IsNull (field.FieldType.AssemblyQualifiedName, "#3a");
2813                         Assert.IsNotNull (field.FieldType.ToString (), "#4");
2814
2815                         PropertyInfo prop = fooType.GetProperty ("Test");
2816                         Assert.IsNotNull (prop, "#5");
2817                         Assert.IsNull (prop.PropertyType.FullName, "#6");
2818                         Assert.IsNull (prop.PropertyType.AssemblyQualifiedName, "#6a");
2819                         Assert.IsNotNull (prop.PropertyType.ToString (), "#7");
2820
2821                         MethodInfo method = fooType.GetMethod("Execute");
2822                         Assert.IsNotNull (method, "#8");
2823                         Assert.IsNull (method.ReturnType.FullName, "#9");
2824                         Assert.IsNull (method.ReturnType.AssemblyQualifiedName, "#9a");
2825                         Assert.IsNotNull (method.ReturnType.ToString (), "#10");
2826
2827                         ParameterInfo[] parameters = method.GetParameters();
2828                         Assert.AreEqual (1, parameters.Length, "#11");
2829                         Assert.IsNull (parameters[0].ParameterType.FullName, "#12");
2830                         Assert.IsNull (parameters[0].ParameterType.AssemblyQualifiedName, "#12a");
2831                         Assert.IsNotNull (parameters[0].ParameterType.ToString (), "#13");
2832                 }
2833
2834                 [Test]
2835                 public void TypeParameterIsNotGeneric ()
2836                 {
2837                         Type fooType = typeof (Foo<>);
2838                         Type type_param = fooType.GetGenericArguments () [0];
2839                         Assert.IsTrue (type_param.IsGenericParameter);
2840                         Assert.IsFalse (type_param.IsGenericType);
2841                         Assert.IsFalse (type_param.IsGenericTypeDefinition);
2842
2843                         // LAMESPEC: MSDN claims that this should be false, but .NET v2.0.50727 says it's true
2844                         // http://msdn2.microsoft.com/en-us/library/system.type.isgenerictype.aspx
2845                         Assert.IsTrue (type_param.ContainsGenericParameters);
2846                 }
2847
2848                 [Test]
2849                 public void IsAssignable ()
2850                 {
2851                         Type foo_type = typeof (Foo<>);
2852                         Type foo_int_type = typeof (Foo<int>);
2853                         Assert.IsFalse (foo_type.IsAssignableFrom (foo_int_type), "Foo<int> -!-> Foo<>");
2854                         Assert.IsFalse (foo_int_type.IsAssignableFrom (foo_type), "Foo<> -!-> Foo<int>");
2855
2856                         Type ibar_short_type = typeof (IBar<short>);
2857                         Type ibar_int_type = typeof (IBar<int>);
2858                         Type baz_short_type = typeof (Baz<short>);
2859                         Type baz_int_type = typeof (Baz<int>);
2860
2861                         Assert.IsTrue (ibar_int_type.IsAssignableFrom (baz_int_type), "Baz<int> -> IBar<int>");
2862                         Assert.IsTrue (ibar_short_type.IsAssignableFrom (baz_short_type), "Baz<short> -> IBar<short>");
2863
2864                         Assert.IsFalse (ibar_int_type.IsAssignableFrom (baz_short_type), "Baz<short> -!-> IBar<int>");
2865                         Assert.IsFalse (ibar_short_type.IsAssignableFrom (baz_int_type), "Baz<int> -!-> IBar<short>");
2866
2867                         // Nullable tests
2868                         Assert.IsTrue (typeof (Nullable<int>).IsAssignableFrom (typeof (int)));
2869                         Assert.IsFalse (typeof (int).IsAssignableFrom (typeof (Nullable<int>)));
2870                         Assert.IsTrue (typeof (Nullable<FooStruct>).IsAssignableFrom (typeof (FooStruct)));
2871                 }
2872
2873                 [Test]
2874                 public void IsInstanceOf ()
2875                 {
2876                         Assert.IsTrue (typeof (Nullable<int>).IsInstanceOfType (5));
2877                 }
2878
2879                 [Test]
2880                 public void IsInstanceOfArrayOfNullable ()
2881                 {
2882                         Assert.IsTrue (typeof (Nullable<int>[]).IsInstanceOfType (new Nullable<int> [0]));
2883                 }
2884
2885                 [Test]
2886                 public void ByrefType ()
2887                 {
2888                         Type foo_type = typeof (Foo<>);
2889                         Type type_param = foo_type.GetGenericArguments () [0];
2890                         Type byref_type_param = type_param.MakeByRefType ();
2891                         Assert.IsFalse (byref_type_param.IsGenericParameter);
2892                         Assert.IsNull (byref_type_param.DeclaringType);
2893                 }
2894
2895                 [ComVisible (true)]
2896                 public class ComFoo<T> {
2897                 }
2898
2899                 [Test]
2900                 public void GetCustomAttributesGenericInstance ()
2901                 {
2902                         Assert.AreEqual (1, typeof (ComFoo<int>).GetCustomAttributes (typeof (ComVisibleAttribute), true).Length);
2903                 }
2904
2905                 interface ByRef1<T> { void f (ref T t); }
2906                 interface ByRef2 { void f<T> (ref T t); }
2907
2908                 interface ByRef3<T> where T:struct { void f (ref T? t); }
2909                 interface ByRef4 { void f<T> (ref T? t) where T:struct; }
2910
2911                 void CheckGenericByRef (Type t)
2912                 {
2913                         string name = t.Name;
2914                         t = t.GetMethod ("f").GetParameters () [0].ParameterType;
2915
2916                         Assert.IsFalse (t.IsGenericType, name);
2917                         Assert.IsFalse (t.IsGenericTypeDefinition, name);
2918                         Assert.IsFalse (t.IsGenericParameter, name);
2919                 }
2920
2921                 [Test]
2922                 public void GenericByRef ()
2923                 {
2924                         CheckGenericByRef (typeof (ByRef1<>));
2925                         CheckGenericByRef (typeof (ByRef2));
2926                         CheckGenericByRef (typeof (ByRef3<>));
2927                         CheckGenericByRef (typeof (ByRef4));
2928                 }
2929
2930                 public class Bug80242<T> {
2931                         public interface IFoo { }
2932                         public class Bar : IFoo { }
2933                         public class Baz : Bar { }
2934                 }
2935
2936                 [Test]
2937                 public void TestNestedTypes ()
2938                 {
2939                         Type t = typeof (Bug80242<object>);
2940                         Assert.IsFalse (t.IsGenericTypeDefinition);
2941                         foreach (Type u in t.GetNestedTypes ()) {
2942                                 Assert.IsTrue (u.IsGenericTypeDefinition, "{0} isn't a generic definition", u);
2943                                 Assert.AreEqual (u, u.GetGenericArguments () [0].DeclaringType);
2944                         }
2945                 }
2946
2947                 [Test] // bug #82211
2948                 public void GetMembers_GenericArgument ()
2949                 {
2950                         Type argType = typeof (ComFoo<>).GetGenericArguments () [0];
2951                         MemberInfo [] members = argType.GetMembers ();
2952                         Assert.IsNotNull (members, "#1");
2953                         Assert.AreEqual (4, members.Length, "#2");
2954                 }
2955
2956                 [Test]
2957                 [ExpectedException (typeof (ArgumentNullException))]
2958                 public void ReflectionOnlyGetTypeNullTypeName ()
2959                 {
2960                         Type.ReflectionOnlyGetType (null, false, false);
2961                 }
2962
2963                 [Test]
2964                 public void ReflectionOnlyGetTypeDoNotThrow ()
2965                 {
2966                         Assert.IsNull (Type.ReflectionOnlyGetType ("a, nonexistent.dll", false, false));
2967                 }
2968
2969                 [Test]
2970                 [ExpectedException (typeof (FileNotFoundException))]
2971                 public void ReflectionOnlyGetTypeThrow ()
2972                 {
2973                         Type.ReflectionOnlyGetType ("a, nonexistent.dll", true, false);
2974                 }
2975
2976                 [Test]
2977                 public void ReflectionOnlyGetType ()
2978                 {
2979                         Type t = Type.ReflectionOnlyGetType (typeof (int).AssemblyQualifiedName.ToString (), true, true);
2980                         Assert.AreEqual ("System.Int32", t.FullName);
2981                 }
2982
2983                 [Test] //bug #331199
2984                 //FIXME: 2.0 SP 1 has a diferent behavior
2985                 public void MakeGenericType_UserDefinedType ()
2986                 {
2987                         Type ut = new UserType (typeof (int));
2988                         Type t = typeof (Foo<>).MakeGenericType (ut);
2989                         Assert.IsTrue (t.IsGenericType, "#A1");
2990                         Assert.AreEqual (1, t.GetGenericArguments ().Length, "#A2");
2991
2992                         Type arg = t.GetGenericArguments () [0];
2993                         Assert.IsNotNull (arg, "#B1");
2994                         Assert.IsFalse (arg.IsGenericType, "#B2");
2995                         Assert.AreEqual (typeof (int), arg, "#B3");
2996                 }
2997
2998                 [Category ("NotWorking")]
2999                 //We dont support instantiating a user type 
3000                 public void MakeGenericType_NestedUserDefinedType ()
3001                 {
3002                         Type ut = new UserType (new UserType (typeof (int)));
3003                         Type t = typeof (Foo<>).MakeGenericType (ut);
3004                         Assert.IsTrue (t.IsGenericType, "#A1");
3005                         Assert.AreEqual (1, t.GetGenericArguments ().Length, "#A2");
3006
3007                         Type arg = t.GetGenericArguments () [0];
3008                         Assert.IsNotNull (arg, "#B1");
3009                         Assert.IsFalse (arg.IsGenericType, "#B2");
3010                         Assert.AreEqual (ut, arg, "#B3");
3011                 }
3012                 
3013                 [Test]
3014                 [Category ("NotWorking")]
3015                 public void TestMakeGenericType_UserDefinedType_DotNet20SP1 () 
3016                 {
3017                         Type ut = new UserType(typeof(int));
3018                         Type t = typeof(Foo<>).MakeGenericType(ut);
3019                         Assert.IsTrue (t.IsGenericType, "#1");
3020
3021                         Assert.AreEqual (ut, t.GetGenericArguments()[0], "#2");
3022                 }
3023                 
3024                 [Test]
3025                 public void MakeGenericType_BadUserType ()
3026                 {
3027                         Type ut = new UserType (null);
3028                         try {
3029                                 Type t = typeof (Foo<>).MakeGenericType (ut);
3030                                 Assert.Fail ("#1");
3031                         } catch (ArgumentException) {
3032                         }
3033                 }
3034         
3035                 [Test]
3036                 public void MakeGenericType_WrongNumOfArguments ()
3037                 {
3038                         try {
3039                                 Type t = typeof (Foo<,>).MakeGenericType (new Type [] { typeof (int) });
3040                                 Assert.Fail ("#1");
3041                         } catch (ArgumentException) {
3042                         }
3043                 }
3044
3045                 [AttributeUsage (AttributeTargets.All)]
3046                 public class DocAttribute : Attribute {
3047                         public DocAttribute (string docs) {}
3048                 }
3049                 
3050                 class GenericClassWithAttributes<[Doc ("T")] T, [Doc ("B")] B> 
3051                         where T : class, new ()
3052                         where B : Attribute
3053                 {
3054                         public T Bar { get{return null;}}
3055
3056                         public void M<[Doc ("X")] X> (X x)
3057                         {
3058                         }
3059                 }
3060         
3061                 [Test] //bug #377596
3062                 public void GetGenericArguments_ArgumentsHaveAttributes ()
3063                 {
3064                         Type type = typeof(GenericClassWithAttributes<,>);
3065                         Type[] tArgs = type.GetGenericArguments ();
3066                         MethodInfo m = type.GetMethod ("M");
3067                         Type[] mArgs = m.GetGenericArguments ();
3068                         Assert.AreEqual(1, tArgs[0].GetCustomAttributes (typeof (DocAttribute), true).Length, "#1");
3069                         Assert.AreEqual(1, tArgs[1].GetCustomAttributes (typeof (DocAttribute), true).Length, "#1");
3070                         Assert.AreEqual(1, mArgs[0].GetCustomAttributes (typeof (DocAttribute), true).Length, "#1");
3071                 }
3072
3073                 [Test] //bug #471255
3074                 public void GetTypeCalledUsingReflection ()
3075                 {
3076                         Type expectedType = Type.GetType ("NoNamespaceClass");
3077                         Assert.IsNotNull (expectedType, "#1");
3078                         MethodInfo m = typeof (Type).GetMethod ("GetType",  BindingFlags.Public | BindingFlags.Static, null, new Type [] { typeof (string) },  null);
3079                         object r = m.Invoke (null, BindingFlags.Default, null, new object [] { "NoNamespaceClass" }, CultureInfo.InvariantCulture);
3080                         Assert.AreSame (expectedType, r, "#2");
3081                 }
3082
3083         [Test]
3084         public void EqualsUserType () {
3085                 UserType2 t1 = new UserType2(null);
3086                 UserType2 t2 = new UserType2(t1);
3087                 Assert.IsTrue (t1.Equals(t2));
3088         }
3089
3090         [Test]
3091         public void GetHashCodeUserType () {
3092                 UserType2 t1 = new UserType2(null);
3093                 UserType2 t2 = new UserType2(t1);
3094                 Assert.AreEqual (42, t2.GetHashCode());
3095         }
3096         
3097         [Test]
3098         public void IsGenericTypeDefinitionUserType () {
3099                 Assert.IsFalse (new UserType(null).IsGenericTypeDefinition);
3100         }
3101         
3102         [Test]
3103         public void IsGenericTypeUserType () {
3104                 Assert.IsFalse (new UserType(null).IsGenericType);
3105         }
3106
3107         [Test]
3108         [ExpectedException (typeof (NotSupportedException))]
3109         public void GetGenericTypeDefinitionUserType () {
3110                 new UserType(null).GetGenericTypeDefinition ();
3111         }
3112
3113         [ExpectedException (typeof (NotSupportedException))]
3114         public void GetGenericArgumentsUserType () {
3115                 new UserType(null).GetGenericArguments ();
3116         }
3117         
3118         [Test]
3119         [ExpectedException (typeof (InvalidOperationException))]
3120         public void GenericParameterPositionUserType () {
3121                 Assert.IsTrue (new UserType(null).GenericParameterPosition == 0);
3122         }
3123 #endif
3124
3125                 [Test]
3126                 public void TypeGetMemberReturnTypeTest ()
3127                 {
3128                         object obj;
3129                         MemberTypes memtype;
3130                         Type testtype;
3131                         object [] flagsandtypes = new object [] {
3132                                 MemberTypes.All, typeof (MemberInfo []),
3133                                 MemberTypes.Constructor, typeof (ConstructorInfo []),
3134                                 MemberTypes.Custom, typeof (MemberInfo []),
3135                                 MemberTypes.Event, typeof (EventInfo []),
3136                                 MemberTypes.Field, typeof (FieldInfo []),
3137                                 MemberTypes.Method, typeof (MethodInfo []),
3138                                 MemberTypes.NestedType, typeof (Type []),
3139                                 MemberTypes.Property, typeof (PropertyInfo []),
3140                                 MemberTypes.TypeInfo, typeof (Type [])};
3141
3142                         for (int i=0; i < flagsandtypes.Length; i+=2) {
3143                                 memtype = (MemberTypes)flagsandtypes [i];
3144                                 testtype = (Type)flagsandtypes [i+1];
3145                                 obj = GetType ().GetMember ("DummyMember", memtype,
3146                                                 BindingFlags.Public | BindingFlags.Instance);
3147                                 Assert.AreEqual (testtype.GetHashCode (), obj.GetType ().GetHashCode (),
3148                                                 "Expected " + testtype.FullName);
3149                         }
3150
3151                 }
3152  
3153                 [Test]
3154                 public void TypeNameStartsWithSpace ()
3155                 {
3156                         Type t1 = Type.GetType ("System.Type, mscorlib");
3157                         Type t2 = Type.GetType (" System.Type, mscorlib");
3158                         Assert.AreEqual (t1, t2);
3159                 }
3160
3161                 static bool ContainsProperty (PropertyInfo [] props, string name)
3162                 {
3163                         foreach (PropertyInfo p in props)
3164                                 if (p.Name == name)
3165                                         return true;
3166                         return false;
3167                 }
3168
3169                 public class NemerleAttribute : Attribute
3170                 {
3171                 }
3172
3173                 public class VolatileModifier : NemerleAttribute
3174                 {
3175                 }
3176
3177                 [VolatileModifier]
3178                 [FooAttribute]
3179                 class A
3180                 {
3181                 }
3182
3183                 [AttributeUsage (AttributeTargets.Class, Inherited=false)]
3184                 public class FooAttribute : Attribute
3185                 {
3186                 }
3187
3188                 public class BarAttribute : FooAttribute
3189                 {
3190                 }
3191
3192                 [BarAttribute]
3193                 class BA : A
3194                 {
3195                 }
3196
3197                 class BBA : BA
3198                 {
3199                 }
3200
3201                 class CA : A
3202                 {
3203                 }
3204
3205                 [AttributeUsage (AttributeTargets.Class, Inherited=true)]
3206                 public class InheritAttribute : Attribute
3207                 {
3208                 }
3209
3210                 [AttributeUsage (AttributeTargets.Class, Inherited=false)]
3211                 public class NotInheritAttribute : InheritAttribute
3212                 {
3213                 }
3214
3215                 [NotInheritAttribute]
3216                 public class bug82431A1
3217                 {
3218                 }
3219
3220                 public class bug82431A2 : bug82431A1
3221                 {
3222                 }
3223
3224                 [NotInheritAttribute]
3225                 [InheritAttribute]
3226                 public class bug82431A3 : bug82431A1
3227                 {
3228                 }
3229
3230                 [InheritAttribute]
3231                 public class bug82431B1
3232                 {
3233                 }
3234
3235                 public class bug82431B2 : bug82431B1
3236                 {
3237                 }
3238
3239                 [NotInheritAttribute]
3240                 public class bug82431B3 : bug82431B2
3241                 {
3242                 }
3243
3244                 public class bug82431B4 : bug82431B3
3245                 {
3246                 }
3247
3248                 struct FooStruct
3249                 {
3250                 }
3251
3252                 public class Bug77367
3253                 {
3254                         public void Run (bool b)
3255                         {
3256                         }
3257                 }
3258
3259                 public class Blue
3260                 {
3261                         private string PrivInstBlue
3262                         {
3263                                 get { return null; }
3264                         }
3265
3266                         protected string ProtInstBlue
3267                         {
3268                                 get { return null; }
3269                         }
3270
3271                         protected internal string ProIntInstBlue
3272                         {
3273                                 get { return null; }
3274                         }
3275
3276                         public long PubInstBlue
3277                         {
3278                                 get
3279                                 {
3280                                         if (PrivInstBlue == null)
3281                                                 return 0;
3282                                         return long.MaxValue;
3283                                 }
3284                         }
3285
3286                         internal int IntInstBlue
3287                         {
3288                                 get { return 0; }
3289                         }
3290
3291                         private static string PrivStatBlue
3292                         {
3293                                 get { return null; }
3294                         }
3295
3296                         protected static string ProtStatBlue
3297                         {
3298                                 get { return null; }
3299                         }
3300
3301                         protected static internal string ProIntStatBlue
3302                         {
3303                                 get { return null; }
3304                         }
3305
3306                         public static long PubStatBlue
3307                         {
3308                                 get
3309                                 {
3310                                         if (PrivStatBlue == null)
3311                                                 return 0;
3312                                         return long.MaxValue;
3313                                 }
3314                         }
3315
3316                         internal static int IntStatBlue
3317                         {
3318                                 get { return 0; }
3319                         }
3320                 }
3321
3322                 public class Foo : Blue
3323                 {
3324                         private string PrivInstBase
3325                         {
3326                                 get { return null; }
3327                         }
3328
3329                         protected string ProtInstBase
3330                         {
3331                                 get { return null; }
3332                         }
3333
3334                         protected internal string ProIntInstBase
3335                         {
3336                                 get { return null; }
3337                         }
3338
3339                         public long PubInstBase
3340                         {
3341                                 get
3342                                 {
3343                                         if (PrivInstBase == null)
3344                                                 return 0;
3345                                         return long.MaxValue;
3346                                 }
3347                         }
3348
3349                         internal int IntInstBase
3350                         {
3351                                 get { return 0; }
3352                         }
3353
3354                         private static string PrivStatBase
3355                         {
3356                                 get { return null; }
3357                         }
3358
3359                         protected static string ProtStatBase
3360                         {
3361                                 get { return null; }
3362                         }
3363
3364                         protected static internal string ProIntStatBase
3365                         {
3366                                 get { return null; }
3367                         }
3368
3369                         public static long PubStatBase
3370                         {
3371                                 get
3372                                 {
3373                                         if (PrivStatBase == null)
3374                                                 return 0;
3375                                         return long.MaxValue;
3376                                 }
3377                         }
3378
3379                         internal static int IntStatBase
3380                         {
3381                                 get { return 0; }
3382                         }
3383                 }
3384
3385                 public class Bar : Foo
3386                 {
3387                         private string PrivInst
3388                         {
3389                                 get { return null; }
3390                         }
3391
3392                         protected string ProtInst
3393                         {
3394                                 get { return null; }
3395                         }
3396
3397                         protected internal string ProIntInst
3398                         {
3399                                 get { return null; }
3400                         }
3401
3402                         public long PubInst
3403                         {
3404                                 get
3405                                 {
3406                                         if (PrivInst == null)
3407                                                 return 0;
3408                                         return long.MaxValue;
3409                                 }
3410                         }
3411
3412                         internal int IntInst
3413                         {
3414                                 get { return 0; }
3415                         }
3416
3417                         private static string PrivStat
3418                         {
3419                                 get { return null; }
3420                         }
3421
3422                         protected static string ProtStat
3423                         {
3424                                 get { return null; }
3425                         }
3426
3427                         protected static internal string ProIntStat
3428                         {
3429                                 get { return null; }
3430                         }
3431
3432                         public static long PubStat
3433                         {
3434                                 get
3435                                 {
3436                                         if (PrivStat == null)
3437                                                 return 0;
3438                                         return long.MaxValue;
3439                                 }
3440                         }
3441
3442                         internal static int IntStat
3443                         {
3444                                 get { return 0; }
3445                         }
3446                 }
3447
3448                 class CtorsA
3449                 {
3450                         static CtorsA ()
3451                         {
3452                         }
3453                 }
3454
3455                 class CtorsB
3456                 {
3457                         public CtorsB ()
3458                         {
3459                         }
3460                 }
3461
3462                 class CtorsC
3463                 {
3464                         static CtorsC ()
3465                         {
3466                         }
3467
3468                         public CtorsC (int x)
3469                         {
3470                         }
3471                 }
3472         }
3473
3474 #if NET_2_0
3475         class UserType : Type
3476         {
3477                 protected Type type;
3478         
3479                 public UserType(Type type) {
3480                         this.type = type;
3481                 }
3482         
3483                 public override Type UnderlyingSystemType { get { return this.type; } }
3484         
3485                 public override Assembly Assembly { get { return this.type.Assembly; } }
3486         
3487                 public override string AssemblyQualifiedName { get { return null; } }
3488         
3489                 public override Type BaseType { get { return null; } }
3490         
3491                 public override Module Module { get { return this.type.Module; } }
3492         
3493                 public override string Namespace { get { return null; } }
3494         
3495                 public override bool IsGenericParameter { get { return true; } }
3496          
3497                 public override RuntimeTypeHandle TypeHandle { get { throw new NotSupportedException(); } }
3498         
3499                 public override bool ContainsGenericParameters { get { return true; } }
3500         
3501                 public override string FullName { get { return this.type.Name; } }
3502         
3503                 public override Guid GUID { get { throw new NotSupportedException(); } }
3504         
3505         
3506                 protected override bool IsArrayImpl() {
3507                         return false;
3508                 }
3509         
3510                 protected override bool IsByRefImpl()
3511                 {
3512                         return false;
3513                 }
3514         
3515                 protected override bool IsCOMObjectImpl()
3516                 {
3517                         return false;
3518                 }
3519         
3520                 protected override bool IsPointerImpl()
3521                 {
3522                         return false;
3523                 }
3524         
3525                 protected override bool IsPrimitiveImpl()
3526                 {
3527                         return false;
3528                 }
3529         
3530         
3531                 protected override TypeAttributes GetAttributeFlagsImpl()
3532                 {
3533                         return 0;
3534                 }
3535         
3536                 protected override ConstructorInfo GetConstructorImpl(BindingFlags bindingAttr, Binder binder,
3537                                                                            CallingConventions callConvention, Type[] types,
3538                                                                            ParameterModifier[] modifiers)
3539                 {
3540                         return null;
3541                 }
3542         
3543                 public override ConstructorInfo[] GetConstructors(BindingFlags bindingAttr)
3544                 {
3545                         return null;
3546                 }
3547         
3548                 public override Type GetElementType()
3549                 {
3550                         return null;
3551                 }
3552         
3553                 public override EventInfo GetEvent(string name, BindingFlags bindingAttr)
3554                 {
3555                         return null;
3556                 }
3557         
3558         
3559                 public override FieldInfo GetField(string name, BindingFlags bindingAttr)
3560                 {
3561                         return null;
3562                 }
3563         
3564         
3565                 public override Type GetInterface(string name, bool ignoreCase)
3566                 {
3567                         return null;
3568                 }
3569         
3570                 public override Type[] GetInterfaces()
3571                 {
3572                         return null;
3573                 }
3574         
3575                 public override MemberInfo[] GetMembers(BindingFlags bindingAttr)
3576                 {
3577                         return null;
3578                 }
3579         
3580                 public override object[] GetCustomAttributes(Type attributeType, bool inherit)
3581                 {
3582                         return null;
3583                 }
3584         
3585                 public override object[] GetCustomAttributes(bool inherit)
3586                 {
3587                         return null;
3588                 }
3589         
3590                 public override bool IsDefined(Type attributeType, bool inherit)
3591                 {
3592                         return false;
3593                 }
3594         
3595                 public override string Name { get { return this.type.Name; } }
3596         
3597                 public override EventInfo[] GetEvents(BindingFlags bindingAttr)
3598                 {
3599                         throw new NotImplementedException();
3600                 }
3601         
3602                 public override FieldInfo[] GetFields(BindingFlags bindingAttr)
3603                 {
3604                         throw new NotImplementedException();
3605                 }
3606         
3607                 protected override MethodInfo GetMethodImpl(string name, BindingFlags bindingAttr, Binder binder,
3608                                                                  CallingConventions callConvention, Type[] types,
3609                                                                  ParameterModifier[] modifiers)
3610                 {
3611                         return null;
3612                 }
3613         
3614                 public override MethodInfo[] GetMethods(BindingFlags bindingAttr)
3615                 {
3616                         return null;
3617                 }
3618         
3619                 public override Type GetNestedType(string name, BindingFlags bindingAttr)
3620                 {
3621                         return null;
3622                 }
3623         
3624                 public override Type[] GetNestedTypes(BindingFlags bindingAttr)
3625                 {
3626                         return null;
3627                 }
3628         
3629                 public override PropertyInfo[] GetProperties(BindingFlags bindingAttr)
3630                 {
3631                         return null;
3632                 }
3633         
3634                 protected override PropertyInfo GetPropertyImpl(string name, BindingFlags bindingAttr, Binder binder,
3635                                                                  Type returnType, Type[] types, ParameterModifier[] modifiers)
3636                 {
3637                         return null;
3638                 }
3639         
3640                 protected override bool HasElementTypeImpl()
3641                 {
3642                         return false;
3643                 }
3644         
3645                 public override object InvokeMember(string name, BindingFlags invokeAttr, Binder binder, object target,
3646                                                          object[] args, ParameterModifier[] modifiers, CultureInfo culture,
3647                                                          string[] namedParameters)
3648                 {
3649                         throw new NotSupportedException();
3650                 }
3651         }
3652
3653     class UserType2 : UserType {
3654                 public UserType2 (Type type) : base (type) {
3655                 }
3656
3657                 public override Type UnderlyingSystemType { get { return this.type ?? this; } }
3658
3659                 public override int GetHashCode()
3660                 {
3661                         if (type == null)
3662                                 return 42;
3663                         return type.GetHashCode();
3664                 }
3665         }
3666 #endif
3667 }