@@ -1445,6 +1445,8 @@ private static void WriteGetter(ILGenerator il, Type type, PropertyInfo[] props,
14451445 foreach ( PropertyInfo prop in props )
14461446 {
14471447 if ( prop . GetIndexParameters ( ) . Length != 0 || ! prop . CanRead ) continue ;
1448+ var getFn = prop . GetGetMethod ( ) ;
1449+ if ( getFn == null ) continue ; //Mono
14481450
14491451 Label next = il . DefineLabel ( ) ;
14501452 il . Emit ( propName ) ;
@@ -1454,7 +1456,7 @@ private static void WriteGetter(ILGenerator il, Type type, PropertyInfo[] props,
14541456 // match:
14551457 il . Emit ( target ) ;
14561458 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 ) ;
14581460 if ( prop . PropertyType . IsValueType )
14591461 {
14601462 il . Emit ( OpCodes . Box , prop . PropertyType ) ;
@@ -1503,6 +1505,8 @@ private static void WriteSetter(ILGenerator il, Type type, PropertyInfo[] props,
15031505 foreach ( PropertyInfo prop in props )
15041506 {
15051507 if ( prop . GetIndexParameters ( ) . Length != 0 || ! prop . CanWrite ) continue ;
1508+ var setFn = prop . GetSetMethod ( ) ;
1509+ if ( setFn == null ) continue ; //Mono
15061510
15071511 Label next = il . DefineLabel ( ) ;
15081512 il . Emit ( propName ) ;
@@ -1514,7 +1518,7 @@ private static void WriteSetter(ILGenerator il, Type type, PropertyInfo[] props,
15141518 Cast ( il , type , loc ) ;
15151519 il . Emit ( value ) ;
15161520 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 ) ;
15181522 il . Emit ( OpCodes . Ret ) ;
15191523 // not match:
15201524 il . MarkLabel ( next ) ;
0 commit comments