Skip to content

Conversation

@xmcclure
Copy link
Contributor

When the Designer unloads the Monodroid assembly, mono_java_gc_bridge_info continues pointing to data in the now-invalid assembly image. This currently causes a semi-consistent crash in the Designer tests because the appdomain is unloaded and then reloaded, create_domain (which creates the AppDomain managed object, and therefore implicitly depends on mono_java_gc_bridge_info) is called before init_android_runtime (which populates mono_java_gc_bridge_info with the new data).

The solution is to clear mono_java_gc_bridge_info when Monodroid is unloaded. This means all objects will be marked transparent until a new Monodroid is loaded, which is fine because only pure C# objects are being created anyway if Monodroid is unloaded (with one edge case which may still need to be fixed-- see the FIXME comment in this commit).

When the Designer unloads the Monodroid assembly, mono_java_gc_bridge_info continues pointing to data in the now-invalid assembly image. This currently causes a semi-consistent crash in the Designer tests because the appdomain is unloaded and then reloaded, create_domain (which creates the AppDomain managed object, and therefore implicitly depends on mono_java_gc_bridge_info) is called before init_android_runtime (which populates mono_java_gc_bridge_info with the new data).

The solution is to clear mono_java_gc_bridge_info when Monodroid is unloaded. This means all objects will be marked transparent until a new Monodroid is loaded, which is fine because only pure C# objects are being created anyway if Monodroid is unloaded (with one edge case which may still need to be fixed-- see the FIXME comment in this commit).
@dnfclas
Copy link

dnfclas commented Jul 25, 2016

Hi @xmcclure, I'm your friendly neighborhood .NET Foundation Pull Request Bot (You can call me DNFBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!

The agreement was validated by .NET Foundation and real humans are currently evaluating your PR.

TTYL, DNFBOT;

@garuma
Copy link
Contributor

garuma commented Jul 25, 2016

Seems good to me

@xmcclure xmcclure merged commit e813d41 into master Jul 25, 2016
@xmcclure xmcclure deleted the appdomain-unload-crash branch August 9, 2016 18:57
jonpryor added a commit to jonpryor/xamarin-android that referenced this pull request Aug 27, 2021
Context: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1314263

Changes: dotnet/android-tools@efc9b67...9b658b2

  * dotnet/android-tools@9b658b2: Merge pull request dotnet#133 from xamarin/ndk-r23
  * dotnet/android-tools@ff73f92: [build] Use GitInfo to generate $(Version) (dotnet#131)
  * dotnet/android-tools@4c2e36c: [Xamarin.Android.Tools.AndroidSdk] Eclipse Adoptium support (dotnet#132)
  * dotnet/android-tools@eaec4e3: [Xamarin.Android.Tools.AndroidSdk] More Microsoft Dist JDK Support (dotnet#130)
  * dotnet/android-tools@f9c1b0d: [BaseTasks] improve Task settings in AsyncTaskExtensions (dotnet#129)
  * dotnet/android-tools@02f7ae7: [NDK] Properly detect 64-bit NDK
jonpryor added a commit that referenced this pull request Aug 27, 2021
Context: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1314263

Changes: dotnet/android-tools@efc9b67...9b658b2

  * dotnet/android-tools@9b658b2: Merge pull request #133 from xamarin/ndk-r23
  * dotnet/android-tools@ff73f92: [build] Use GitInfo to generate $(Version) (#131)
  * dotnet/android-tools@4c2e36c: [Xamarin.Android.Tools.AndroidSdk] Eclipse Adoptium support (#132)
  * dotnet/android-tools@eaec4e3: [Xamarin.Android.Tools.AndroidSdk] More Microsoft Dist JDK Support (#130)
  * dotnet/android-tools@f9c1b0d: [BaseTasks] improve Task settings in AsyncTaskExtensions (#129)
  * dotnet/android-tools@02f7ae7: [NDK] Properly detect 64-bit NDK
@github-actions github-actions bot locked and limited conversation to collaborators Feb 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants