dotnet / android

.NET for Android provides open-source bindings of the Android SDK for use with .NET managed languages such as C#
MIT License
1.93k stars 530 forks source link

Startup crash F# AOT on Android #9185

Open kerams opened 5 months ago

kerams commented 5 months ago

Description

I could swear this worked as soon as I installed 9.0.100-preview.4.24267.66 (as mentioned in https://github.com/dotnet/runtime/issues/102166), but now a minimal F# Android application on .NET 9 crashes reliably across ABIs.

Reproduction Steps

dotnet new install Avalonia.Templates
dotnet new avalonia.xplat -lang F# -o TstFs

Change TFM to net9.0-android and add

<PropertyGroup Condition="'$(Configuration)'=='Release'">
  <PublishTrimmed>True</PublishTrimmed>
  <TrimMode>partial</TrimMode>
  <RunAOTCompilation>True</RunAOTCompilation>
</PropertyGroup>

Run in Release mode either in x64 emulator or on an arm64 device.

Expected behavior

Applications launches.

Actual behavior

Crashes on the splash screen.

Regression?

Yes, works with SDK 9.0.100-preview.2.24157.14 or TFM net8.0-android.

Known Workarounds

No response

Configuration

9.0.100-preview.4.24267.66 Win 11

Other information

No response

ivanpovazan commented 5 months ago

/cc @steveisok the customer seems to be hitting similar problem as reported previously in: https://github.com/dotnet/runtime/issues/102166

steveisok commented 5 months ago

@ivanpovazan it's not yet clear this is a runtime issue. It seems like there's something missing. More investigation is needed to pin it down.

ivanpovazan commented 5 months ago

@jkurdek @matouskozak can one of you try to reproduce the issue and report the findings?

simonrozsival commented 4 months ago

I can reproduce the startup crash in P5, it seems to be the same as dotnet/runtime#102166:

--------- beginning of crash
07-03 12:15:05.924 18213 18213 F libc    : Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x234 in tid 18213 (mpanyName.TstFs), pid 18213 (mpanyName.TstFs)
07-03 12:15:06.195 18237 18237 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
07-03 12:15:06.195 18237 18237 F DEBUG   : Build fingerprint: 'google/sdk_gphone64_arm64/emu64a:13/TE1A.220922.012/9302419:user/release-keys'
07-03 12:15:06.195 18237 18237 F DEBUG   : Revision: '0'
07-03 12:15:06.195 18237 18237 F DEBUG   : ABI: 'arm64'
07-03 12:15:06.195 18237 18237 F DEBUG   : Timestamp: 2024-07-03 12:15:05.949864140+0200
07-03 12:15:06.195 18237 18237 F DEBUG   : Process uptime: 1s
07-03 12:15:06.195 18237 18237 F DEBUG   : Cmdline: com.CompanyName.TstFs
07-03 12:15:06.195 18237 18237 F DEBUG   : pid: 18213, tid: 18213, name: mpanyName.TstFs  >>> com.CompanyName.TstFs <<<
07-03 12:15:06.195 18237 18237 F DEBUG   : uid: 10164
07-03 12:15:06.195 18237 18237 F DEBUG   : tagged_addr_ctrl: 0000000000000001 (PR_TAGGED_ADDR_ENABLE)
07-03 12:15:06.195 18237 18237 F DEBUG   : pac_enabled_keys: 000000000000000f (PR_PAC_APIAKEY, PR_PAC_APIBKEY, PR_PAC_APDAKEY, PR_PAC_APDBKEY)
07-03 12:15:06.195 18237 18237 F DEBUG   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0000000000000234
07-03 12:15:06.195 18237 18237 F DEBUG   : Cause: null pointer dereference
07-03 12:15:06.195 18237 18237 F DEBUG   :     x0  0000000000000000  x1  0000007d6040a54c  x2  0000007d6040a54c  x3  0000007ffcdec6b8
07-03 12:15:06.195 18237 18237 F DEBUG   :     x4  0000000000000080  x5  b400007b307644a0  x6  6f6e20646c756f43  x7  7320646e69662074
07-03 12:15:06.195 18237 18237 F DEBUG   :     x8  0000000000000234  x9  b400007c007176b0  x10 0000000000000090  x11 000000000000000d
07-03 12:15:06.195 18237 18237 F DEBUG   :     x12 0000000000006635  x13 6f6d203a6c6f626d  x14 0000000000000000  x15 0000007d6035c662
07-03 12:15:06.195 18237 18237 F DEBUG   :     x16 0000000000000001  x17 0000007d60374fc0  x18 0000007d81726000  x19 b400007b40706890
07-03 12:15:06.195 18237 18237 F DEBUG   :     x20 b400007b6071df30  x21 b400007b30764450  x22 b400007af072a0d0  x23 0000000000000000
07-03 12:15:06.195 18237 18237 F DEBUG   :     x24 b400007ad06fedf0  x25 b400007b407068a0  x26 0000007a42ead922  x27 0000007a43d879d4
07-03 12:15:06.195 18237 18237 F DEBUG   :     x28 b400007ad06ff1f0  x29 0000007ffcdec840
07-03 12:15:06.195 18237 18237 F DEBUG   :     lr  0000007a43bc1968  sp  0000007ffcdec7b0  pc  0000007a43bc1974  pst 0000000060001000
07-03 12:15:06.195 18237 18237 F DEBUG   : backtrace:
07-03 12:15:06.195 18237 18237 F DEBUG   :       #00 pc 000000000013c974  /data/app/~~pkHUWRiAim8NguWDJ_dDbw==/com.CompanyName.TstFs-bheh280n667ckNdNip2fFw==/lib/arm64/libmonosgen-2.0.so (BuildId: d9a5ed7a80e9461ccb069853eda5e09f2423f875)
07-03 12:15:06.195 18237 18237 F DEBUG   :       dotnet/runtime#1 pc 00000000002023e4  /data/app/~~pkHUWRiAim8NguWDJ_dDbw==/com.CompanyName.TstFs-bheh280n667ckNdNip2fFw==/lib/arm64/libmonosgen-2.0.so (BuildId: d9a5ed7a80e9461ccb069853eda5e09f2423f875)
07-03 12:15:06.195 18237 18237 F DEBUG   :       dotnet/runtime#2 pc 000000000020310c  /data/app/~~pkHUWRiAim8NguWDJ_dDbw==/com.CompanyName.TstFs-bheh280n667ckNdNip2fFw==/lib/arm64/libmonosgen-2.0.so (BuildId: d9a5ed7a80e9461ccb069853eda5e09f2423f875)
07-03 12:15:06.195 18237 18237 F DEBUG   :       dotnet/runtime#3 pc 00000000002045e8  /data/app/~~pkHUWRiAim8NguWDJ_dDbw==/com.CompanyName.TstFs-bheh280n667ckNdNip2fFw==/lib/arm64/libmonosgen-2.0.so (mono_assembly_load_from_full+116) (BuildId: d9a5ed7a80e9461ccb069853eda5e09f2423f875)
07-03 12:15:06.195 18237 18237 F DEBUG   :       dotnet/runtime#4 pc 0000000000020214  /data/app/~~pkHUWRiAim8NguWDJ_dDbw==/com.CompanyName.TstFs-bheh280n667ckNdNip2fFw==/lib/arm64/libmonodroid.so (xamarin::android::internal::EmbeddedAssemblies::open_from_bundles(void*, _MonoAssemblyName*, char**, void*, _MonoError*)+8320) (BuildId: e0e3a796d36113f23ec230f7d86baf1d69959d30)
07-03 12:15:06.195 18237 18237 F DEBUG   :       dotnet/runtime#5 pc 0000000000204d14  /data/app/~~pkHUWRiAim8NguWDJ_dDbw==/com.CompanyName.TstFs-bheh280n667ckNdNip2fFw==/lib/arm64/libmonosgen-2.0.so (BuildId: d9a5ed7a80e9461ccb069853eda5e09f2423f875)
07-03 12:15:06.195 18237 18237 F DEBUG   :       dotnet/runtime#6 pc 0000000000202200  /data/app/~~pkHUWRiAim8NguWDJ_dDbw==/com.CompanyName.TstFs-bheh280n667ckNdNip2fFw==/lib/arm64/libmonosgen-2.0.so (mono_assembly_request_byname+972) (BuildId: d9a5ed7a80e9461ccb069853eda5e09f2423f875)
07-03 12:15:06.195 18237 18237 F DEBUG   :       dotnet/runtime#7 pc 0000000000201be4  /data/app/~~pkHUWRiAim8NguWDJ_dDbw==/com.CompanyName.TstFs-bheh280n667ckNdNip2fFw==/lib/arm64/libmonosgen-2.0.so (mono_assembly_load_reference+468) (BuildId: d9a5ed7a80e9461ccb069853eda5e09f2423f875)
07-03 12:15:06.195 18237 18237 F DEBUG   :       dotnet/runtime#8 pc 0000000000207228  /data/app/~~pkHUWRiAim8NguWDJ_dDbw==/com.CompanyName.TstFs-bheh280n667ckNdNip2fFw==/lib/arm64/libmonosgen-2.0.so (mono_class_from_typeref_checked+480) (BuildId: d9a5ed7a80e9461ccb069853eda5e09f2423f875)
07-03 12:15:06.195 18237 18237 F DEBUG   :       dotnet/runtime#9 pc 000000000020b5f0  /data/app/~~pkHUWRiAim8NguWDJ_dDbw==/com.CompanyName.TstFs-bheh280n667ckNdNip2fFw==/lib/arm64/libmonosgen-2.0.so (mono_class_get_checked+188) (BuildId: d9a5ed7a80e9461ccb069853eda5e09f2423f875)
07-03 12:15:06.195 18237 18237 F DEBUG   :       dotnet/runtime#10 pc 00000000002557dc  /data/app/~~pkHUWRiAim8NguWDJ_dDbw==/com.CompanyName.TstFs-bheh280n667ckNdNip2fFw==/lib/arm64/libmonosgen-2.0.so (BuildId: d9a5ed7a80e9461ccb069853eda5e09f2423f875)
07-03 12:15:06.195 18237 18237 F DEBUG   :       dotnet/runtime#11 pc 000000000020e8f8  /data/app/~~pkHUWRiAim8NguWDJ_dDbw==/com.CompanyName.TstFs-bheh280n667ckNdNip2fFw==/lib/arm64/libmonosgen-2.0.so (mono_field_resolve_type+680) (BuildId: d9a5ed7a80e9461ccb069853eda5e09f2423f875)
07-03 12:15:06.195 18237 18237 F DEBUG   :       dotnet/runtime#12 pc 0000000000211870  /data/app/~~pkHUWRiAim8NguWDJ_dDbw==/com.CompanyName.TstFs-bheh280n667ckNdNip2fFw==/lib/arm64/libmonosgen-2.0.so (BuildId: d9a5ed7a80e9461ccb069853eda5e09f2423f875)
07-03 12:15:06.195 18237 18237 F DEBUG   :       dotnet/runtime#13 pc 000000000020a9c8  /data/app/~~pkHUWRiAim8NguWDJ_dDbw==/com.CompanyName.TstFs-bheh280n667ckNdNip2fFw==/lib/arm64/libmonosgen-2.0.so (mono_class_data_size+68) (BuildId: d9a5ed7a80e9461ccb069853eda5e09f2423f875)
07-03 12:15:06.195 18237 18237 F DEBUG   :       dotnet/runtime#14 pc 00000000002683e0  /data/app/~~pkHUWRiAim8NguWDJ_dDbw==/com.CompanyName.TstFs-bheh280n667ckNdNip2fFw==/lib/arm64/libmonosgen-2.0.so (BuildId: d9a5ed7a80e9461ccb069853eda5e09f2423f875)
07-03 12:15:06.195 18237 18237 F DEBUG   :       dotnet/runtime#15 pc 00000000000c3bf8  /data/app/~~pkHUWRiAim8NguWDJ_dDbw==/com.CompanyName.TstFs-bheh280n667ckNdNip2fFw==/lib/arm64/libmonosgen-2.0.so (BuildId: d9a5ed7a80e9461ccb069853eda5e09f2423f875)
07-03 12:15:06.195 18237 18237 F DEBUG   :       dotnet/runtime#16 pc 0000000000141688  /data/app/~~pkHUWRiAim8NguWDJ_dDbw==/com.CompanyName.TstFs-bheh280n667ckNdNip2fFw==/lib/arm64/libmonosgen-2.0.so (BuildId: d9a5ed7a80e9461ccb069853eda5e09f2423f875)
07-03 12:15:06.195 18237 18237 F DEBUG   :       dotnet/runtime#17 pc 00000000001429bc  /data/app/~~pkHUWRiAim8NguWDJ_dDbw==/com.CompanyName.TstFs-bheh280n667ckNdNip2fFw==/lib/arm64/libmonosgen-2.0.so (BuildId: d9a5ed7a80e9461ccb069853eda5e09f2423f875)
07-03 12:15:06.195 18237 18237 F DEBUG   :       dotnet/runtime#18 pc 000000000015651c  /data/app/~~pkHUWRiAim8NguWDJ_dDbw==/com.CompanyName.TstFs-bheh280n667ckNdNip2fFw==/lib/arm64/libmonosgen-2.0.so (BuildId: d9a5ed7a80e9461ccb069853eda5e09f2423f875)
07-03 12:15:06.195 18237 18237 F DEBUG   :       dotnet/runtime#19 pc 0000000000004be8  <anonymous:7d6dde4000>

I noticed that the template crashes on startup as is (with just the TFM changed to net9.0-android).

I have also tried to run a MAUI app written in F# and it doesn't crash on startup.

kerams commented 4 months ago

For what it's worth, AOT seems to work in Debug mode, so some Release configuration optimization introduced in SDK Preview 3 (something similar to AndroidEnableMarshalMethods, which has given me a lot of grief recently) could be causing this.

matouskozak commented 4 months ago

This issue looks similar to https://github.com/dotnet/android/issues/9153 where only Release config is crashing and the crash log (https://github.com/dotnet/android/issues/9153) is similar to what you got @simonrozsival at https://github.com/dotnet/android/issues/9185

matouskozak commented 3 months ago

@kerams are you build your app on Windows or Mac? I was able to reproduce the crash only when build on Windows machine and only in Release mode. Also as mentioned in https://github.com/dotnet/android/issues/9185, the template Avalonia F# app crashes on startup just with the TFM change to net9.

Based on the error log, the template app seems to fail when loading the SkiaSharp library. This looks related to the SkiaSharp failures in https://github.com/dotnet/android/issues/9153 and possibly https://github.com/dotnet/android/issues/9151 (Windows and Release only crash). What do you think @grendello @jonathanpeppers ?

07-31 18:29:18.012 23704 23704 D Mono    : Loading assembly SkiaSharp (0x7c9e58e80af0) into domain RootDomain (0x7c9de8e55170) and ALC 0x7c9d68e9e390
07-31 18:29:18.012 23704 23704 D Mono    : Assembly SkiaSharp[0x7c9e58e80af0] added to ALC '(null)'[0x7c9d68e9e390], ref_count=1
07-31 18:29:18.020 23704 23704 D monodroid-assembly: monodroid_dlopen: hash for name 'SkiaSharp.so' is 0x12e73d483788709d
07-31 18:29:18.020 23704 23704 D monodroid-assembly: monodroid_dlopen: hash match found, DSO name is 'libSkiaSharp.so'
07-31 18:29:18.020 23704 23704 I monodroid-assembly: Trying to load shared library '/data/app/~~OCNwFAaxFio1yAGZVXnSJQ==/com.CompanyName.AndroidFSharpReleaseCrash-QrBpZyME9O5j9zeh4ow2ZQ==/lib/x86_64/libSkiaSharp.so'
--------- beginning of crash
07-31 18:29:18.027 23704 23704 F libc    : Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x234 in tid 23704 (arpReleaseCrash), pid 23704 (arpReleaseCrash)
07-31 18:29:18.092 23726 23726 E crash_dump64: failed to get the guest state header for thread 23704: Bad address
07-31 18:29:18.094 23726 23726 E crash_dump64: failed to get the guest state header for thread 23705: Bad address
07-31 18:29:18.096 23726 23726 E crash_dump64: failed to get the guest state header for thread 23706: Bad address
07-31 18:29:18.102 23726 23726 E crash_dump64: failed to get the guest state header for thread 23707: Bad address
07-31 18:29:18.103 23726 23726 E crash_dump64: failed to get the guest state header for thread 23708: Bad address
07-31 18:29:18.103 23726 23726 E crash_dump64: failed to get the guest state header for thread 23709: Bad address
07-31 18:29:18.112 23726 23726 E crash_dump64: failed to get the guest state header for thread 23710: Bad address
07-31 18:29:18.113 23726 23726 E crash_dump64: failed to get the guest state header for thread 23711: Bad address
07-31 18:29:18.113 23726 23726 E crash_dump64: failed to get the guest state header for thread 23712: Bad address
07-31 18:29:18.120 23726 23726 E crash_dump64: failed to get the guest state header for thread 23713: Bad address
07-31 18:29:18.127 23726 23726 E crash_dump64: failed to get the guest state header for thread 23715: Bad address
07-31 18:29:18.128 23726 23726 E crash_dump64: failed to get the guest state header for thread 23717: Bad address
07-31 18:29:18.142 23726 23726 E crash_dump64: failed to get the guest state header for thread 23718: Bad address
07-31 18:29:18.143 23726 23726 E crash_dump64: failed to get the guest state header for thread 23721: Bad address
07-31 18:29:18.176 23726 23726 I crash_dump64: obtaining output fd from tombstoned, type: kDebuggerdTombstoneProto
07-31 18:29:18.178   220   220 I tombstoned: received crash request for pid 23704
07-31 18:29:18.191 23726 23726 I crash_dump64: performing dump of process 23704 (target tid = 23704)
07-31 18:29:18.348 23726 23726 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
07-31 18:29:18.348 23726 23726 F DEBUG   : Build fingerprint: 'google/sdk_gphone64_x86_64/emu64xa:15/AP31.240617.003/12088229:user/release-keys'
07-31 18:29:18.348 23726 23726 F DEBUG   : Revision: '0'
07-31 18:29:18.348 23726 23726 F DEBUG   : ABI: 'x86_64'
07-31 18:29:18.348 23726 23726 F DEBUG   : Timestamp: 2024-07-31 18:29:18.208315300+0200
07-31 18:29:18.348 23726 23726 F DEBUG   : Process uptime: 6s
07-31 18:29:18.348 23726 23726 F DEBUG   : Cmdline: com.CompanyName.AndroidFSharpReleaseCrash
07-31 18:29:18.348 23726 23726 F DEBUG   : pid: 23704, tid: 23704, name: arpReleaseCrash  >>> com.CompanyName.AndroidFSharpReleaseCrash <<<
07-31 18:29:18.348 23726 23726 F DEBUG   : uid: 10215
07-31 18:29:18.348 23726 23726 F DEBUG   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0000000000000234
07-31 18:29:18.348 23726 23726 F DEBUG   : Cause: null pointer dereference
07-31 18:29:18.348 23726 23726 F DEBUG   :     rax 0000000000000000  rbx 00007c9d28e843d0  rcx 00007c9d18ec75b0  rdx 00007c9f439749c0
07-31 18:29:18.348 23726 23726 F DEBUG   :     r8  0000000000000080  r9  0000000000080007  r10 99a9000000080007  r11 00007c9f78167224
07-31 18:29:18.348 23726 23726 F DEBUG   :     r12 00007c9e48e76cf0  r13 00007c9e58e80af0  r14 00007c9d68e9e390  r15 00007ffee8f62898
07-31 18:29:18.348 23726 23726 F DEBUG   :     rdi 0000000000000000  rsi 000000000000000a
07-31 18:29:18.349 23726 23726 F DEBUG   :     rbp 0000000000000000  rsp 00007ffee8f627b0  rip 00007c9c19f6e48b
07-31 18:29:18.349 23726 23726 F DEBUG   : 20 total frames
07-31 18:29:18.349 23726 23726 F DEBUG   : backtrace:
07-31 18:29:18.349 23726 23726 F DEBUG   :       #00 pc 000000000016548b  /data/app/~~OCNwFAaxFio1yAGZVXnSJQ==/com.CompanyName.AndroidFSharpReleaseCrash-QrBpZyME9O5j9zeh4ow2ZQ==/lib/x86_64/libmonosgen-2.0.so (BuildId: 0a959315e0893aa7c032cbb6482832586a5811fb)
07-31 18:29:18.349 23726 23726 F DEBUG   :       dotnet/runtime#1 pc 00000000002497a6  /data/app/~~OCNwFAaxFio1yAGZVXnSJQ==/com.CompanyName.AndroidFSharpReleaseCrash-QrBpZyME9O5j9zeh4ow2ZQ==/lib/x86_64/libmonosgen-2.0.so (BuildId: 0a959315e0893aa7c032cbb6482832586a5811fb)
07-31 18:29:18.349 23726 23726 F DEBUG   :       dotnet/runtime#2 pc 000000000024a573  /data/app/~~OCNwFAaxFio1yAGZVXnSJQ==/com.CompanyName.AndroidFSharpReleaseCrash-QrBpZyME9O5j9zeh4ow2ZQ==/lib/x86_64/libmonosgen-2.0.so (BuildId: 0a959315e0893aa7c032cbb6482832586a5811fb)
07-31 18:29:18.349 23726 23726 F DEBUG   :       dotnet/runtime#3 pc 000000000024bbf1  /data/app/~~OCNwFAaxFio1yAGZVXnSJQ==/com.CompanyName.AndroidFSharpReleaseCrash-QrBpZyME9O5j9zeh4ow2ZQ==/lib/x86_64/libmonosgen-2.0.so (mono_assembly_load_from_full+129) (BuildId: 0a959315e0893aa7c032cbb6482832586a5811fb)
07-31 18:29:18.349 23726 23726 F DEBUG   :       dotnet/runtime#4 pc 000000000001fa1b  /data/app/~~OCNwFAaxFio1yAGZVXnSJQ==/com.CompanyName.AndroidFSharpReleaseCrash-QrBpZyME9O5j9zeh4ow2ZQ==/lib/x86_64/libmonodroid.so (xamarin::android::internal::EmbeddedAssemblies::open_from_bundles(void*, _MonoAssemblyName*, char**, void*, _MonoError*)+8347) (BuildId: bb24bad2340bfc0616b810f2f7ee15d4d085676a)
07-31 18:29:18.349 23726 23726 F DEBUG   :       dotnet/runtime#5 pc 000000000024c3a3  /data/app/~~OCNwFAaxFio1yAGZVXnSJQ==/com.CompanyName.AndroidFSharpReleaseCrash-QrBpZyME9O5j9zeh4ow2ZQ==/lib/x86_64/libmonosgen-2.0.so (BuildId: 0a959315e0893aa7c032cbb6482832586a5811fb)
07-31 18:29:18.349 23726 23726 F DEBUG   :       dotnet/runtime#6 pc 00000000002495b9  /data/app/~~OCNwFAaxFio1yAGZVXnSJQ==/com.CompanyName.AndroidFSharpReleaseCrash-QrBpZyME9O5j9zeh4ow2ZQ==/lib/x86_64/libmonosgen-2.0.so (mono_assembly_request_byname+1177) (BuildId: 0a959315e0893aa7c032cbb6482832586a5811fb)
07-31 18:29:18.349 23726 23726 F DEBUG   :       dotnet/runtime#7 pc 0000000000248e64  /data/app/~~OCNwFAaxFio1yAGZVXnSJQ==/com.CompanyName.AndroidFSharpReleaseCrash-QrBpZyME9O5j9zeh4ow2ZQ==/lib/x86_64/libmonosgen-2.0.so (mono_assembly_load_reference+564) (BuildId: 0a959315e0893aa7c032cbb6482832586a5811fb)
07-31 18:29:18.349 23726 23726 F DEBUG   :       dotnet/runtime#8 pc 000000000024e8e3  /data/app/~~OCNwFAaxFio1yAGZVXnSJQ==/com.CompanyName.AndroidFSharpReleaseCrash-QrBpZyME9O5j9zeh4ow2ZQ==/lib/x86_64/libmonosgen-2.0.so (mono_class_from_typeref_checked+499) (BuildId: 0a959315e0893aa7c032cbb6482832586a5811fb)
07-31 18:29:18.349 23726 23726 F DEBUG   :       dotnet/runtime#9 pc 0000000000252b44  /data/app/~~OCNwFAaxFio1yAGZVXnSJQ==/com.CompanyName.AndroidFSharpReleaseCrash-QrBpZyME9O5j9zeh4ow2ZQ==/lib/x86_64/libmonosgen-2.0.so (mono_class_get_checked+164) (BuildId: 0a959315e0893aa7c032cbb6482832586a5811fb)
07-31 18:29:18.349 23726 23726 F DEBUG   :       dotnet/runtime#10 pc 000000000029dbfb  /data/app/~~OCNwFAaxFio1yAGZVXnSJQ==/com.CompanyName.AndroidFSharpReleaseCrash-QrBpZyME9O5j9zeh4ow2ZQ==/lib/x86_64/libmonosgen-2.0.so (BuildId: 0a959315e0893aa7c032cbb6482832586a5811fb)
07-31 18:29:18.349 23726 23726 F DEBUG   :       dotnet/runtime#11 pc 0000000000255f6a  /data/app/~~OCNwFAaxFio1yAGZVXnSJQ==/com.CompanyName.AndroidFSharpReleaseCrash-QrBpZyME9O5j9zeh4ow2ZQ==/lib/x86_64/libmonosgen-2.0.so (mono_field_resolve_type+778) (BuildId: 0a959315e0893aa7c032cbb6482832586a5811fb)
07-31 18:29:18.349 23726 23726 F DEBUG   :       dotnet/runtime#12 pc 0000000000259392  /data/app/~~OCNwFAaxFio1yAGZVXnSJQ==/com.CompanyName.AndroidFSharpReleaseCrash-QrBpZyME9O5j9zeh4ow2ZQ==/lib/x86_64/libmonosgen-2.0.so (BuildId: 0a959315e0893aa7c032cbb6482832586a5811fb)
07-31 18:29:18.349 23726 23726 F DEBUG   :       dotnet/runtime#13 pc 0000000000251f0f  /data/app/~~OCNwFAaxFio1yAGZVXnSJQ==/com.CompanyName.AndroidFSharpReleaseCrash-QrBpZyME9O5j9zeh4ow2ZQ==/lib/x86_64/libmonosgen-2.0.so (mono_class_data_size+31) (BuildId: 0a959315e0893aa7c032cbb6482832586a5811fb)
07-31 18:29:18.349 23726 23726 F DEBUG   :       dotnet/runtime#14 pc 00000000002b0e16  /data/app/~~OCNwFAaxFio1yAGZVXnSJQ==/com.CompanyName.AndroidFSharpReleaseCrash-QrBpZyME9O5j9zeh4ow2ZQ==/lib/x86_64/libmonosgen-2.0.so (BuildId: 0a959315e0893aa7c032cbb6482832586a5811fb)
07-31 18:29:18.349 23726 23726 F DEBUG   :       dotnet/runtime#15 pc 00000000000e3d7f  /data/app/~~OCNwFAaxFio1yAGZVXnSJQ==/com.CompanyName.AndroidFSharpReleaseCrash-QrBpZyME9O5j9zeh4ow2ZQ==/lib/x86_64/libmonosgen-2.0.so (BuildId: 0a959315e0893aa7c032cbb6482832586a5811fb)
07-31 18:29:18.349 23726 23726 F DEBUG   :       dotnet/runtime#16 pc 000000000016a78f  /data/app/~~OCNwFAaxFio1yAGZVXnSJQ==/com.CompanyName.AndroidFSharpReleaseCrash-QrBpZyME9O5j9zeh4ow2ZQ==/lib/x86_64/libmonosgen-2.0.so (BuildId: 0a959315e0893aa7c032cbb6482832586a5811fb)
07-31 18:29:18.349 23726 23726 F DEBUG   :       dotnet/runtime#17 pc 000000000016bc28  /data/app/~~OCNwFAaxFio1yAGZVXnSJQ==/com.CompanyName.AndroidFSharpReleaseCrash-QrBpZyME9O5j9zeh4ow2ZQ==/lib/x86_64/libmonosgen-2.0.so (BuildId: 0a959315e0893aa7c032cbb6482832586a5811fb)
07-31 18:29:18.349 23726 23726 F DEBUG   :       dotnet/runtime#18 pc 0000000000182034  /data/app/~~OCNwFAaxFio1yAGZVXnSJQ==/com.CompanyName.AndroidFSharpReleaseCrash-QrBpZyME9O5j9zeh4ow2ZQ==/lib/x86_64/libmonosgen-2.0.so (BuildId: 0a959315e0893aa7c032cbb6482832586a5811fb)
07-31 18:29:18.349 23726 23726 F DEBUG   :       dotnet/runtime#19 pc 0000000000000b15  <anonymous:417dc000>
kerams commented 3 months ago

Windows indeed. Why would Avalonia fail to load Skia when the entry assembly is originally compiled with F# but not C# though?

matouskozak commented 3 months ago

Windows indeed. Why would Avalonia fail to load Skia when the entry assembly is originally compiled with F# but not C# though?

I see the same crash with C# Avalonia template (dotnet new avalonia.xplat -lang C#). Does C# version work for you?

kerams commented 3 months ago

I don't remember if I've tried C# myself, but that's what https://github.com/dotnet/runtime/issues/102166#issuecomment-2111261496 states.

matouskozak commented 3 months ago

The crash dump https://github.com/dotnet/android/issues/9185#issuecomment-2278123754 looks related to the SkiaSharp failures in https://github.com/dotnet/android/issues/9153 and possibly https://github.com/dotnet/android/issues/9151 (Windows and Release only crash) cc: @grendello. I was able to solve the SkiaSharp crash in https://github.com/dotnet/runtime/pull/106026 but only on my Mac. However, this issue only reproduces for me on Windows and I was not able to verify that my fix is enough so it might need https://github.com/dotnet/android/pull/9117 to fully fix the issue.