Skip to content

Commit cfe0c61

Browse files
authored
[Mono.Android] Fix ABI break (#10487)
Context: 869b0e0 869b0e0 had an ABI break which exposed an internal JNI reference manager (`AndroidObjectReferenceManager`) class as public in order to use it from the NativeAOT runtime host. Initially I thought the fix would be harder, but... it's not :) - all we need to do is to make the class `internal`, which is what this commit does. Additionally, sort-of revert one more change in 869b0e0, which downgraded a GC diagnostic message from the `Info` log level to `Debug`. The message is actually useful and warns about a potential issue with the GC machinery, so let's emit it is as a warning.
1 parent e72bf36 commit cfe0c61

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/Mono.Android/Android.Runtime/AndroidRuntime.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,7 @@ public AndroidRuntimeOptions (IntPtr jnienv,
102102
}
103103
}
104104

105-
// TODO: this shouldn't be public
106-
public class AndroidObjectReferenceManager : JniRuntime.JniObjectReferenceManager {
105+
internal class AndroidObjectReferenceManager : JniRuntime.JniObjectReferenceManager {
107106
public override int GlobalReferenceCount {
108107
get {return RuntimeNativeMethods._monodroid_gref_get ();}
109108
}
@@ -187,7 +186,7 @@ public override JniObjectReference CreateGlobalReference (JniObjectReference val
187186
var from = log ? new StringBuilder (new StackTrace (true).ToString ()) : null;
188187
int gc = RuntimeNativeMethods._monodroid_gref_log_new (value.Handle, ctype, r.Handle, ntype, tname, tid, from, 1);
189188
if (gc >= JNIEnvInit.gref_gc_threshold) {
190-
Logger.Log (LogLevel.Debug, "monodroid-gc", gc + " outstanding GREFs. Performing a full GC!");
189+
Logger.Log (LogLevel.Warn, "monodroid-gc", gc + " outstanding GREFs. Performing a full GC!");
191190
System.GC.Collect ();
192191
}
193192

0 commit comments

Comments
 (0)