[release/9.0-staging] [android] Fix crash in method_to_ir by github-actions[bot] · Pull Request #109510 · dotnet/runtime (original) (raw)

Backport of #109381 to release/9.0-staging

/cc @steveisok

Customer Impact

A customer was experiencing intermittent crashes with their android app around mono_method_to_ir. After testing multiple iterations, we found there were times when calls to try_prepare_objaddr_callvirt_optimization contained a null reference to a MonoClass. As a result, the app would crash.

To fix, we made a call to mono_class_from_mono_type_internal to make sure we would get a legit MonoClass.

Regression

[If yes, specify when the regression was introduced. Provide the PR or commit if known.]

Testing

Manual before and after. After app did not crash.

Risk

Low

IMPORTANT: If this backport is for a servicing release, please verify that: