maui: Resx file does not produce designer file, application is crashing

Description

Hello there!

I’m in the process of migration TaskLoaderView to MAUI, it was going alright till I launch the app for the first time. It crashed right after the Splashscreen. It was complaining about my resx file (located in Resources\Localization\SampleResources.resx), not being embedded in the resources… After that I tried a few things, and now it seems even worst: it crashes before the splash, when loading resources assemblies:

[monodroid-assembly] open_from_bundles: failed to load assembly en-US/Retronado.Maui.resources.dll
[monodroid-assembly] open_from_bundles: failed to load assembly en-US/Retronado.Maui.resources.dll
[monodroid-assembly] open_from_bundles: failed to load assembly en/Retronado.Maui.resources.dll
[monodroid-assembly] open_from_bundles: failed to load assembly en/Retronado.Maui.resources.dll
[.retronado.mau] * Assertion: should not be reached at /__w/1/s/src/mono/mono/mini/mini-exceptions.c:456
[libc] Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 9031 (.retronado.maui), pid 9031 (.retronado.maui)

I think it is related to the resx file, cause It fails to generate the design file when building the project on Rider EAP AND on VS Mac Preview.

Steps to Reproduce

Here is the repo sample:

https://github.com/roubachof/Sharpnado.TaskLoaderView/tree/failing-resx

  • Project is Retronado.Maui
  • The resx is Resources\Localization\SampleResources.resx

Version with bug

6.0 (current) VS for Mac preview 17.3 build 191

Last version that worked well

Unknown/Other

Affected platforms

Android, I was not able test on other platforms

Affected platform versions

Android 21 and up, probably iOS, since resx doesn’t generate anything

Did you find any workaround?

nope

Relevant log output

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 21 (7 by maintainers)

Most upvoted comments

So the error is:

System.Resources.MissingManifestResourceException: Could not find the resource "Sample.Localization.SampleResources.resources" among the resources "Retronado.Maui.Resources.Localization.SampleResources.resources", "Retronado.Maui.App.xaml", "Retronado.Maui.MainPage.xaml", "Retronado.Maui.Platforms.Windows.App.xaml", "Retronado.Maui.Resources.Styles.Colors.xaml", "Retronado.Maui.Resources.Styles.Global.xaml", "Retronado.Maui.Resources.Styles.Icons.xaml", "Retronado.Maui.Resources.Styles.Sizes.xaml", "Retronado.Maui.Resources.Styles.StylesGameView.xaml", "Retronado.Maui.Resources.Styles.Text.xaml", ... embedded in the assembly "Retronado.Maui", nor among the resources in any satellite assemblies for the specified culture. Perhaps the resources were embedded with an incorrect name.

I see the .resources file in here with a different name: image

The file in there matches the $(RootNamespace) of this project:

<EmbeddedResource Update="Resources\Localization\SampleResources.resx">

Are you somehow bringing in the source code for this class within this assembly?

image

I don’t really understand how these projects are setup, but it looks like Samples.csproj is expecting the .resources file to be named based on its $(RootNamespace). Your app has the $(RootNamespace) of Retronado.Maui.

We have some tests in .NET 6 for .resx, so it seems like they are generally working:

https://github.com/xamarin/xamarin-android/blob/main/tests/Mono.Android-Tests/Localization/LocalizationTests.cs