Xamarin-macios: Localized satellite package resources are not included in app

Created on 26 Sep 2019  路  4Comments  路  Source: xamarin/xamarin-macios

Steps to Reproduce

Related Android issue - https://github.com/xamarin/xamarin-android/issues/2012

Sample project - https://github.com/mrward/Humanizer.FormsTest

  1. In the iOS simulator change the Language & Region - iPhone Language to French
  2. Build and run the sample project in the iOS simulator

Expected Behavior

App shows:

HumanizerText='hier'
CurrentUICulture=fr-FR

Actual Behavior

HumanizerText='yesterday'
CurrentUICulture=fr-FR

The iPhoneSimulator/Debug/fr folder has both the Xamarin.Forms.Platform.iOS.resources.dll and the Humanizer.resources.dll but the .app in device-builds only contains the Xamarin.Forms.Platform.iOS.resources.dll file.

The Humanizer.resources.dll files are passed to mtouch via the -r argument but seem to not be used.

Environment

VS Mac 8.2 and 8.3

Build Logs

Example Project (If Possible)

https://github.com/mrward/Humanizer.FormsTest

bug

Most helpful comment

ComputeListOfAssemblies calls ComputeSatellites using the original paths (early) and not after they are copied. IOW we don't see them as satellite assemblies...

but neither does msbuild, e.g. it's fine fo XF

Primary reference "Xamarin.Forms.Platform.iOS, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null".
        Resolved file path is "/Users/poupou/.nuget/packages/xamarin.forms/4.1.0.555618/lib/Xamarin.iOS10/Xamarin.Forms.Platform.iOS.dll".
        Reference found at search path location "{RawFileName}".
        Found related file "/Users/poupou/.nuget/packages/xamarin.forms/4.1.0.555618/lib/Xamarin.iOS10/Xamarin.Forms.Platform.iOS.pdb".
        Found related file "/Users/poupou/.nuget/packages/xamarin.forms/4.1.0.555618/lib/Xamarin.iOS10/Xamarin.Forms.Platform.iOS.pdb".
        Found satellite file "sk/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "zh-Hans/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "zh-Hant/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "pl/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "vi/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "sv/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "he/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "ms/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "da/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "ja/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "el/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "it/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "ca/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "cs/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "ru/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "ro/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "pt/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "uk/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "ar/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "hr/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "pt-br/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "hu/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "nl/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "nb/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "hi/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "de/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "ko/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "fi/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "id/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "fr/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "es/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "zh-HK/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "th/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "tr/Xamarin.Forms.Platform.iOS.resources.dll".

but not for Humanizer ...

  Primary reference "Humanizer, Version=2.7.0.0, Culture=neutral, PublicKeyToken=979442b78dfc278e".
        Resolved file path is "/Users/poupou/.nuget/packages/humanizer.core/2.7.2/lib/netstandard2.0/Humanizer.dll".
        Reference found at search path location "{HintPathFromItem}".
        This reference is not "CopyLocal" because at least one source item had "Private" set to "false" and no source items had "Private" set to "true".
        The ImageRuntimeVersion for this reference is "".

It works are runtime because they are still copied to the _right_ place so the runtime will see them as satellite - but, at build time, they are not considered as much.

Since they are not satellite assemblies, nor referenced by assemblies, they are not part of the app bundle we generated.

All 4 comments

Satellite (actually, any) assemblies bundling is handled inside mtouch/mmp

Looks like the path differs

Xamarin.Forms.Platform.iOS works

/Users/poupou/.nuget/packages/xamarin.forms/4.1.0.555618/lib/Xamarin.iOS10/Xamarin.Forms.Platform.iOS.dll
/Users/poupou/.nuget/packages/xamarin.forms/4.1.0.555618/lib/Xamarin.iOS10/ar/Xamarin.Forms.Platform.iOS.resources.dll

Humanizer.dll does not

/Users/poupou/.nuget/packages/humanizer.core/2.7.2/lib/netstandard2.0/Humanizer.dll
/Users/poupou/.nuget/packages/humanizer.core.af/2.7.2/lib/netstandard2.0/af/Humanizer.resources.dll

but the satellite assemblies are not in a subdirectory of where it's located (extra .af earlier in the path)

Each (humanizer) satellite comes from a different NuGet, which the main one depends on. That gives them unique directory names.

The /bin/iPhone[Simulator]Debug has them in the _right_ place - but (it seems) the resolver gives precedence to the original paths given to mtouch (which also makes sense as it let the user override what we would look for by default).

ComputeListOfAssemblies calls ComputeSatellites using the original paths (early) and not after they are copied. IOW we don't see them as satellite assemblies...

but neither does msbuild, e.g. it's fine fo XF

Primary reference "Xamarin.Forms.Platform.iOS, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null".
        Resolved file path is "/Users/poupou/.nuget/packages/xamarin.forms/4.1.0.555618/lib/Xamarin.iOS10/Xamarin.Forms.Platform.iOS.dll".
        Reference found at search path location "{RawFileName}".
        Found related file "/Users/poupou/.nuget/packages/xamarin.forms/4.1.0.555618/lib/Xamarin.iOS10/Xamarin.Forms.Platform.iOS.pdb".
        Found related file "/Users/poupou/.nuget/packages/xamarin.forms/4.1.0.555618/lib/Xamarin.iOS10/Xamarin.Forms.Platform.iOS.pdb".
        Found satellite file "sk/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "zh-Hans/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "zh-Hant/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "pl/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "vi/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "sv/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "he/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "ms/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "da/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "ja/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "el/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "it/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "ca/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "cs/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "ru/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "ro/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "pt/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "uk/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "ar/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "hr/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "pt-br/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "hu/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "nl/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "nb/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "hi/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "de/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "ko/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "fi/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "id/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "fr/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "es/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "zh-HK/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "th/Xamarin.Forms.Platform.iOS.resources.dll".
        Found satellite file "tr/Xamarin.Forms.Platform.iOS.resources.dll".

but not for Humanizer ...

  Primary reference "Humanizer, Version=2.7.0.0, Culture=neutral, PublicKeyToken=979442b78dfc278e".
        Resolved file path is "/Users/poupou/.nuget/packages/humanizer.core/2.7.2/lib/netstandard2.0/Humanizer.dll".
        Reference found at search path location "{HintPathFromItem}".
        This reference is not "CopyLocal" because at least one source item had "Private" set to "false" and no source items had "Private" set to "true".
        The ImageRuntimeVersion for this reference is "".

It works are runtime because they are still copied to the _right_ place so the runtime will see them as satellite - but, at build time, they are not considered as much.

Since they are not satellite assemblies, nor referenced by assemblies, they are not part of the app bundle we generated.

Was this page helpful?
0 / 5 - 0 ratings