Skip to content

Commit

Permalink
[Xamarin.Android.Build.Tasks] Disable LLVM marshal methods (dotnet#9336)
Browse files Browse the repository at this point in the history
Context: dotnet#8253
Context: dotnet#9343

We've had a number of reports about *hangs* when LLVM Marshal Methods
are enabled (see also dotnet#8253), but we had been willing
to accept having LLVM Marshal Methods enabled by default as it helps
improve app startup time.

However, [a customer reported a native crash][0] when LLVM Marshal
Methods are enabled:

> ![Thread Stack Trace][1]

	syscall at line 28 within libc
	__futex_wait_ex(void volatile*, bool, int, bool, timespec const*) at line 144 within libc
	sem_wait at line 108 within libc
	within libmonosgen-2.0.so (Build Id: …)
	within <anonymous:…>

This native crash suggests "something going wrong" within MonoVM.
We find this "scary" enough that we feel it is once again prudent
to disable LLVM Marshal Methods by default in .NET 9, by setting the
default value of `$(AndroidEnableMarshalMethods)`=False.

Even though dotnet#9343 has a potential fix for the hang, we feel that
we're too close to .NET 9 GA to validate in the wild.  This feature
will need to wait for .NET 10.  🙁

To explicitly enable LLVM Marshal Methods, set
`$(AndroidEnableMarshalMethods)`=True in your App `.csproj`.

[0]: https://discord.com/channels/732297728826277939/732297837953679412/1288758900627345463
[1]: https://cdn.discordapp.com/attachments/732297837953679412/1288758900522483712/05F6ED48-2BBA-4FC0-A54F-81BB57606500.png?ex=66f659c1&is=66f50841&hm=8f6f78f283f8c03e9fb37a452ad5d0babaaad3dd4bcc1b4887f4dcf60f651c12&
  • Loading branch information
grendello authored and jonathanpeppers committed Sep 30, 2024
1 parent 1171f8d commit f6f94d0
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
"Size": 3036
},
"classes.dex": {
"Size": 22488
"Size": 389672
},
"lib/arm64-v8a/lib__Microsoft.Android.Resource.Designer.dll.so": {
"Size": 1114
},
"lib/arm64-v8a/lib_Java.Interop.dll.so": {
"Size": 69279
"Size": 86256
},
"lib/arm64-v8a/lib_Mono.Android.dll.so": {
"Size": 98660
"Size": 115344
},
"lib/arm64-v8a/lib_Mono.Android.Runtime.dll.so": {
"Size": 5315
"Size": 22400
},
"lib/arm64-v8a/lib_System.Console.dll.so": {
"Size": 7294
Expand All @@ -26,7 +26,7 @@
"Size": 9390
},
"lib/arm64-v8a/lib_System.Private.CoreLib.dll.so": {
"Size": 616700
"Size": 633920
},
"lib/arm64-v8a/lib_System.Runtime.dll.so": {
"Size": 2956
Expand All @@ -44,7 +44,7 @@
"Size": 87432
},
"lib/arm64-v8a/libmonodroid.so": {
"Size": 484920
"Size": 485400
},
"lib/arm64-v8a/libmonosgen-2.0.so": {
"Size": 3196336
Expand All @@ -62,10 +62,10 @@
"Size": 160232
},
"lib/arm64-v8a/libxamarin-app.so": {
"Size": 17912
"Size": 12648
},
"META-INF/BNDLTOOL.RSA": {
"Size": 1221
"Size": 1223
},
"META-INF/BNDLTOOL.SF": {
"Size": 3266
Expand Down Expand Up @@ -98,5 +98,5 @@
"Size": 1904
}
},
"PackageSize": 2783765
"PackageSize": 2865685
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
"Size": 6652
},
"classes.dex": {
"Size": 9172800
"Size": 9448924
},
"classes2.dex": {
"Size": 154180
},
"kotlin/annotation/annotation.kotlin_builtins": {
"Size": 928
Expand All @@ -32,25 +35,25 @@
"Size": 2363
},
"lib/arm64-v8a/lib_FormsViewGroup.dll.so": {
"Size": 8330
"Size": 25184
},
"lib/arm64-v8a/lib_Java.Interop.dll.so": {
"Size": 77673
"Size": 94640
},
"lib/arm64-v8a/lib_Mono.Android.dll.so": {
"Size": 506473
"Size": 521824
},
"lib/arm64-v8a/lib_Mono.Android.Runtime.dll.so": {
"Size": 5315
"Size": 22400
},
"lib/arm64-v8a/lib_mscorlib.dll.so": {
"Size": 4344
"Size": 21440
},
"lib/arm64-v8a/lib_netstandard.dll.so": {
"Size": 5985
},
"lib/arm64-v8a/lib_System.Collections.Concurrent.dll.so": {
"Size": 12714
"Size": 29800
},
"lib/arm64-v8a/lib_System.Collections.dll.so": {
"Size": 19198
Expand All @@ -65,13 +68,13 @@
"Size": 2496
},
"lib/arm64-v8a/lib_System.ComponentModel.Primitives.dll.so": {
"Size": 4212
"Size": 21296
},
"lib/arm64-v8a/lib_System.ComponentModel.TypeConverter.dll.so": {
"Size": 25362
"Size": 42448
},
"lib/arm64-v8a/lib_System.Console.dll.so": {
"Size": 7331
"Size": 24416
},
"lib/arm64-v8a/lib_System.Core.dll.so": {
"Size": 2365
Expand All @@ -80,7 +83,7 @@
"Size": 11349
},
"lib/arm64-v8a/lib_System.Diagnostics.TraceSource.dll.so": {
"Size": 7601
"Size": 24688
},
"lib/arm64-v8a/lib_System.dll.so": {
"Size": 2765
Expand All @@ -95,7 +98,7 @@
"Size": 32843
},
"lib/arm64-v8a/lib_System.IO.Compression.Brotli.dll.so": {
"Size": 12393
"Size": 29480
},
"lib/arm64-v8a/lib_System.IO.Compression.dll.so": {
"Size": 16696
Expand All @@ -107,13 +110,13 @@
"Size": 21645
},
"lib/arm64-v8a/lib_System.Linq.Expressions.dll.so": {
"Size": 168722
"Size": 185808
},
"lib/arm64-v8a/lib_System.Net.Http.dll.so": {
"Size": 72400
"Size": 89496
},
"lib/arm64-v8a/lib_System.Net.Primitives.dll.so": {
"Size": 24022
"Size": 41120
},
"lib/arm64-v8a/lib_System.Net.Requests.dll.so": {
"Size": 4461
Expand All @@ -122,19 +125,19 @@
"Size": 9981
},
"lib/arm64-v8a/lib_System.Private.CoreLib.dll.so": {
"Size": 939274
"Size": 956408
},
"lib/arm64-v8a/lib_System.Private.DataContractSerialization.dll.so": {
"Size": 199596
},
"lib/arm64-v8a/lib_System.Private.Uri.dll.so": {
"Size": 45095
"Size": 62192
},
"lib/arm64-v8a/lib_System.Private.Xml.dll.so": {
"Size": 220007
"Size": 237104
},
"lib/arm64-v8a/lib_System.Private.Xml.Linq.dll.so": {
"Size": 18497
"Size": 35584
},
"lib/arm64-v8a/lib_System.Runtime.dll.so": {
"Size": 3111
Expand All @@ -143,22 +146,22 @@
"Size": 4502
},
"lib/arm64-v8a/lib_System.Runtime.Numerics.dll.so": {
"Size": 37312
"Size": 54408
},
"lib/arm64-v8a/lib_System.Runtime.Serialization.dll.so": {
"Size": 2265
"Size": 19352
},
"lib/arm64-v8a/lib_System.Runtime.Serialization.Formatters.dll.so": {
"Size": 3243
},
"lib/arm64-v8a/lib_System.Runtime.Serialization.Primitives.dll.so": {
"Size": 4361
"Size": 21448
},
"lib/arm64-v8a/lib_System.Security.Cryptography.dll.so": {
"Size": 63408
"Size": 80504
},
"lib/arm64-v8a/lib_System.Text.RegularExpressions.dll.so": {
"Size": 166506
"Size": 183592
},
"lib/arm64-v8a/lib_System.Xml.dll.so": {
"Size": 2167
Expand All @@ -170,31 +173,31 @@
"Size": 5007
},
"lib/arm64-v8a/lib_Xamarin.AndroidX.Activity.dll.so": {
"Size": 17872
"Size": 34760
},
"lib/arm64-v8a/lib_Xamarin.AndroidX.AppCompat.AppCompatResources.dll.so": {
"Size": 7425
"Size": 24296
},
"lib/arm64-v8a/lib_Xamarin.AndroidX.AppCompat.dll.so": {
"Size": 146152
"Size": 163072
},
"lib/arm64-v8a/lib_Xamarin.AndroidX.CardView.dll.so": {
"Size": 7469
},
"lib/arm64-v8a/lib_Xamarin.AndroidX.CoordinatorLayout.dll.so": {
"Size": 18823
"Size": 35680
},
"lib/arm64-v8a/lib_Xamarin.AndroidX.Core.dll.so": {
"Size": 134318
"Size": 151216
},
"lib/arm64-v8a/lib_Xamarin.AndroidX.CursorAdapter.dll.so": {
"Size": 10076
},
"lib/arm64-v8a/lib_Xamarin.AndroidX.DrawerLayout.dll.so": {
"Size": 16856
"Size": 33760
},
"lib/arm64-v8a/lib_Xamarin.AndroidX.Fragment.dll.so": {
"Size": 55435
"Size": 72224
},
"lib/arm64-v8a/lib_Xamarin.AndroidX.Legacy.Support.Core.UI.dll.so": {
"Size": 6806
Expand All @@ -212,16 +215,16 @@
"Size": 14499
},
"lib/arm64-v8a/lib_Xamarin.AndroidX.RecyclerView.dll.so": {
"Size": 95162
"Size": 111896
},
"lib/arm64-v8a/lib_Xamarin.AndroidX.SavedState.dll.so": {
"Size": 6050
},
"lib/arm64-v8a/lib_Xamarin.AndroidX.SwipeRefreshLayout.dll.so": {
"Size": 14858
"Size": 31672
},
"lib/arm64-v8a/lib_Xamarin.AndroidX.ViewPager.dll.so": {
"Size": 20961
"Size": 37752
},
"lib/arm64-v8a/lib_Xamarin.Forms.Core.dll.so": {
"Size": 563905
Expand All @@ -236,7 +239,7 @@
"Size": 63542
},
"lib/arm64-v8a/lib_Xamarin.Google.Android.Material.dll.so": {
"Size": 67675
"Size": 84400
},
"lib/arm64-v8a/libarc.bin.so": {
"Size": 1685
Expand All @@ -245,7 +248,7 @@
"Size": 87432
},
"lib/arm64-v8a/libmonodroid.so": {
"Size": 484920
"Size": 485400
},
"lib/arm64-v8a/libmonosgen-2.0.so": {
"Size": 3196336
Expand All @@ -263,7 +266,7 @@
"Size": 160232
},
"lib/arm64-v8a/libxamarin-app.so": {
"Size": 349352
"Size": 119928
},
"META-INF/androidx.activity_activity.version": {
"Size": 6
Expand Down Expand Up @@ -419,7 +422,7 @@
"Size": 1223
},
"META-INF/BNDLTOOL.SF": {
"Size": 98577
"Size": 98661
},
"META-INF/com.android.tools/proguard/coroutines.pro": {
"Size": 1345
Expand All @@ -446,7 +449,7 @@
"Size": 5
},
"META-INF/MANIFEST.MF": {
"Size": 98450
"Size": 98534
},
"META-INF/maven/com.google.guava/listenablefuture/pom.properties": {
"Size": 96
Expand Down Expand Up @@ -2486,5 +2489,5 @@
"Size": 812848
}
},
"PackageSize": 10579211
"PackageSize": 10673477
}
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ Copyright (C) 2011-2012 Xamarin. All rights reserved.
<AndroidUseAssemblyStore Condition=" '$(AndroidUseAssemblyStore)' == '' ">true</AndroidUseAssemblyStore>
<AndroidAotEnableLazyLoad Condition=" '$(AndroidAotEnableLazyLoad)' == '' And '$(AotAssemblies)' == 'true' And '$(AndroidIncludeDebugSymbols)' != 'true' ">True</AndroidAotEnableLazyLoad>
<AndroidEnableMarshalMethods Condition=" '$(AndroidEnableMarshalMethods)' == '' and ('$(UsingMicrosoftNETSdkRazor)' == 'true') ">False</AndroidEnableMarshalMethods>
<AndroidEnableMarshalMethods Condition=" '$(AndroidEnableMarshalMethods)' == '' ">True</AndroidEnableMarshalMethods>
<AndroidEnableMarshalMethods Condition=" '$(AndroidEnableMarshalMethods)' == '' ">False</AndroidEnableMarshalMethods>
<_AndroidUseMarshalMethods Condition=" '$(AndroidIncludeDebugSymbols)' == 'True' ">False</_AndroidUseMarshalMethods>
<_AndroidUseMarshalMethods Condition=" '$(AndroidIncludeDebugSymbols)' != 'True' ">$(AndroidEnableMarshalMethods)</_AndroidUseMarshalMethods>
</PropertyGroup>
Expand Down

0 comments on commit f6f94d0

Please sign in to comment.