@@ -452,10 +452,34 @@ public static void SameMethodObtainedViaDelegateAndReflectionAreSameForStruct()
452452 Assert . True ( m1 . Equals ( m2 ) ) ;
453453 }
454454
455+ [ Fact ]
456+ public static void SameGenericMethodObtainedViaDelegateAndReflectionAreSameForClass ( )
457+ {
458+ var m1 = ( ( MethodCallExpression ) ( ( Expression < Action > ) ( ( ) => new ClassG ( ) . M < string , object > ( ) ) ) . Body ) . Method ;
459+ var m2 = new Action ( new ClassG ( ) . M < string , object > ) . Method ;
460+ Assert . True ( m1 . Equals ( m2 ) ) ;
461+ Assert . True ( m1 . GetHashCode ( ) . Equals ( m2 . GetHashCode ( ) ) ) ;
462+ Assert . Equal ( m1 . MethodHandle . Value , m2 . MethodHandle . Value ) ;
463+ }
464+
465+ [ Fact ]
466+ public static void SameGenericMethodObtainedViaDelegateAndReflectionAreSameForStruct ( )
467+ {
468+ var m1 = ( ( MethodCallExpression ) ( ( Expression < Action > ) ( ( ) => new StructG ( ) . M < string , object > ( ) ) ) . Body ) . Method ;
469+ var m2 = new Action ( new StructG ( ) . M < string , object > ) . Method ;
470+ Assert . True ( m1 . Equals ( m2 ) ) ;
471+ Assert . True ( m1 . GetHashCode ( ) . Equals ( m2 . GetHashCode ( ) ) ) ;
472+ Assert . Equal ( m1 . MethodHandle . Value , m2 . MethodHandle . Value ) ;
473+ }
474+
455475 class Class { internal void M ( ) { } }
456476
457477 struct Struct { internal void M ( ) { } }
458478
479+ class ClassG { internal void M < Key , Value > ( ) { } }
480+
481+ struct StructG { internal void M < Key , Value > ( ) { } }
482+
459483 private delegate void IntIntDelegate ( int expected , int actual ) ;
460484 private delegate void IntIntDelegateWithDefault ( int expected , int actual = 7 ) ;
461485
0 commit comments