ReticentRobot
ReticentRobot

Reputation: 71

Error when trying to build .Net Maui app - getting: Could not load file or assembly 'System.Transactions.Local, Version=7.0.0.0,

Everything works fine when I run Debug, but fails when I try to run Release. My CollectionView was a bit janky when scrolling and I read that might just be a Debug only problem so I wanted to see if it was smooth in a Release build.

So, for one thing - I'm not sure why I'm getting error for android-arm, android-x86, and android x-64 when I have the CPU target as ARM64, but here are the 4 errors I'm getting:

Errors:

Precompiling failed for C:\Users\me\source\repos\ReticentRobot\Disc\obj\ARM64\Release\net7.0-android33.0\android-arm\linked\System.Data.Common.dll with exit code -1073741819. Mono Ahead of Time compiler - compiling assembly C:\Users\me\source\repos\ReticentRobot\Disc\obj\ARM64\Release\net7.0-android33.0\android-arm\linked\System.Data.Common.dll AOTID 7B4092DA-D422-9A90-E483-2605D066BE8C Using profile data file 'C:\Program Files\dotnet\packs\Microsoft.Maui.Sdk\7.0.92\Sdk\maui.aotprofile' Using profile data file 'C:\Program Files\dotnet\packs\Microsoft.Maui.Sdk\7.0.92\Sdk\maui-blazor.aotprofile' Added 0 methods from profile. Added 0 methods from profile. Could not load signature of System.Data.Common.DbConnection:EnlistTransaction due to: Could not load file or assembly 'System.Transactions.Local, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies.

Precompiling failed for C:\Users\me\source\repos\ReticentRobot\Disc\obj\ARM64\Release\net7.0-android33.0\android-x86\linked\System.Data.Common.dll with exit code -1073741819. Mono Ahead of Time compiler - compiling assembly C:\Users\me\source\repos\ReticentRobot\Disc\obj\ARM64\Release\net7.0-android33.0\android-x86\linked\System.Data.Common.dll AOTID ECEF9B5B-3377-2ECE-C7DA-426393586258 Using profile data file 'C:\Program Files\dotnet\packs\Microsoft.Maui.Sdk\7.0.92\Sdk\maui.aotprofile' Using profile data file 'C:\Program Files\dotnet\packs\Microsoft.Maui.Sdk\7.0.92\Sdk\maui-blazor.aotprofile' Added 0 methods from profile. Added 0 methods from profile. Could not load signature of System.Data.Common.DbConnection:EnlistTransaction due to: Could not load file or assembly 'System.Transactions.Local, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies.

Precompiling failed for C:\Users\me\source\repos\ReticentRobot\Disc\obj\ARM64\Release\net7.0-android33.0\android-arm64\linked\System.Data.Common.dll with exit code -1073741819. Mono Ahead of Time compiler - compiling assembly C:\Users\me\source\repos\ReticentRobot\Disc\obj\ARM64\Release\net7.0-android33.0\android-arm64\linked\System.Data.Common.dll AOTID F4CB4512-3E06-8496-F7E7-E514FA384C84 Using profile data file 'C:\Program Files\dotnet\packs\Microsoft.Maui.Sdk\7.0.92\Sdk\maui.aotprofile' Using profile data file 'C:\Program Files\dotnet\packs\Microsoft.Maui.Sdk\7.0.92\Sdk\maui-blazor.aotprofile' Added 0 methods from profile. Added 0 methods from profile. Could not load signature of System.Data.Common.DbConnection:EnlistTransaction due to: Could not load file or assembly 'System.Transactions.Local, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies.

Precompiling failed for C:\Users\me\source\repos\ReticentRobot\Disc\obj\ARM64\Release\net7.0-android33.0\android-x64\linked\System.Data.Common.dll with exit code -1073741819. Mono Ahead of Time compiler - compiling assembly C:\Users\me\source\repos\ReticentRobot\Disc\obj\ARM64\Release\net7.0-android33.0\android-x64\linked\System.Data.Common.dll AOTID 15D087DE-1A74-0A84-BFFC-B67AE70EDB18 Using profile data file 'C:\Program Files\dotnet\packs\Microsoft.Maui.Sdk\7.0.92\Sdk\maui.aotprofile' Using profile data file 'C:\Program Files\dotnet\packs\Microsoft.Maui.Sdk\7.0.92\Sdk\maui-blazor.aotprofile' Added 0 methods from profile. Added 0 methods from profile. Could not load signature of System.Data.Common.DbConnection:EnlistTransaction due to: Could not load file or assembly 'System.Transactions.Local, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies.

What I've tried:

  1. Setting nullable enable in my Models
  2. Clearing C:\Users\me\AppData\Local\Temp, deleting \bin
  3. Wrapping everything I could think of in a try/catch to catch Null References
  4. Adding <Reference Include="System.Transactions.Local" /> to the csproj
  5. Changing Trimming from CopyUsed to Link (this removes those errors and launches the app, but it immediately crashes and closes with a warning in the Error List:

MSB3073: The command ""C:\Program Files (x86)\Android\android-sdk\platform-tools\adb" -s 19061FDEE001K1 uninstall -k "com.reticentrobot.disc"" exited with code 1.

  1. Running VS 2022 as Admin
  2. Disabling AOT and Trimming (same result as #5)

How are you supposed to debug this kind of thing when it runs fine in debug mode (except the jerkiness on the scrolling)? Any ideas what my issue is or how to fix it? Thanks!!

Crash Log

Process: com.reticentrobot.disc
PID: 9499
UID: 10431
Frozen: false
Flags: 0x20c8be44
Package: com.reticentrobot.disc v1 (0.1)
Foreground: Yes
Process-Runtime: 8414173
Build: google/raven/raven:13/TQ3A.230805.001.A2/10385117:user/release-keys
Loading-Progress: 1.0
Dropped-Count: 0


Build fingerprint: ‘google/raven/raven:13/TQ3A.230805.001.A2/10385117:user/release-keys’
Revision: ‘MP1.0’
ABI: ‘arm64’
Timestamp: 2023-08-18 09:32:23.801300180-0500
Process uptime: 1s
Cmdline: com.reticentrobot.disc
Pid: 9499, tid: 9499, name: icentrobot.disc >>> com.reticentrobot.disc << < Uid: 10431
Tagged_addr_ctrl: 0000000000000001 (PR_TAGGED_ADDR_ENABLE)

  Signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------  
  X0  0000000000000000  x1  000000000000251b  x2  0000000000000006  x3  0000007fc36f1800  
  X4  6e6d6e6c2e627172  x5  6e6d6e6c2e627172  x6  6e6d6e6c2e627172  x7  7f7f7f7f7f7f7f7f  
  X8  00000000000000f0  x9  00000070283f09e0  x10 0000000000000001  x11 0000007028432370  
  X12 0000007fc36f0610  x13 000000000000006f  x14 0000007fc36f06c0  x15 0000008bc8f73f63  
  X16 000000702849fd50  x17 000000702847aeb0  x18 000000703fbc4000  x19 000000000000251b  
  X20 000000000000251b  x21 00000000ffffffff  x22 0000000000000004  x23 0000006d0fd97498  
  X24 0000006d0fd9ce10  x25 0000000000000002  x26 b400006eab328020  x27 0000000000000002  
  X28 0000006d0fd974a8  x29 0000007fc36f1880  
  Lr  00000070284221c8  sp  0000007fc36f17e0  pc  00000070284221f4  pst 0000000000001000 

Backtrace:

  **#00** pc 00000000000531f4  /apex/com.android.runtime/lib64/bionic/libc.so (abort+164) (BuildId: dc4001c2ef2dfc23467040797a96840c)  

  **#01** pc 0000000000039f1c  /data/app/~~GP75HRymqt3cdmzUWdYibg==/com.reticentrobot.disc—bWF-DaUoT6t6rnaObLVWg==/split_config.arm64_v8a.apk!libmono-android.release.so (offset 0xa13000) (xamarin::android::internal::MonodroidRuntime::mono_log_handler(char const*, char const*, char const*, int, void*)+144) (BuildId: a8466986ce0a58d7eb3a452ef823ee9785ed332d)  

  **#02** pc 00000000002daa24  /data/app/~~GP75HRymqt3cdmzUWdYibg==/com.reticentrobot.disc—bWF-DaUoT6t6rnaObLVWg==/split_config.arm64_v8a.apk!libmonosgen-2.0.so (offset 0xa6e000) (BuildId: 2886a74d114d6e7dd505447cfe4ef4ebcf5f2771)  

  **#03** pc 00000000002dab50  /data/app/~~GP75HRymqt3cdmzUWdYibg==/com.reticentrobot.disc—bWF-DaUoT6t6rnaObLVWg==/split_config.arm64_v8a.apk!libmonosgen-2.0.so (offset 0xa6e000) (BuildId: 2886a74d114d6e7dd505447cfe4ef4ebcf5f2771)  

  **#04** pc 00000000002dab94  /data/app/~~GP75HRymqt3cdmzUWdYibg==/com.reticentrobot.disc—bWF-DaUoT6t6rnaObLVWg==/split_config.arm64_v8a.apk!libmonosgen-2.0.so (offset 0xa6e000) (BuildId: 2886a74d114d6e7dd505447cfe4ef4ebcf5f2771)  

  **#05** pc 00000000000df838  /data/app/~~GP75HRymqt3cdmzUWdYibg==/com.reticentrobot.disc—bWF-DaUoT6t6rnaObLVWg==/split_config.arm64_v8a.apk!libmonosgen-2.0.so (offset 0xa6e000) (BuildId: 2886a74d114d6e7dd505447cfe4ef4ebcf5f2771)  

  **#06** pc 0000000000113b9c  /data/app/~~GP75HRymqt3cdmzUWdYibg==/com.reticentrobot.disc—bWF-DaUoT6t6rnaObLVWg==/split_config.arm64_v8a.apk!libmonosgen-2.0.so (offset 0xa6e000) (mono_method_get_unmanaged_callers_only_ftnptr+60) (BuildId: 2886a74d114d6e7dd505447cfe4ef4ebcf5f2771)  

  **#07** pc 0000000000026108  /data/app/~~GP75HRymqt3cdmzUWdYibg==/com.reticentrobot.disc—bWF-DaUoT6t6rnaObLVWg==/split_config.arm64_v8a.apk!libmono-android.release.so (offset 0xa13000) (xamarin::android::internal::MonodroidRuntime::init_android_runtime(_JNIEnv*, _jclass*, _jobject*)+1320) (BuildId: a8466986ce0a58d7eb3a452ef823ee9785ed332d)  

  **#08** pc 0000000000027bac  /data/app/~~GP75HRymqt3cdmzUWdYibg==/com.reticentrobot.disc—bWF-DaUoT6t6rnaObLVWg==/split_config.arm64_v8a.apk!libmono-android.release.so (offset 0xa13000) (xamarin::android::internal::MonodroidRuntime::create_and_initialize_domain(_JNIEnv*, _jclass*, xamarin::android::jstring_array_wrapper&, xamarin::android::jstring_array_wrapper&, _jobjectArray*, xamarin::android::jstring_array_wrapper&, _jobject*, bool, bool, bool)+160) (BuildId: a8466986ce0a58d7eb3a452ef823ee9785ed332d)  

  **#09** pc 000000000002b0f4  /data/app/~~GP75HRymqt3cdmzUWdYibg==/com.reticentrobot.disc—bWF-DaUoT6t6rnaObLVWg==/split_config.arm64_v8a.apk!libmono-android.release.so (offset 0xa13000) (xamarin::android::internal::MonodroidRuntime::Java_mono_android_Runtime_initInternal(_JNIEnv*, _jclass*, _jstring*, _jobjectArray*, _jstring*, _jobjectArray*, int, _jobject*, _jobjectArray*, int, unsigned char, unsigned char)+4116) (BuildId: a8466986ce0a58d7eb3a452ef823ee9785ed332d)  

  **#10** pc 000000000002e5e4  /data/app/~~GP75HRymqt3cdmzUWdYibg==/com.reticentrobot.disc—bWF-DaUoT6t6rnaObLVWg==/split_config.arm64_v8a.apk!libmono-android.release.so (offset 0xa13000) (Java_mono_android_Runtime_initInternal+88) (BuildId: a8466986ce0a58d7eb3a452ef823ee9785ed332d)  

  **#11** pc 0000000000461754  /apex/com.android.art/lib64/libart.so (art_quick_generic_jni_trampoline+148) (BuildId: 6fc1c03912861b04885c9f2953121b6b)  

  **#12** pc 0000000000209b68  /apex/com.android.art/lib64/libart.so (nterp_helper+2152) (BuildId: 6fc1c03912861b04885c9f2953121b6b)  

  **#13** pc 00000000009152d6  /data/app/~~GP75HRymqt3cdmzUWdYibg==/com.reticentrobot.disc—bWF-DaUoT6t6rnaObLVWg==/oat/arm64/base.vdex (mono.MonoPackageManager.LoadApplication+426)  

  **#14** pc 0000000000209398  /apex/com.android.art/lib64/libart.so (nterp_helper+152) (BuildId: 6fc1c03912861b04885c9f2953121b6b)  

  **#15** pc 000000000091543e  /data/app/~~GP75HRymqt3cdmzUWdYibg==/com.reticentrobot.disc—bWF-DaUoT6t6rnaObLVWg==/oat/arm64/base.vdex (mono.MonoRuntimeProvider.attachInfo+82)    

  **#16** pc 00000000007bdf00  /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.app.ActivityThread.installProvider+1952)    

  **#17** pc 00000000007bd49c  /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.app.ActivityThread.installContentProviders+332)  

  **#18** pc 00000000007b4f0c  /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.app.ActivityThread.handleBindApplication+5932)  

  **#19** pc 00000000007a9448  /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.app.ActivityThread$H.handleMessage+7624)  

  **#20** pc 0000000000a21a30  /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.os.Handler.dispatchMessage+192)  

  **#21** pc 0000000000a25308  /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.os.Looper.loopOnce+1032)  

  **#22** pc 0000000000a24df4  /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.os.Looper.loop+580)  

  **#23** pc 00000000007bff94  /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.app.ActivityThread.main+1364)  

  **#24** pc 0000000000458000  /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+576) (BuildId: 6fc1c03912861b04885c9f2953121b6b)  

  **#25** pc 000000000048ad9c  /apex/com.android.art/lib64/libart.so (_jobject* art::InvokeMethod<(art::PointerSize)8>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jobject*, _jobject*, unsigned long)+1560) (BuildId: 6fc1c03912861b04885c9f2953121b6b)  

  **#26** pc 000000000048a75c  /apex/com.android.art/lib64/libart.so (art::Method_invoke(_JNIEnv*, _jobject*, _jobject*, _jobjectArray*) (.__uniq.165753521025965369065708152063621506277)+48) (BuildId: 6fc1c03912861b04885c9f2953121b6b)  

  **#27** pc 00000000002d0148  /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (art_jni_trampoline+120)  

  **#28** pc 0000000000d42880  /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run+144)  

  **#29** pc 0000000000d4d938  /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (com.android.internal.os.ZygoteInit.main+3464)  

  **#30** pc 0000000000458000  /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+576) (BuildId: 6fc1c03912861b04885c9f2953121b6b)  

  **#31** pc 0000000000589a94  /apex/com.android.art/lib64/libart.so (art::JValue art::InvokeWithVarArgs<_jmethodID*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, std::__va_list)+912) (BuildId: 6fc1c03912861b04885c9f2953121b6b)  

  **#32** pc 0000000000606a7c  /apex/com.android.art/lib64/libart.so (art::JNI<true>::CallStaticVoidMethodV(_JNIEnv*, _jclass*, _jmethodID*, std::__va_list)+160) (BuildId: 6fc1c03912861b04885c9f2953121b6b)  

  **#33** pc 00000000000bcce8  /system/lib64/libandroid_runtime.so (_JNIEnv::CallStaticVoidMethod(_jclass*, _jmethodID*, …)+120) (BuildId: 8a4a389cf22a72562a1c30ce6cd04664)  

  **#34** pc 00000000000c8bf8  /system/lib64/libandroid_runtime.so (android::AndroidRuntime::start(char const*, android::Vector<android::String8> const&, bool)+840) (BuildId: 8a4a389cf22a72562a1c30ce6cd04664)  

  **#35** pc 0000000000002560  /system/bin/app_process64 (main+1280) (BuildId: 6f97a590777bd06f31784c7272763a35)  

  **#36** pc 000000000004b600  /apex/com.android.runtime/lib64/bionic/libc.so (__libc_init+96) (BuildId: dc4001c2ef2dfc23467040797a96840c) 

UPDATE

I got Sentry installed and it is showing that the problem is here during runtime:

public HomePage(IServiceProvider serviceProvider)
{       
    var restService = serviceProvider.GetService<RestService>();
    BindingContext = vm = new PostsViewModel(serviceProvider);
    InitializeComponent();
}

In particular it doesn't like PostsViewModel(serviceProvider):

Microsoft.Maui.Controls.Xaml.XamlParseException: Position 40:9. Can not find the object referenced by `ViewModel`

Anybody out there that can tell what I've done wrong there or should be doing differently to make this run in a Release build?

Upvotes: 1

Views: 2666

Answers (1)

ReticentRobot
ReticentRobot

Reputation: 71

I don't really understand why, but through process of elimination I found out that what was causing the issue wasn't actually this:

public HomePage(IServiceProvider serviceProvider)
{       
    var restService = serviceProvider.GetService<RestService>();
    BindingContext = vm = new PostsViewModel(serviceProvider);
    InitializeComponent();
}

Microsoft.Maui.Controls.Xaml.XamlParseException: Position 40:9. Can not find the object referenced by ViewModel

sort of..., I think it was reporting a XamlParseException because of some code that was surrounding my CollectionView that hadn't been debugged/completed yet regarding a RefreshView:

<RefreshView 
    x:Name="PostsScrollView" 
    IsRefreshing="{Binding ListRefreshing}" 
    Command="{Binding Source={x:Reference Name=ViewModel}, Path=RefreshPosts}"
    RefreshColor="MediumOrchid" >

I'm not sure what the problem with that was exactly, but after removing it the project builds and launches. That said, it still wasn't working perfectly like it was in Debug mode (the CollectionView was loading, but without any pictures or data), and that turned out to be because I was missing a DataType on my DataTemplate:

<DataTemplate x:Name="CompactView" x:DataType="models: Post">

It's really strange to me how things work perfectly fine in debug mode but not in release like that though!

Upvotes: 1

Related Questions