diff --git a/src/Mono.Android/Android.Runtime/AndroidRuntime.cs b/src/Mono.Android/Android.Runtime/AndroidRuntime.cs index e819369fef9..b2436fb01b6 100644 --- a/src/Mono.Android/Android.Runtime/AndroidRuntime.cs +++ b/src/Mono.Android/Android.Runtime/AndroidRuntime.cs @@ -317,10 +317,16 @@ protected override IEnumerable GetSimpleReferences (Type type) var typeWithPrefix = desugarType.ToString (); var typeWithSuffix = $"{jniSimpleReference}$-CC"; - return new[]{ + var replacements = new[]{ GetReplacementTypeCore (typeWithPrefix) ?? typeWithPrefix, GetReplacementTypeCore (typeWithSuffix) ?? typeWithSuffix, }; + + if (Logger.LogAssembly) { + var message = $"Remapping type `{jniSimpleReference}` to one one of {{ `{replacements[0]}`, `{replacements[1]}` }}"; + Logger.Log (LogLevel.Debug, "monodroid-assembly", message); + } + return replacements; } protected override string? GetReplacementTypeCore (string jniSimpleReference) @@ -350,11 +356,19 @@ protected override IEnumerable GetSimpleReferences (Type type) var method = new JniRemappingReplacementMethod (); method = Marshal.PtrToStructure(retInfo); + var newSignature = jniMethodSignature; int? paramCount = null; if (method.is_static) { paramCount = JniMemberSignature.GetParameterCountFromMethodSignature (jniMethodSignature) + 1; - jniMethodSignature = $"(L{jniSourceType};" + jniMethodSignature.Substring ("(".Length); + newSignature = $"(L{jniSourceType};" + jniMethodSignature.Substring ("(".Length); + } + + if (Logger.LogAssembly) { + var message = $"Remapping method `{jniSourceType}.{jniMethodName}{jniMethodSignature}` to " + + $"`{method.target_type}.{method.target_name}{newSignature}`; " + + $"param-count: {paramCount}; instance-to-static? {method.is_static}"; + Logger.Log (LogLevel.Debug, "monodroid-assembly", message); } return new JniRuntime.ReplacementMethodInfo { @@ -363,7 +377,7 @@ protected override IEnumerable GetSimpleReferences (Type type) SourceJniMethodSignature = jniMethodSignature, TargetJniType = method.target_type, TargetJniMethodName = method.target_name, - TargetJniMethodSignature = jniMethodSignature, + TargetJniMethodSignature = newSignature, TargetJniMethodParameterCount = paramCount, TargetJniMethodInstanceToStatic = method.is_static, };