Skip to content

Commit 4f63cbb

Browse files
committed
[linker] improve method detection in FixAbstractMethodsStep
The forms team run into an issue with debugger in VS [1]. During investigation it turned out that our FixAbstractMethodsStep injects 2 methods, which were not needed, as the methods were already implemented. The bug itself looks like an issue, where original mdb file was used in the apk, instead of the one written by our linker. This change improves the method detection, where method name starts with `global::`. In this particular case it were these methods: global::Android.Views.View.IOnTouchListener.OnTouch global::Android.Views.View.IOnClickListener.OnClick [1] https://bugzilla.xamarin.com/show_bug.cgi?id=59293
1 parent 47f370f commit 4f63cbb

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Xamarin.Android.Build.Tasks/Linker/MonoDroid.Tuner/FixAbstractMethodsStep.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,12 @@ static bool CompareTypes (TypeReference iType, TypeReference tType)
9797

9898
bool HaveSameSignature (TypeReference iface, MethodDefinition iMethod, MethodDefinition tMethod)
9999
{
100-
if (iMethod.Name != tMethod.Name && (iMethod.DeclaringType == null || (iMethod.DeclaringType.DeclaringType == null ? (string.Format ("{0}.{1}", iface.FullName, iMethod.Name) != tMethod.Name) : (string.Format ("{0}.{1}.{2}", iMethod.DeclaringType.DeclaringType, iface.Name, iMethod.Name) != tMethod.Name))))
100+
var tName = tMethod.Name.StartsWith ("global::") ? tMethod.Name.Substring (8) : tMethod.Name;
101+
if (iMethod.Name != tName
102+
&& (iMethod.DeclaringType == null
103+
|| (iMethod.DeclaringType.DeclaringType == null
104+
? (string.Format ("{0}.{1}", iface.FullName, iMethod.Name) != tName)
105+
: (string.Format ("{0}.{1}.{2}", iMethod.DeclaringType.DeclaringType, iface.Name, iMethod.Name) != tName))))
101106
return false;
102107

103108
if (!CompareTypes (iMethod.MethodReturnType.ReturnType, tMethod.MethodReturnType.ReturnType))

0 commit comments

Comments
 (0)