[macos][mmp] Fix RemoveSelectors when generics are used, Fix #55693 (#2104)

This XM-only RemoveSelectors works on FieldDefinition but in some cases,
e.g. inside a generic types, it's FieldReference that are encoded. This
meant the static constructor was not re-written correctly and would throw
a TargetInvocationException (since the fields were removed correctly)

https://bugzilla.xamarin.com/show_bug.cgi?id=55693
This commit is contained in:
Sebastien Pouliot 2017-05-18 08:45:23 -04:00 коммит произвёл GitHub
Родитель 5c98306c86
Коммит ba06a4c8f4
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -74,7 +74,7 @@ namespace Xamarin.Linker.Steps {
switch (instruction.OpCode.OperandType) {
case OperandType.InlineTok:
case OperandType.InlineField:
var field = instruction.Operand as FieldDefinition;
var field = (instruction.Operand as FieldReference)?.Resolve ();
if (field == null)
continue;
@ -110,7 +110,7 @@ namespace Xamarin.Linker.Steps {
if (instruction.OpCode != OpCodes.Stsfld)
return false;
var field = instruction.Operand as FieldDefinition;
var field = (instruction.Operand as FieldReference)?.Resolve ();
if (field == null)
return false;