Context: dotnet/roslyn#62832 (comment)
On a recent .NET 7 bump, we found a ~4.5% app size regression related to a new C# 11 delegate feature. I set LangVersion=10 for now to prevent the regression: dotnet/android@938b2cb
Instead of emitting e.g.
staticDelegateGetGetActionBarHandler(){if(cb_getActionBar==null)cb_getActionBar=JNINativeWrapper.CreateDelegate((_JniMarshal_PP_L)n_GetActionBar);returncb_getActionBar;}generator should instead emit:
staticDelegateGetGetActionBarHandler(){if(cb_getActionBar==null)cb_getActionBar=JNINativeWrapper.CreateDelegate(new_JniMarshal_PP_L(n_GetActionBar));returncb_getActionBar;}This should avoid a C#11 "caching method group conversion", allowing Mono.Android.dll assembly size to be ~unchanged between C#10 and C#11.
Workaround
To avoid this size regression, set LangVersion to 10 in your Android bindings project:
<LangVersion>10</LangVersion>
Android bindings projects do not use any features that require C# 11.
Context: dotnet/roslyn#62832 (comment)
On a recent .NET 7 bump, we found a ~4.5% app size regression related to a new C# 11 delegate feature. I set
LangVersion=10for now to prevent the regression: dotnet/android@938b2cbInstead of emitting e.g.
generatorshould instead emit:This should avoid a C#11 "caching method group conversion", allowing
Mono.Android.dllassembly size to be ~unchanged between C#10 and C#11.Workaround
To avoid this size regression, set
LangVersionto10in your Android bindings project:Android bindings projects do not use any features that require C# 11.