@@ -209,6 +209,22 @@ protected virtual void GetObjectData(SerializationInfo info, StreamingContext co
209
209
}
210
210
}
211
211
212
+ [ Serializable ]
213
+ public abstract class ClassWithGenericNonVirtualMethod : IWithGenericMethod
214
+ {
215
+ public virtual int Id { get ; set ; }
216
+ public virtual string Name { get ; set ; }
217
+ public T CopyTo < T > ( ) where T : class , IWithGenericMethod
218
+ {
219
+ return null ;
220
+ }
221
+ }
222
+
223
+ public interface IWithGenericMethod
224
+ {
225
+ T CopyTo < T > ( ) where T : class , IWithGenericMethod ;
226
+ }
227
+
212
228
[ Test ]
213
229
public void VerifyProxyForClassWithInternalInterface ( )
214
230
{
@@ -550,6 +566,32 @@ public void VerifyProxyForInternalClass()
550
566
551
567
Assert . That ( factory . GetFieldInterceptionProxy ( ) , Is . InstanceOf < InternalTestClass > ( ) ) ;
552
568
569
+ #if NETFX
570
+ } ) ;
571
+ #endif
572
+ }
573
+
574
+ [ Test ( Description = "GH2619" ) ]
575
+ public void VerifyProxyForClassWithGenericNonVirtualMethod ( )
576
+ {
577
+ var factory = new StaticProxyFactory ( ) ;
578
+ factory . PostInstantiate (
579
+ typeof ( ClassWithGenericNonVirtualMethod ) . FullName ,
580
+ typeof ( ClassWithGenericNonVirtualMethod ) ,
581
+ new HashSet < System . Type > { typeof ( INHibernateProxy ) } ,
582
+ null , null , null , true ) ;
583
+
584
+ #if NETFX
585
+ VerifyGeneratedAssembly (
586
+ ( ) =>
587
+ {
588
+ #endif
589
+ var proxy = factory . GetProxy ( 1 , null ) ;
590
+ Assert . That ( proxy , Is . Not . Null ) ;
591
+ Assert . That ( proxy , Is . InstanceOf < ClassWithGenericNonVirtualMethod > ( ) ) ;
592
+
593
+ Assert . That ( factory . GetFieldInterceptionProxy ( ) , Is . InstanceOf < ClassWithGenericNonVirtualMethod > ( ) ) ;
594
+
553
595
#if NETFX
554
596
} ) ;
555
597
#endif
0 commit comments