Skip to content

monodroid_typemap_java_to_managed is failing #1830

@jonpryor

Description

@jonpryor

When recently profiling Xamarin.Android application startup, we observed lots of string allocations were being performed as part of a Object.GetObject() call:

  1. Object.GetObject() >
  2. TypeManager.CreateInstance() >
  3. TypeManager.GetJavaToManagedType() >
  4. JavaNativeTypeManager.ToCliType
  5. ...

The problem is that (4) should not have happened; the only reason it happens is because the monodroid_typemap_java_to_managed() call is returning NULL, forcing us to hit a fallback path (slow! allocates many strings!):

https://github.com/xamarin/xamarin-android/blob/bb8183c8c16667b18ba9197e78294b17a0af532c/src/Mono.Android/Java.Interop/TypeManager.cs#L208-L210

We need to determine why monodroid_typemap_java_to_managed() is failing.

VS bug #635222

Metadata

Metadata

Assignees

Labels

Area: App RuntimeIssues in `libmonodroid.so`.Area: PerformanceIssues with performance.vs-syncFor internal use only; creates a VSTS "mirror" issue.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions