@@ -1445,6 +1445,8 @@ private static void WriteGetter(ILGenerator il, Type type, PropertyInfo[] props,
1445
1445
foreach ( PropertyInfo prop in props )
1446
1446
{
1447
1447
if ( prop . GetIndexParameters ( ) . Length != 0 || ! prop . CanRead ) continue ;
1448
+ var getFn = prop . GetGetMethod ( ) ;
1449
+ if ( getFn == null ) continue ; //Mono
1448
1450
1449
1451
Label next = il . DefineLabel ( ) ;
1450
1452
il . Emit ( propName ) ;
@@ -1454,7 +1456,7 @@ private static void WriteGetter(ILGenerator il, Type type, PropertyInfo[] props,
1454
1456
// match:
1455
1457
il . Emit ( target ) ;
1456
1458
Cast ( il , type , loc ) ;
1457
- il . EmitCall ( type . IsValueType ? OpCodes . Call : OpCodes . Callvirt , prop . GetGetMethod ( ) , null ) ;
1459
+ il . EmitCall ( type . IsValueType ? OpCodes . Call : OpCodes . Callvirt , getFn , null ) ;
1458
1460
if ( prop . PropertyType . IsValueType )
1459
1461
{
1460
1462
il . Emit ( OpCodes . Box , prop . PropertyType ) ;
@@ -1503,6 +1505,8 @@ private static void WriteSetter(ILGenerator il, Type type, PropertyInfo[] props,
1503
1505
foreach ( PropertyInfo prop in props )
1504
1506
{
1505
1507
if ( prop . GetIndexParameters ( ) . Length != 0 || ! prop . CanWrite ) continue ;
1508
+ var setFn = prop . GetSetMethod ( ) ;
1509
+ if ( setFn == null ) continue ; //Mono
1506
1510
1507
1511
Label next = il . DefineLabel ( ) ;
1508
1512
il . Emit ( propName ) ;
@@ -1514,7 +1518,7 @@ private static void WriteSetter(ILGenerator il, Type type, PropertyInfo[] props,
1514
1518
Cast ( il , type , loc ) ;
1515
1519
il . Emit ( value ) ;
1516
1520
Cast ( il , prop . PropertyType , null ) ;
1517
- il . EmitCall ( type . IsValueType ? OpCodes . Call : OpCodes . Callvirt , prop . GetSetMethod ( ) , null ) ;
1521
+ il . EmitCall ( type . IsValueType ? OpCodes . Call : OpCodes . Callvirt , setFn , null ) ;
1518
1522
il . Emit ( OpCodes . Ret ) ;
1519
1523
// not match:
1520
1524
il . MarkLabel ( next ) ;
0 commit comments