Skip to content

Commit aa16b58

Browse files
committed
[Mono.Android] Print out the Object.handle field.
Context https://xamarinhq.slack.com/archives/C5P3G23NG/p1572987971143400 Context: https://gist.github.com/vargaz/cfed2304cc8c6d7286a247e0b6a7c26c Thanks to @vargaz for the code.
1 parent 4144474 commit aa16b58

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/Mono.Android/Android.Runtime/ConstructorBuilder.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,19 @@ internal class ConstructorBuilder {
3838
il.Emit (OpCodes.Ldc_I4, i);
3939
il.Emit (OpCodes.Ldelem_Ref);
4040
}
41-
il.EmitWriteLine("# jonp: Inside activation constructor for type `{type}`: before invoke!!");
41+
il.EmitWriteLine($"# jonp: Inside activation constructor for type `{type}`: before invoke!!");
42+
43+
Console.WriteLine ("CTOR: " + typeof (Console).GetMethod ("WriteLine", new Type [] { typeof (object) }));
44+
il.Emit (OpCodes.Ldloc_0);
45+
il.Emit (OpCodes.Ldfld, handle);
46+
il.Emit (OpCodes.Box, typeof (IntPtr));
47+
il.Emit (OpCodes.Call, typeof (Console).GetMethod ("WriteLine", new Type [] { typeof (object) }));
48+
il.Emit (OpCodes.Ldloc_0);
49+
il.Emit (OpCodes.Call, typeof (Console).GetMethod ("WriteLine", new Type [] { typeof (object) }));
4250

4351
il.Emit (OpCodes.Call, cinfo);
4452

45-
il.EmitWriteLine("# jonp: Inside activation constructor for type `{type}`: after invoke!!");
53+
il.EmitWriteLine($"# jonp: Inside activation constructor for type `{type}`: after invoke!!");
4654

4755
il.Emit (OpCodes.Ret);
4856

0 commit comments

Comments
 (0)