dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.21k stars 1.75k forks source link

Exception being thrown on android physical device with latest version of .NET MAUI #7002

Closed vsfeedback closed 2 years ago

vsfeedback commented 2 years ago

This issue has been moved from a ticket on Developer Community.


When I attempt to run my .NET MAUI application on a physical device, I'm getting hit with the following exception

$exception  {System.IO.FileNotFoundException: 
File name: 'System.Private.CoreLib.resources'
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef, StackCrawlMark& stackMark, AssemblyLoadContext assemblyLoadContext)
   at System.Reflection.RuntimeAssembly.InternalGetSatelliteAssembly(Assembly assembly, CultureInfo culture, Version version, Boolean throwOnFileNotFound)} System.IO.FileNotFoundException

If I enabled the CLR debug, it's revealing more

[monodroid-assembly] open_from_bundles: failed to load assembly System.Text.RegularExpressions.dll
Loaded assembly: /data/data/com.companyname.compencrypt/files/.__override__/System.Text.RegularExpressions.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly en-GB/System.Private.CoreLib.resources.dll
[monodroid-assembly] open_from_bundles: failed to load assembly en-GB/System.Private.CoreLib.resources.dll
**System.IO.FileNotFoundException:** 'Loading...'

[monodroid-assembly] open_from_bundles: failed to load assembly en-GB/System.Private.CoreLib.resources.dll
[monodroid-assembly] open_from_bundles: failed to load assembly en-GB/System.Private.CoreLib.resources.dll
[monodroid-assembly] open_from_bundles: failed to load assembly en/System.Private.CoreLib.resources.dll
[monodroid-assembly] open_from_bundles: failed to load assembly en/System.Private.CoreLib.resources.dll

The error shows in App.xaml.cs when the InitialiseComponent is called and if I try to access anything in my Languages.Resources file or use DI to access platform specific code. On an emulator, the code works as expected.

Using .NET MAUI 6.0.300-rc.2.5513


Original Comments

Feedback Bot on 4/30/2022, 09:39 PM:

(private comment, text removed)


Original Solutions

(no solutions)

Eilon commented 2 years ago

Tagging @jonathanpeppers @eerhardt in case this looks familiar.

jonathanpeppers commented 2 years ago

Would the original author (Paul Johnson) be able to share a small sample project that hits this issue?

I suspect there might be something wrong when using .resx files from a class library, but there isn't enough information to know if that is the problem. We have a few tests around .resx in xamarin/xamarin-android, and they seem to be passing.

ghost commented 2 years ago

Hi @vsfeedback. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

timvandenhof commented 2 years ago

While I'm not the original author, I faced this issue on my experimental app as well. The strange thing is that you can continue after that the exception is thrown.

{System.IO.FileNotFoundException: 
File name: 'System.Private.CoreLib.resources'
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef, StackCrawlMark& stackMark, AssemblyLoadContext assemblyLoadContext)
   at System.Reflection.RuntimeAssembly.InternalGetSatelliteAssembly(Assembly assembly, CultureInfo culture, Version version, Boolean throwOnFileNotFound)}

Physical device: Google Pixel 5, Android 12.1 (SDK 32). --> Reproduction Emulator: Google Pixel 5, Android 11 (SDK 30) --> No reproduction

I have the following additional information:

Eilon commented 2 years ago

@timvandenhof said:

There are RESX-files in my solution at all.

You mean there are, or aren't?

jonathanpeppers commented 2 years ago

If someone has an idea of what API you're using that causes this, or can reproduce it in a sample app that would help us solve this.

The problem is the stack trace above, doesn't really show what the problematic code is...

Thanks!

nodoid commented 2 years ago

Would the original author (Paul Johnson) be able to share a small sample project that hits this issue?

I suspect there might be something wrong when using .resx files from a class library, but there isn't enough information to know if that is the problem. We have a few tests around .resx in xamarin/xamarin-android, and they seem to be passing.

Test code showing the issue : https://github.com/nodoid/CompEncrypt - works fine on iOS and the app builds on Android but errors out when run in debug mode - in release mode it's fine

jonathanpeppers commented 2 years ago

@nodoid are you seeing the above application crash on a device? Debug mode only?

The app seems to work for me, it does look like maybe the layout has an issue:

image

Are you using the latest MAUI RC 3 builds that went out last week?

kojini commented 2 years ago

I have the same issue on my Android emulator. Visual Studio: 17.2.0 Preview 4.0 Android emulator: Pixel 5, API 30

If I ticket all the items in Common Language Runtime Exceptions, the exception gets caught. It doesn't get caught if CLR exception settings is default. I set it to default and run my app, and the app runs without problem.

jonathanpeppers commented 2 years ago

@kojini can you share a sample that hits this problem? Is it the same FileNotFoundException for System.Private.CoreLib?

kojini commented 2 years ago

@jonathanpeppers I can't share my code as it's commartial code. However, I can provide logs and stacktrace when the exception occurred. FYI, I updated VS to 17.3.0 Preview 1 and it still occurs.

Is it the same FileNotFoundException for System.Private.CoreLib?

Yes, I can see System.Private.CoreLib in the log below.

`> am start -a "android.intent.action.MAIN" -c "android.intent.category.LAUNCHER" -n "com.sample.test/crc64e14457250bc6e2f9.MainActivity"

Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.sample.test/crc64e14457250bc6e2f9.MainActivity } This debug engine does not support exception conditions. The condition(s) will be ignored. [astiq.sample_de] Late-enabling -Xcheck:jni [astiq.sample_de] Unquickening 12 vdex files! [astiq.sample_de] Unexpected CPU variant for X86 using defaults: x86_64 [astiq.sample_de] The ClassLoaderContext is a special shared library. [NetworkSecurityConfig] No Network Security Config specified, using platform default [NetworkSecurityConfig] No Network Security Config specified, using platform default [debug-app-helper] Checking if libmonodroid was unpacked to /data/app/~~XhEFNWjoa4oUelYU2KVsRQ==/com.sample.test-6-w73vu4IMURdMNH-haDSg==/lib/x86_64/libmonodroid.so [debug-app-helper] Native libs extracted to /data/app/~~XhEFNWjoa4oUelYU2KVsRQ==/com.sample.test-6-w73vu4IMURdMNH-haDSg==/lib/x86_64, assuming application/android:extractNativeLibs == true [debug-app-helper] Setting up for DSO lookup in app data directories [debug-app-helper] Added filesystem DSO lookup location: /data/app/~~XhEFNWjoa4oUelYU2KVsRQ==/com.sample.test-6-w73vu4IMURdMNH-haDSg==/lib/x86_64 [debug-app-helper] Using runtime path: /data/app/~~XhEFNWjoa4oUelYU2KVsRQ==/com.sample.test-6-w73vu4IMURdMNH-haDSg==/lib/x86_64 [debug-app-helper] checking directory: /data/user/0/com.sample.test/files/.__override__/lib [debug-app-helper] directory does not exist: /data/user/0/com.sample.test/files/.__override__/lib [debug-app-helper] Checking whether Mono runtime exists at: /data/user/0/com.sample.test/files/.override/libmonosgen-2.0.so [debug-app-helper] Checking whether Mono runtime exists at: /data/app/~~XhEFNWjoa4oUelYU2KVsRQ==/com.sample.test-6-w73vu4IMURdMNH-haDSg==/lib/x86_64/libmonosgen-2.0.so [debug-app-helper] Mono runtime found at: /data/app/~~XhEFNWjoa4oUelYU2KVsRQ==/com.sample.test-6-w73vu4IMURdMNH-haDSg==/lib/x86_64/libmonosgen-2.0.so [astiq.sample_de] Attempt to remove non-JNI local reference, dumping thread [DOTNET] JNI_OnLoad: JNI_OnLoad in pal_jni.c [monodroid] Creating public update directory: /data/user/0/com.sample.test/files/.__override__ [astiq.sample_de] Attempt to remove non-JNI local reference, dumping thread [monodroid-debug] Trying to initialize the debugger with options: --debugger-agent=transport=dt_socket,loglevel=0,address=10.0.2.2:50167,embedding=1 [monodroid-assembly] open_from_bundles: failed to load assembly sample.dll [monodroid-gc] GREF GC Threshold: 46080 [monodroid-assembly] open_from_bundles: failed to load assembly Mono.Android.dll [monodroid-assembly] open_from_bundles: failed to load assembly System.Runtime.dll [monodroid-assembly] open_from_bundles: failed to load assembly Java.Interop.dll [monodroid-assembly] open_from_bundles: failed to load assembly System.Collections.dll Loaded assembly: /data/data/com.sample.test/files/.override/sample.dll Loaded assembly: /data/data/com.sample.test/files/.override/Mono.Android.dll [External] Loaded assembly: /data/data/com.sample.test/files/.override/System.Runtime.dll [External] Loaded assembly: /data/data/com.sample.test/files/.override/Java.Interop.dll [External] Loaded assembly: /data/data/com.sample.test/files/.override/System.Collections.dll [External] Resolved pending breakpoint for 'Android.Runtime.JNIEnv.RegisterJniNatives(System.IntPtr, System.Int32, System.IntPtr, System.IntPtr, System.Int32)' to /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNIEnv.cs:124 [0x00000]. [monodroid-assembly] open_from_bundles: failed to load assembly System.Threading.dll Loaded assembly: /data/data/com.sample.test/files/.override/System.Threading.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly System.Runtime.InteropServices.dll Loaded assembly: /data/data/com.sample.test/files/.override/System.Runtime.InteropServices.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly System.Threading.Thread.dll [monodroid-assembly] open_from_bundles: failed to load assembly System.Diagnostics.StackTrace.dll Loaded assembly: /data/data/com.sample.test/files/.override/System.Threading.Thread.dll [External] Loaded assembly: /data/data/com.sample.test/files/.override/System.Diagnostics.StackTrace.dll [External] [astiq.sample_de] Attempt to remove non-JNI local reference, dumping thread Loaded assembly: data-0x77cac7aca030 [External] Loaded assembly: data-0x77cac7afa060 [External] Loaded assembly: data-0x77c8b31a2040 [External] Loaded assembly: data-0x77cac7aea050 [External] [monodroid-assembly] open_from_bundles: failed to load assembly netstandard.dll Loaded assembly: /data/data/com.sample.test/files/.override/netstandard.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly System.Linq.dll Loaded assembly: /data/data/com.sample.test/files/.override/System.Linq.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.VisualStudio.DesignTools.TapContract.dll [monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.VisualStudio.DesignTools.TapContract.dll [monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.HotReload.Contracts.dll [monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.HotReload.Contracts.dll [monodroid-assembly] open_from_bundles: failed to load assembly System.Collections.Concurrent.dll Loaded assembly: /data/data/com.sample.test/files/.override/System.Collections.Concurrent.dll [External] Resolved pending breakpoint for 'Xamarin.HotReload.HotReloadAgent.BreakpointSendToIde(System.String)' to D:\a_work\1\s\HotReload\Source\Xamarin.HotReload.Agent\HotReloadAgent.cs:419 [0x00000]. [monodroid-assembly] open_from_bundles: failed to load assembly System.Text.Json.dll Loaded assembly: /data/data/com.sample.test/files/.override/System.Text.Json.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly System.Text.Encodings.Web.dll Loaded assembly: /data/data/com.sample.test/files/.override/System.Text.Encodings.Web.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly System.ComponentModel.dll Loaded assembly: /data/data/com.sample.test/files/.override/System.ComponentModel.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Maui.Controls.Compatibility.dll [monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Maui.Controls.dll [monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.HotReload.Contracts.dll Loaded assembly: /data/data/com.sample.test/files/.override/Microsoft.Maui.Controls.Compatibility.dll [External] Loaded assembly: /data/data/com.sample.test/files/.override/Microsoft.Maui.Controls.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.HotReload.Contracts.dll [monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.VisualStudio.DesignTools.TapContract.dll [monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.VisualStudio.DesignTools.TapContract.dll [monodroid-assembly] open_from_bundles: failed to load assembly System.ObjectModel.dll [monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Maui.dll Loaded assembly: /data/data/com.sample.test/files/.override/System.ObjectModel.dll [External] Loaded assembly: /data/data/com.sample.test/files/.override/Microsoft.Maui.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Maui.Graphics.dll [monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Maui.Essentials.dll [monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.Logging.Abstractions.dll Loaded assembly: /data/data/com.sample.test/files/.override/Microsoft.Maui.Graphics.dll [External] Loaded assembly: /data/data/com.sample.test/files/.override/Microsoft.Maui.Essentials.dll [External] Loaded assembly: /data/data/com.sample.test/files/.override/Microsoft.Extensions.Logging.Abstractions.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly System.Runtime.Loader.dll Loaded assembly: /data/data/com.sample.test/files/.override/System.Runtime.Loader.dll [External] Resolved pending breakpoint for 'Xamarin.HotReload.HotReloadAgent.BreakpointCheckpoint()' to D:\a_work\1\s\HotReload\Source\Xamarin.HotReload.Agent\HotReloadAgent.cs:414 [0x00000]. [monodroid-assembly] open_from_bundles: failed to load assembly System.Memory.dll Loaded assembly: /data/data/com.sample.test/files/.override/System.Memory.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly System.Reflection.Emit.Lightweight.dll [monodroid-assembly] open_from_bundles: failed to load assembly System.Reflection.Emit.ILGeneration.dll [monodroid-assembly] open_from_bundles: failed to load assembly System.Reflection.Primitives.dll Loaded assembly: /data/data/com.sample.test/files/.override/System.Reflection.Emit.Lightweight.dll [External] Loaded assembly: /data/data/com.sample.test/files/.override/System.Reflection.Emit.ILGeneration.dll [External] Loaded assembly: /data/data/com.sample.test/files/.override/System.Reflection.Primitives.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly System.Runtime.CompilerServices.Unsafe.dll Loaded assembly: /data/data/com.sample.test/files/.override/System.Runtime.CompilerServices.Unsafe.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.Core.dll Loaded assembly: /data/data/com.sample.test/files/.override/Xamarin.AndroidX.Core.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.DependencyInjection.Abstractions.dll Loaded assembly: /data/data/com.sample.test/files/.override/Microsoft.Extensions.DependencyInjection.Abstractions.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Maui.Controls.Xaml.dll [monodroid-assembly] open_from_bundles: failed to load assembly CommunityToolkit.Maui.dll [monodroid-assembly] open_from_bundles: failed to load assembly Cosmos.HoleLogic.Abstractions.dll [monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.Configuration.dll [monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.Configuration.Abstractions.dll [monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.Logging.dll Loaded assembly: /data/data/com.sample.test/files/.override/Microsoft.Maui.Controls.Xaml.dll [External] Loaded assembly: /data/data/com.sample.test/files/.override/CommunityToolkit.Maui.dll [External] Loaded assembly: /data/data/com.sample.test/files/.override/Cosmos.HoleLogic.Abstractions.dll [External] Loaded assembly: /data/data/com.sample.test/files/.override/Microsoft.Extensions.Configuration.dll [External] Loaded assembly: /data/data/com.sample.test/files/.override/Microsoft.Extensions.Configuration.Abstractions.dll [External] Loaded assembly: /data/data/com.sample.test/files/.override/Microsoft.Extensions.Logging.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.AppCompat.dll [monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.Google.Android.Material.dll Loaded assembly: /data/data/com.sample.test/files/.override/Xamarin.AndroidX.AppCompat.dll [External] Loaded assembly: /data/data/com.sample.test/files/.override/Xamarin.Google.Android.Material.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly System.ComponentModel.TypeConverter.dll Loaded assembly: /data/data/com.sample.test/files/.override/System.ComponentModel.TypeConverter.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly System.Private.Uri.dll Loaded assembly: /data/data/com.sample.test/files/.override/System.Private.Uri.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.Fragment.dll [monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.Activity.dll [monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.Lifecycle.ViewModel.dll [monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.Lifecycle.Common.dll [monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.SavedState.dll Loaded assembly: /data/data/com.sample.test/files/.override/Xamarin.AndroidX.Fragment.dll [External] Loaded assembly: /data/data/com.sample.test/files/.override/Xamarin.AndroidX.Activity.dll [External] Loaded assembly: /data/data/com.sample.test/files/.override/Xamarin.AndroidX.Lifecycle.ViewModel.dll [External] Loaded assembly: /data/data/com.sample.test/files/.override/Xamarin.AndroidX.Lifecycle.Common.dll [External] Loaded assembly: /data/data/com.sample.test/files/.override/Xamarin.AndroidX.SavedState.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.DrawerLayout.dll [monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.CustomView.dll [monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.Navigation.Runtime.dll Loaded assembly: /data/data/com.sample.test/files/.override/Xamarin.AndroidX.DrawerLayout.dll [External] Loaded assembly: /data/data/com.sample.test/files/.override/Xamarin.AndroidX.CustomView.dll [External] Loaded assembly: /data/data/com.sample.test/files/.override/Xamarin.AndroidX.Navigation.Runtime.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly CommunityToolkit.Maui.Core.dll Loaded assembly: /data/data/com.sample.test/files/.override/CommunityToolkit.Maui.Core.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly sample.Core.dll [monodroid-assembly] open_from_bundles: failed to load assembly System.Net.Http.dll Loaded assembly: /data/data/com.sample.test/files/.override/sample.Core.dll Loaded assembly: /data/data/com.sample.test/files/.override/System.Net.Http.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly System.Text.Encoding.Extensions.dll Loaded assembly: /data/data/com.sample.test/files/.override/System.Text.Encoding.Extensions.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly System.Runtime.Intrinsics.dll Loaded assembly: /data/data/com.sample.test/files/.override/System.Runtime.Intrinsics.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly System.Numerics.Vectors.dll Loaded assembly: /data/data/com.sample.test/files/.override/System.Numerics.Vectors.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly Cosmos.HoleLogic.dll [monodroid-assembly] open_from_bundles: failed to load assembly Cosmos.HoleLogic.DesignAdjustments.dll Loaded assembly: /data/data/com.sample.test/files/.override/Cosmos.HoleLogic.dll [External] Loaded assembly: /data/data/com.sample.test/files/.override/Cosmos.HoleLogic.DesignAdjustments.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly SQLite-net.dll Loaded assembly: /data/data/com.sample.test/files/.override/SQLite-net.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly Cosmos.HoleLogic.HoleStates.dll [monodroid-assembly] open_from_bundles: failed to load assembly Cosmos.HoleLogic.InferredActuals.dll [monodroid-assembly] open_from_bundles: failed to load assembly Cosmos.HoleLogic.MeasuredActuals.dll [monodroid-assembly] open_from_bundles: failed to load assembly Cosmos.HoleLogic.Abstractions.Utilities.dll [monodroid-assembly] open_from_bundles: failed to load assembly Cosmos.HoleLogic.Calculators.dll Loaded assembly: /data/data/com.sample.test/files/.override/Cosmos.HoleLogic.HoleStates.dll [External] Loaded assembly: /data/data/com.sample.test/files/.override/Cosmos.HoleLogic.InferredActuals.dll [External] Loaded assembly: /data/data/com.sample.test/files/.override/Cosmos.HoleLogic.MeasuredActuals.dll [External] Loaded assembly: /data/data/com.sample.test/files/.override/Cosmos.HoleLogic.Abstractions.Utilities.dll [External] Loaded assembly: /data/data/com.sample.test/files/.override/Cosmos.HoleLogic.Calculators.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly Cosmos.Products.Contracts.dll Loaded assembly: /data/data/com.sample.test/files/.override/Cosmos.Products.Contracts.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly Cosmos.SiteConfig.Contracts.dll Loaded assembly: /data/data/com.sample.test/files/.override/Cosmos.SiteConfig.Contracts.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly Polly.dll [monodroid-assembly] open_from_bundles: failed to load assembly Polly.Extensions.Http.dll [monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.Http.dll [monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.Http.Polly.dll Loaded assembly: /data/data/com.sample.test/files/.override/Polly.dll [External] Loaded assembly: /data/data/com.sample.test/files/.override/Polly.Extensions.Http.dll [External] Loaded assembly: /data/data/com.sample.test/files/.override/Microsoft.Extensions.Http.dll [External] Loaded assembly: /data/data/com.sample.test/files/.override/Microsoft.Extensions.Http.Polly.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.Options.dll Loaded assembly: /data/data/com.sample.test/files/.override/Microsoft.Extensions.Options.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly System.Net.Primitives.dll Loaded assembly: /data/data/com.sample.test/files/.override/System.Net.Primitives.dll [External] Thread started: #2 Thread started: .NET ThreadPool Gate #3 Thread started: #4 [monodroid-assembly] open_from_bundles: failed to load assembly SQLitePCLRaw.core.dll Loaded assembly: /data/data/com.sample.test/files/.override/SQLitePCLRaw.core.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly SQLitePCLRaw.batteries_v2.dll Loaded assembly: /data/data/com.sample.test/files/.override/SQLitePCLRaw.batteries_v2.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly SQLitePCLRaw.provider.dynamic_cdecl.dll Loaded assembly: /data/data/com.sample.test/files/.override/SQLitePCLRaw.provider.dynamic_cdecl.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly SQLitePCLRaw.nativelibrary.dll Loaded assembly: /data/data/com.sample.test/files/.override/SQLitePCLRaw.nativelibrary.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly sample.Contracts.dll Loaded assembly: /data/data/com.sample.test/files/.override/sample.Contracts.dll Thread started: #5 Thread started: #6 [monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.DependencyInjection.dll Loaded assembly: /data/data/com.sample.test/files/.override/Microsoft.Extensions.DependencyInjection.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly System.Diagnostics.Tracing.dll Loaded assembly: /data/data/com.sample.test/files/.override/System.Diagnostics.Tracing.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly System.Linq.Expressions.dll Loaded assembly: /data/data/com.sample.test/files/.override/System.Linq.Expressions.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly System.Xml.ReaderWriter.dll [monodroid-assembly] open_from_bundles: failed to load assembly System.Private.Xml.dll Loaded assembly: /data/data/com.sample.test/files/.override/System.Xml.ReaderWriter.dll [External] Loaded assembly: /data/data/com.sample.test/files/.override/System.Private.Xml.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly System.Text.RegularExpressions.dll Loaded assembly: /data/data/com.sample.test/files/.override/System.Text.RegularExpressions.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly en/System.Private.CoreLib.resources.dll System.IO.FileNotFoundException: '' [chatty] uid=10153(com.sample.test) identical 2 lines [monodroid-assembly] open_from_bundles: failed to load assembly en/System.Private.CoreLib.resources.dll The thread 0x6 has exited with code 0 (0x0). The thread 0x4 has exited with code 0 (0x0). The thread 0x2 has exited with code 0 (0x0). The thread 0x5 has exited with code 0 (0x0). Thread finished: #6 Thread finished: #4 Thread finished: #2 Thread finished: #5 [astiq.sample_de] Explicit concurrent copying GC freed 41(17KB) AllocSpace objects, 0(0B) LOS objects, 24% free, 1824KB/2432KB, paused 311us total 3.206ms [monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.RecyclerView.dll [monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.SwipeRefreshLayout.dll [monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.CardView.dll Loaded assembly: /data/data/com.sample.test/files/.override/Xamarin.AndroidX.RecyclerView.dll [External] Loaded assembly: /data/data/com.sample.test/files/.override/Xamarin.AndroidX.SwipeRefreshLayout.dll [External] Loaded assembly: /data/data/com.sample.test/files/.override/Xamarin.AndroidX.CardView.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly Naxam.Mapbox.Droid.dll [monodroid-assembly] open_from_bundles: failed to load assembly mscorlib.dll Loaded assembly: /data/data/com.sample.test/files/.override/Naxam.Mapbox.Droid.dll [External] Loaded assembly: /data/data/com.sample.test/files/.override/mscorlib.dll [External] [libEGL] loaded /vendor/lib64/egl/libEGL_emulation.so [libEGL] loaded /vendor/lib64/egl/libGLESv1_CM_emulation.so [libEGL] loaded /vendor/lib64/egl/libGLESv2_emulation.so [monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.Loader.dll Loaded assembly: /data/data/com.sample.test/files/.override/Xamarin.AndroidX.Loader.dll [External] [CrashReporter] Root directory doesn't exist [astiq.sample_de] Accessing hidden field Landroid/graphics/Typeface;->sSystemFontMap:Ljava/util/Map; (greylist, reflection, allowed) Thread started: #7 Thread started: #8 Thread started: #9 [monodroid-assembly] open_from_bundles: failed to load assembly System.Runtime.Serialization.Json.dll [monodroid-assembly] open_from_bundles: failed to load assembly System.Private.DataContractSerialization.dll [monodroid-assembly] open_from_bundles: failed to load assembly System.Runtime.Serialization.Xml.dll Loaded assembly: /data/data/com.sample.test/files/.override/System.Runtime.Serialization.Json.dll [External] Loaded assembly: /data/data/com.sample.test/files/.override/System.Private.DataContractSerialization.dll [External] Loaded assembly: /data/data/com.sample.test/files/.override/System.Runtime.Serialization.Xml.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly System.Runtime.Serialization.Primitives.dll Loaded assembly: /data/data/com.sample.test/files/.override/System.Runtime.Serialization.Primitives.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly en/System.Private.DataContractSerialization.resources.dll System.IO.FileNotFoundException: '' [monodroid-assembly] open_from_bundles: failed to load assembly en/System.Private.DataContractSerialization.resources.dll [monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.CoordinatorLayout.dll Loaded assembly: /data/data/com.sample.test/files/.override/Xamarin.AndroidX.CoordinatorLayout.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.Lifecycle.LiveData.Core.dll Loaded assembly: /data/data/com.sample.test/files/.override/Xamarin.AndroidX.Lifecycle.LiveData.Core.dll [External] [astiq.sample_de] Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed) [astiq.sample_de] Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed) [monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.ViewPager2.dll Loaded assembly: /data/data/com.sample.test/files/.override/Xamarin.AndroidX.ViewPager2.dll [External] [TabLayout] MODE_SCROLLABLE + GRAVITY_FILL is not supported, GRAVITY_START will be used instead [monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.Lifecycle.Runtime.dll Loaded assembly: /data/data/com.sample.test/files/.override/Xamarin.AndroidX.Lifecycle.Runtime.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.ViewPager.dll Loaded assembly: /data/data/com.sample.test/files/.override/Xamarin.AndroidX.ViewPager.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.Primitives.dll Loaded assembly: /data/data/com.sample.test/files/.override/Microsoft.Extensions.Primitives.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly System.Security.Cryptography.X509Certificates.dll Loaded assembly: /data/data/com.sample.test/files/.override/System.Security.Cryptography.X509Certificates.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly System.Diagnostics.DiagnosticSource.dll Loaded assembly: /data/data/com.sample.test/files/.override/System.Diagnostics.DiagnosticSource.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly System.Collections.NonGeneric.dll Loaded assembly: /data/data/com.sample.test/files/.override/System.Collections.NonGeneric.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly System.Net.Requests.dll Loaded assembly: /data/data/com.sample.test/files/.override/System.Net.Requests.dll [External] Thread started: .NET Timers #10 Loaded assembly: Anonymously Hosted DynamicMethods Assembly [External] [monodroid-assembly] open_from_bundles: failed to load assembly IdentityModel.OidcClient.dll Loaded assembly: /data/data/com.sample.test/files/.override/IdentityModel.OidcClient.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly IdentityModel.dll [monodroid-assembly] open_from_bundles: failed to load assembly System.Security.Claims.dll Loaded assembly: /data/data/com.sample.test/files/.override/IdentityModel.dll [External] Loaded assembly: /data/data/com.sample.test/files/.override/System.Security.Claims.dll [External] Thread started: #11 Thread started: #12 [monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.Security.SecurityCrypto.dll Loaded assembly: /data/data/com.sample.test/files/.override/Xamarin.AndroidX.Security.SecurityCrypto.dll [External] [LocationController] Location permissions are not granted [TetheringManager] registerTetheringEventCallback:com.sample.test [Mbgl-ConnectivityReceiver] connected - true [HostConnection] HostConnection::get() New Host Connection established 0x77c957aa86d0, tid 10308 [HostConnection] HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_sync_buffer_data GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_async_frame_commands ANDROID_EMU_gles_max_version_2 [EGL_emulation] eglCreateContext: 0x77c947aee840: maj 2 min 0 rcv 2 [EGL_emulation] eglMakeCurrent: 0x77c947aee840: ver 2 0 (tinfo 0x77c8e8362c30) (first time) [EngineFactory] Provider GmsCore_OpenSSL not available [Gralloc4] mapper 4.x is not supported [HostConnection] createUnique: call [HostConnection] HostConnection::get() New Host Connection established 0x77c957aa5c10, tid 10308 [goldfish-address-space] allocate: Ask for block of size 0x100 [goldfish-address-space] allocate: ioctl allocate returned offset 0x3f3ffe000 size 0x2000 [HostConnection] HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_sync_buffer_data GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_async_frame_commands ANDROID_EMU_gles_max_version_2 Thread started: #13 [monodroid-assembly] open_from_bundles: failed to load assembly System.IO.Compression.dll Loaded assembly: /data/data/com.sample.test/files/.override/System.IO.Compression.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly en/System.Net.Primitives.resources.dll Thread started: #14 [monodroid-assembly] open_from_bundles: failed to load assembly en/System.Net.Primitives.resources.dll [monodroid-assembly] open_from_bundles: failed to load assembly System.Security.Cryptography.Algorithms.dll [monodroid-assembly] open_from_bundles: failed to load assembly System.Security.Cryptography.Primitives.dll Loaded assembly: /data/data/com.sample.test/files/.override/System.Security.Cryptography.Algorithms.dll [External] Loaded assembly: /data/data/com.sample.test/files/.override/System.Security.Cryptography.Primitives.dll [External] [monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.Browser.dll Loaded assembly: /data/data/com.sample.test/files/.override/Xamarin.AndroidX.Browser.dll [External] Thread started: #15 [astiq.sample_de] Explicit concurrent copying GC freed 4888(355KB) AllocSpace objects, 11(1452KB) LOS objects, 49% free, 3279KB/6558KB, paused 323us total 6.192ms [TabLayout] MODE_SCROLLABLE + GRAVITY_FILL is not supported, GRAVITY_START will be used instead [monodroid-assembly] open_from_bundles: failed to load assembly System.dll Loaded assembly: /data/data/com.sample.test/files/.override/System.dll [External] Thread finished: #15 Thread finished: #12 The thread 0xf has exited with code 0 (0x0). The thread 0xc has exited with code 0 (0x0). Thread finished: #14 Thread started: #16 The thread 0xe has exited with code 0 (0x0). Thread finished: #11 Thread started: #17 The thread 0xb has exited with code 0 (0x0). `

nodoid commented 2 years ago

This issue is also showing with the same System.Private error when accessing a locally stored file. If you grab the source code (https://github.com/nodoid/CompEncrypt) the issue can be seen once the start button is clicked except that the application now terminates due to a process being shared error (which I'm not sure if this too is incorrect as the process is closed before the line 71 in FileUtilities - ConvertToBase64())

jonathanpeppers commented 2 years ago

@nodoid this sample has changed alot since I last tried it.

It now crashes with a completely different error:

05-23 08:42:23.987 28120 28120 E AndroidRuntime: android.runtime.JavaProxyThrowable: System.IO.IOException: The process cannot access the file '/data/user/0/com.companyname.compencrypt/files/minion.jpg' because it is being used by another process.
05-23 08:42:23.987 28120 28120 E AndroidRuntime:    at Microsoft.Win32.SafeHandles.SafeFileHandle.Init(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
05-23 08:42:23.987 28120 28120 E AndroidRuntime:    at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
05-23 08:42:23.987 28120 28120 E AndroidRuntime:    at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
05-23 08:42:23.987 28120 28120 E AndroidRuntime:    at System.IO.Strategies.UnixFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
05-23 08:42:23.987 28120 28120 E AndroidRuntime:    at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
05-23 08:42:23.987 28120 28120 E AndroidRuntime:    at System.IO.Strategies.FileStreamHelpers.ChooseStrategy(FileStream fileStream, String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize)
05-23 08:42:23.987 28120 28120 E AndroidRuntime:    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize)
05-23 08:42:23.987 28120 28120 E AndroidRuntime:    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
05-23 08:42:23.987 28120 28120 E AndroidRuntime:    at System.IO.File.ReadAllBytesAsync(String path, CancellationToken cancellationToken)
05-23 08:42:23.987 28120 28120 E AndroidRuntime:    at CompEncrypt.Helpers.FileUtilities.ConvertToBase64()
05-23 08:42:23.987 28120 28120 E AndroidRuntime:    at CompEncrypt.ViewModels.MainViewModel.<get_StartCompressionCommand>b__15_0()

I think you probably have a System.IO.FileStream holding the file open, because I can find the file and delete it:

> adb shell run-as com.companyname.compencrypt ls -l files
total 104
-rw------- 1 u0_a812 u0_a812 104526 2022-05-23 08:42 minion.jpg
> adb shell run-as com.companyname.compencrypt rm files/minion.jpg
> adb shell run-as com.companyname.compencrypt ls -l files
total 0

Do you know how I can see the original problem above? I want to understand how you get System.IO.FileNotFoundException for System.Private.CoreLib.resources, so we can find the right people to fix this.

Thanks!

nodoid commented 2 years ago

As soon as the app hits the fist InitializeComponent in the App.xaml.cs I get the FileNotFound error with the Source from the throwback showing System.Private.CoreLib. I then get the same error when the LanguageConverter converter method is hit (same error) and when the File error occurs, the System.Private.CoreLib is showing as the Source here.

This error is showing with the GA release

jonathanpeppers commented 2 years ago

Ok what device or emulator are you seeing this on? Debug or Release mode?

nodoid commented 2 years ago

Samsung S8, Debug mode - release mode never shows these issues from memory

jonathanpeppers commented 2 years ago

I tried on a Samsung Galaxy S9+ (just what I have), and it seems to be working for me. I was using a Pixel 5 previously.

What Android version is your device running?

Can you also try:

We've seen some Samsung devices have an issue with Fast Deployment in the past, perhaps System.Private.CoreLib.resources failed to deploy?

nodoid commented 2 years ago

It's using API 28. I've followed your instructions, deleted the obj and bin directories, run clean and it seems to be working now.

jonathanpeppers commented 2 years ago

@nodoid do you think it was the EmbedAssembliesIntoApk setting? Or simply uninstalling the app/bin/obj?

nodoid commented 2 years ago

@jonathanpeppers = adding the Embded sorted the issue

jfversluis commented 2 years ago

Is this resolved then or do we still have something to do here? :)

ghost commented 2 years ago

Hi @vsfeedback. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

ghost commented 2 years ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.