Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileNotFoundException thrown (and caught) due to (arguably) missing satellite assembly #8847

Open
AArnott opened this issue Mar 28, 2024 · 0 comments
Assignees
Labels
Area: App Runtime Issues in `libmonodroid.so`. needs-triage Issues that need to be assigned.

Comments

@AArnott
Copy link
Contributor

AArnott commented Mar 28, 2024

Android application type

.NET Android (net7.0-android, net8.0-android, etc.)

Affected platform version

VS 2022 17.9.3, .NET SDK 8.0.201

Description

Resource string lookups cause a FileNotFoundException to be thrown due to a missing satellite assembly. This exception is caught before it reaches user code, and the overall functionality of the application appears to not be bothered, but it causes great numbers of first chance exceptions and breaking into the debugger (when break on first chance exceptions is enabled). And when the app crashes, these exceptions are the first things to catch attention in an investigation, as a red herring.

There are two issues here:

  1. Avoid the exception in the first place when the satellite assembly is obviously not present by checking a condition rather than throwing and catching an exception.
  2. The needed resource is already in the main assembly as a neutral resource in this case. No satellite assembly lookup should be needed anyway.

Steps to Reproduce

Create a new Android application with a Strings.resx file and a string resource inside it. As part of the application run, retrieve the string resource.
Run the app under the debugger and watch the first chance exceptions go by.

Did you find any workaround?

No.

Relevant log output

**System.IO.FileNotFoundException:** ''

 	0x26 in System.Reflection.Assembly.Load	C#
 	0x55 in System.Reflection.RuntimeAssembly.InternalGetSatelliteAssembly	C#
 	0x4 in System.Resources.ManifestBasedResourceGroveler.InternalGetSatelliteAssembly	C#
 	0x4D in System.Resources.ManifestBasedResourceGroveler.GetSatelliteAssembly	C#
 	0x31 in System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet	C#
 	0xA4 in System.Resources.ResourceManager.InternalGetResourceSet	C#
 	0x5A in System.Resources.ResourceManager.GetString	C#
 	0xB in Nerdbank.Zcash.App.Strings.GetResourceString at D:\source\repos\Nerdbank.Cryptocurrencies\src\Nerdbank.Zcash.App\Nerdbank.Zcash.App\Microsoft.CodeAnalysis.ResxSourceGenerator.CSharp\Microsoft.CodeAnalysis.ResxSourceGenerator.CSharp.CSharpResxGenerator\Strings.Designer.cs:16,104	C#
 	0x6 in Nerdbank.Zcash.App.Strings.get_AppGreeting at D:\source\repos\Nerdbank.Cryptocurrencies\src\Nerdbank.Zcash.App\Nerdbank.Zcash.App\Microsoft.CodeAnalysis.ResxSourceGenerator.CSharp\Microsoft.CodeAnalysis.ResxSourceGenerator.CSharp.CSharpResxGenerator\Strings.Designer.cs:38,46	C#
>	0x0 in Nerdbank.Zcash.App.ViewModels.FirstLaunchViewModel.get_Greeting at D:\source\repos\Nerdbank.Cryptocurrencies\src\Nerdbank.Zcash.App\Nerdbank.Zcash.App\ViewModels\FirstLaunchViewModel.cs:29,28	C#
 	0x6 in CompiledAvaloniaXaml.XamlIlHelpers.Nerdbank.Zcash.App.ViewModels.FirstLaunchViewModel,Nerdbank.Zcash.App.Greeting!Getter	C#
 	0x2A in Avalonia.Data.Core.ClrPropertyInfo.Get	C#
 	0x18 in Avalonia.Markup.Xaml.MarkupExtensions.CompiledBindings.InpcPropertyAccessor.get_Value	C#
 	0x1 in Avalonia.Markup.Xaml.MarkupExtensions.CompiledBindings.InpcPropertyAccessor.SendCurrentValue	C#
 	0x1 in Avalonia.Markup.Xaml.MarkupExtensions.CompiledBindings.InpcPropertyAccessor.SubscribeCore	C#
 	0x29 in Avalonia.Data.Core.Plugins.PropertyAccessorBase.Subscribe	C#
 	0x11C in Avalonia.Data.Core.PropertyAccessorNode.StartListeningCore	C#
 	0x3A in Avalonia.Data.Core.ExpressionNode.StartListening	C#
 	0x47 in Avalonia.Data.Core.ExpressionNode.set_Target	C#
 	0x17 in Avalonia.Data.Core.ExpressionObserver.<StartRoot>b__33_0	C#
 	0x7 in Avalonia.Reactive.AnonymousObserver<object>.OnNext	C#
 	0x2A in Avalonia.Reactive.Observable.<>c__DisplayClass2_1<System.	C#
 	0x7 in Avalonia.Reactive.AnonymousObserver<System.ValueTuple>.OnNext	C#
 	0xC in Avalonia.Reactive.SingleSubscriberObservableBase<System.ValueTuple>.PublishNext	C#
 	0x1D in Avalonia.Data.BindingBase.UpdateSignal.PropertyChanged	C#
 	0x2E in Avalonia.AvaloniaObject.RaisePropertyChanged<object>	C#
 	0x6C in Avalonia.PropertyStore.EffectiveValue<object>.RaiseInheritedValueChanged	C#
 	0x2B in Avalonia.PropertyStore.ValueStore.InheritedValueChanged	C#
 	0x5B in Avalonia.PropertyStore.ValueStore.InheritedValueChanged	C#
 	0x5B in Avalonia.PropertyStore.ValueStore.InheritedValueChanged	C#
 	0x5B in Avalonia.PropertyStore.ValueStore.InheritedValueChanged	C#
 	0x14A in Avalonia.PropertyStore.ValueStore.SetInheritanceParent	C#
 	0x41 in Avalonia.AvaloniaObject.set_InheritanceParent	C#
 	0x2 in Avalonia.StyledElement.Avalonia.Controls.ISetInheritanceParent.SetParent	C#
 	0x78 in Avalonia.Controls.Presenters.ContentPresenter.UpdateChild	C#
 	0x9 in Avalonia.Controls.Presenters.ContentPresenter.UpdateChild	C#
 	0x11 in Avalonia.Controls.Presenters.ContentPresenter.ApplyTemplate	C#
 	0x3D in Avalonia.Layout.Layoutable.MeasureCore	C#
 	0x81 in Avalonia.Layout.Layoutable.Measure	C#
 	0x3D in Avalonia.Layout.Layoutable.MeasureOverride	C#
 	0x53 in Avalonia.Layout.Layoutable.MeasureCore	C#
 	0x81 in Avalonia.Layout.Layoutable.Measure	C#
 	0x81 in Avalonia.Controls.DockPanel.MeasureOverride	C#
 	0x53 in Avalonia.Layout.Layoutable.MeasureCore	C#
 	0x81 in Avalonia.Layout.Layoutable.Measure	C#
 	0x30 in Avalonia.Layout.LayoutHelper.MeasureChild	C#
 	0x13 in Avalonia.Controls.Presenters.ContentPresenter.MeasureOverride	C#
 	0x53 in Avalonia.Layout.Layoutable.MeasureCore	C#
 	0x81 in Avalonia.Layout.Layoutable.Measure	C#
 	0x3D in Avalonia.Layout.Layoutable.MeasureOverride	C#
 	0x53 in Avalonia.Layout.Layoutable.MeasureCore	C#
 	0x81 in Avalonia.Layout.Layoutable.Measure	C#
 	0x30 in Avalonia.Layout.LayoutHelper.MeasureChild	C#
 	0x13 in Avalonia.Controls.Presenters.ContentPresenter.MeasureOverride	C#
 	0x53 in Avalonia.Layout.Layoutable.MeasureCore	C#
 	0x81 in Avalonia.Layout.Layoutable.Measure	C#
 	0x68 in Avalonia.Layout.LayoutManager.Measure	C#
 	0x18 in Avalonia.Layout.LayoutManager.ExecuteMeasurePass	C#
 	0x5 in Avalonia.Layout.LayoutManager.InnerLayoutPass	C#
 	0xB8 in Avalonia.Layout.LayoutManager.ExecuteLayoutPass	C#
 	0x38 in Avalonia.Controls.TopLevel.HandleResized	C#
 	0xD in Avalonia.Android.Platform.SkiaPlatform.TopLevelImpl.Resize	C#
 	0x20 in Avalonia.Android.AvaloniaMainActivity<Nerdbank.Zcash.App.App>.GlobalLayoutListener.OnGlobalLayout	C#
 	0x8 in Android.Views.ViewTreeObserver.IOnGlobalLayoutListenerInvoker.n_OnGlobalLayout at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/net8.0/android-34/mcw/Android.Views.ViewTreeObserver.cs:372,5	C#
 	0x8 in Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PP_V at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:26,5	C#
@AArnott AArnott added Area: App Runtime Issues in `libmonodroid.so`. needs-triage Issues that need to be assigned. labels Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: App Runtime Issues in `libmonodroid.so`. needs-triage Issues that need to be assigned.
Projects
None yet
Development

No branches or pull requests

2 participants