diff --git a/Mono.Cecil/Import.cs b/Mono.Cecil/Import.cs index 272e96076..f27876e00 100644 --- a/Mono.Cecil/Import.cs +++ b/Mono.Cecil/Import.cs @@ -346,10 +346,17 @@ FieldReference ImportField (SR.FieldInfo field, ImportGenericContext context) context.Push (declaring_type); try { + var field_type = ImportType (field.FieldType, context); + + foreach (var t in field.GetRequiredCustomModifiers ()) + field_type = new RequiredModifierType (ImportType (t, context), field_type); + foreach (var t in field.GetOptionalCustomModifiers ()) + field_type = new OptionalModifierType (ImportType (t, context), field_type); + return new FieldReference { Name = field.Name, DeclaringType = declaring_type, - FieldType = ImportType (field.FieldType, context), + FieldType = field_type, }; } finally { context.Pop ();