Skip to content

Commit 2b68085

Browse files
Revert MonoAndroidExportTest changes that force trimmable typemap
The _AndroidTypeMapImplementation=trimmable forcing and Assert.Ignore removal for NativeAOT belong in the separate CI setup PR, not here. This PR should only add the Export code generation support without modifying CI configuration or device test behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 694152f commit 2b68085

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

tests/MSBuildDeviceIntegration/Tests/MonoAndroidExportTest.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ public void MonoAndroidExportReferencedAppStarts (
2222
[Values] bool isRelease,
2323
[Values] AndroidRuntime runtime)
2424
{
25+
if (runtime == AndroidRuntime.NativeAOT) {
26+
Assert.Ignore ("NativeAOT does not support Mono.Android.Export");
27+
}
2528
if (IgnoreUnsupportedConfiguration (runtime, release: isRelease)) {
2629
return;
2730
}
@@ -34,9 +37,6 @@ public void MonoAndroidExportReferencedAppStarts (
3437
},
3538
};
3639
proj.SetRuntime (runtime);
37-
if (runtime == AndroidRuntime.CoreCLR || runtime == AndroidRuntime.NativeAOT) {
38-
proj.SetProperty ("_AndroidTypeMapImplementation", "trimmable");
39-
}
4040
proj.Sources.Add (new BuildItem.Source ("ContainsExportedMethods.cs") {
4141
TextContent = () => @"using System;
4242
using Java.Interop;
@@ -112,6 +112,9 @@ public void ExportedMembersSurviveGarbageCollection (
112112
[Values] bool isRelease,
113113
[Values] AndroidRuntime runtime)
114114
{
115+
if (runtime == AndroidRuntime.NativeAOT) {
116+
Assert.Ignore ("NativeAOT does not support Mono.Android.Export");
117+
}
115118
if (IgnoreUnsupportedConfiguration (runtime, release: isRelease)) {
116119
return;
117120
}
@@ -124,9 +127,6 @@ public void ExportedMembersSurviveGarbageCollection (
124127
},
125128
};
126129
proj.SetRuntime (runtime);
127-
if (runtime == AndroidRuntime.CoreCLR || runtime == AndroidRuntime.NativeAOT) {
128-
proj.SetProperty ("_AndroidTypeMapImplementation", "trimmable");
129-
}
130130
proj.Sources.Add (new BuildItem.Source ("ContainsExportedMethods.cs") {
131131
TextContent = () => @"using System;
132132
using Java.Interop;
@@ -157,13 +157,14 @@ protected override void OnCreate (Bundle bundle)
157157
158158
var foo = new ContainsExportedMethods ();
159159
160-
// Force GC to verify the registered callback does not rely on transient state.
160+
// Force GC to collect any unrooted delegates
161161
for (int i = 0; i < 10; i++) {
162162
GC.Collect ();
163163
GC.WaitForPendingFinalizers ();
164164
}
165165
166-
// Invoke the [Export] method through JNI to validate the generated callback path.
166+
// Invoke the [Export] method through JNI (Java -> native delegate -> C#)
167+
// This path crashes with SIGABRT if the delegate was garbage collected
167168
IntPtr klass = JNIEnv.GetObjectClass (foo.Handle);
168169
IntPtr methodId = JNIEnv.GetMethodID (klass, ""Exported"", ""()V"");
169170
JNIEnv.CallVoidMethod (foo.Handle, methodId);

0 commit comments

Comments
 (0)