I noticed some methods appear when creating a new `.aotprofile` for .NET
MAUI:
void System.Reflection.Emit.RuntimeILGenerator:.ctor (System.Reflection.Module,System.Reflection.Emit.ITokenGenerator,int)
void System.Reflection.Emit.RuntimeILGenerator:BeginCatchBlock (System.Type)
void System.Reflection.Emit.RuntimeILGenerator:Emit (System.Reflection.Emit.OpCode,int)
void System.Reflection.Emit.RuntimeILGenerator:Emit (System.Reflection.Emit.OpCode,System.Reflection.Emit.Label)
void System.Reflection.Emit.RuntimeILGenerator:Emit (System.Reflection.Emit.OpCode,System.Reflection.Emit.LocalBuilder)
void System.Reflection.Emit.RuntimeILGenerator:Emit (System.Reflection.Emit.OpCode,System.Reflection.MethodInfo)
void System.Reflection.Emit.RuntimeILGenerator:Emit (System.Reflection.Emit.OpCode)
We generally don't want S.R.E to run at application startup. This can
happen when `Android.Runtime.JNINativeWrapper:CreateBuiltInDelegate`
doesn't find a match. We fallback to S.R.E in that case.
Running a `dotnet new maui` app w/ .NET 8 Preview 7 logs the message:
08-07 10:01:51.674 16590 16590 D monodroid-assembly: Falling back to System.Reflection.Emit for delegate type '_JniMarshal_PPII_L': IntPtr n_GetClipPath_II(IntPtr, IntPtr, Int32, Int32)
This may also coincide with `AndroidEnableMarshalMethods` being turned
off by default. We would not have seen this log message when it was on.
After this change, we skip the S.R.E code path:
08-07 10:37:23.089 17661 17661 D Mono : AOT NOT FOUND: (wrapper native-to-managed) Android.Runtime.JNINativeWrapper:Wrap_JniMarshal_PPII_L (intptr,intptr,int,int).
We should update the `.aotprofile` in xamarin-android and dotnet/maui
after this change.
To update `JNINativeWrapper.g.tt`:
dotnet tool install -g dotnet-t4
t4 src\Mono.Android\Android.Runtime\JNINativeWrapper.g.tt -o src\Mono.Android\Android.Runtime\JNINativeWrapper.g.cs
Other changes:
* Fixed code formatting, so we don't have empty tabs in output.