Skip to content

TypeManager.CreateProxy does not cache constructor reflection #7479

@jeromelaban

Description

@jeromelaban

Android application type

Android for .NET (net6.0-android, etc.)

Affected platform version

.NET 6 and 7

Description

The following piece of code is very expensive when manipulating native objects:

https://github.com/xamarin/xamarin-android/blob/91669a4e489104668fdd07382e40cf070aa559ac/src/Mono.Android/Java.Interop/TypeManager.cs#L327-L348

As there is no caching for getting constructors, in the worst case, twice:

image

Steps to Reproduce

Get ShapeDrawable.Paint in a loop.

Did you find any workaround?

None.

Relevant log output

No response

Metadata

Metadata

Labels

Area: App RuntimeIssues in `libmonodroid.so`.Area: PerformanceIssues with performance.enhancementProposed change to current functionality.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions