Bug 55603 - Follow-up to bug 52845: Satellite assemblies not loaded by app when using "Bundle assemblies into native code" even though they are now successfully mkbundled
Summary: Follow-up to bug 52845: Satellite assemblies not loaded by app when using "Bu...
Status: VERIFIED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: General (show other bugs)
Version: 7.3 (15.2)
Hardware: PC Windows
: --- major
Target Milestone: 15.3
Assignee: Marek Habersack
URL:
: 52845 56026 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-04-26 02:52 UTC by Brendan Zagaeski (Xamarin Support)
Modified: 2017-07-18 09:57 UTC (History)
7 users (show)

See Also:
Tags:
Is this bug a regression?: Yes
Last known good build: Cycle 8 SR 2 (Xamarin.Android 7.0.2.42 (501e63c))


Attachments
Test case (for Android) (24.62 KB, application/zip)
2017-04-26 02:52 UTC, Brendan Zagaeski (Xamarin Support)
Details
Logs (1.35 KB, application/x-zip-compressed)
2017-07-18 09:57 UTC, Alok Kulkarni
Details

Description Brendan Zagaeski (Xamarin Support) 2017-04-26 02:52:14 UTC
Created attachment 21778 [details]
Test case (for Android)

Follow-up to bug 52845: Satellite assemblies not loaded by app when using "Bundle assemblies into native code" even though they are now successfully mkbundled

This is a follow-up to Bug 52845 because the verification of the initial fix for that bug was somehow incomplete or incorrect.  It seems there might be a missing change in the lookup logic in the Xamarin.Android runtime that would allow the app to find the assembly automatically under the new backslash-escaped name?




## One temporary workaround

(This workaround hints at the root cause of the problem.)

Add explicit calls to `Assembly.LoadFile()` to pre-load each of the resource assemblies, using the "with name" names from the diagnostic build output.  For example, for the attached test case, add the following line to the `OnCreate()` override:

System.Reflection.Assembly.LoadFile("fr-CA\\I18nResourcesBug.resources.dll");




## Corrected verification status Bug 52845: not yet fixed for the test environment and steps to replicate from Bug 52845, Comment 3

BAD:  XamarinVS 4.5.0.415 (6caf703), Xamarin.Android 7.3.0.11 (3e46412)
BAD:  XamarinVS 4.3.0.789 (4d2ed3d), Xamarin.Android 7.1.0.43 (3a62f1e)




## BAD Results with Xamarin.Android 7.3.0.11 (3e46412) and 7.1.0.43 (3a62f1e)


- Running the .apk on device or emulator launches successfully, but the string displayed for the "[fr-CA locale]" is incorrect (not localized):

> [Default locale]:
> I18nResourcesBug string in English.

> [fr-CA locale]:
> I18nResourcesBug string in English.

- The build completes "successfully," and the mkbundle process does appear to succeed for all of the satellite assemblies.  Here is the relevant section from the diagnostic build output for this particular test case:

>  [mkbundle] C:\Program Files (x86)\MSBuild\Xamarin\Android\mkbundle.exe --dos2unix=false --nomain --i18n none --style linux -c -o obj\Release\bundles\armeabi-v7a\temp.c -oo obj\Release\bundles\armeabi-v7a\assemblies.o -z obj\Release\android\assets\I18nResourcesBug.dll obj\Release\android\assets\MyResources.dll C:\source\I18nResourcesBug\I18nResourcesBug\bin\Release\fr-CA\I18nResourcesBug.resources.dll C:\source\I18nResourcesBug\MyResources\bin\Release\fr-CA\MyResources.resources.dll obj\Release\android\assets\shrunk\Java.Interop.dll obj\Release\android\assets\shrunk\Mono.Android.dll obj\Release\android\assets\shrunk\System.Core.dll obj\Release\android\assets\shrunk\System.dll obj\Release\android\assets\shrunk\mscorlib.dll obj\Release\android\assets\shrunk\System.Threading.dll obj\Release\android\assets\shrunk\System.Runtime.dll obj\Release\android\assets\shrunk\System.Collections.dll obj\Release\android\assets\shrunk\System.Collections.Concurrent.dll obj\Release\android\assets\shrunk\System.Diagnostics.Debug.dll obj\Release\android\assets\shrunk\System.Reflection.dll obj\Release\android\assets\shrunk\System.Linq.dll obj\Release\android\assets\shrunk\System.Runtime.InteropServices.dll obj\Release\android\assets\shrunk\System.Runtime.Extensions.dll obj\Release\android\assets\shrunk\System.Reflection.Extensions.dll obj\Release\android\assets\shrunk\System.Runtime.Serialization.dll
>   [mkbundle stdout] Storing satellite assembly 'C:\source\I18nResourcesBug\I18nResourcesBug\bin\Release\fr-CA\I18nResourcesBug.resources.dll' with name 'fr-CA\\I18nResourcesBug.resources.dll'
>   [mkbundle stdout] Storing satellite assembly 'C:\source\I18nResourcesBug\MyResources\bin\Release\fr-CA\MyResources.resources.dll' with name 'fr-CA\\MyResources.resources.dll'
>   [mkbundle stdout] Storing satellite assembly 'C:\source\I18nResourcesBug\I18nResourcesBug\bin\Release\fr-CA\I18nResourcesBug.resources.dll' with name 'fr-CA\\I18nResourcesBug.resources.dll'
>   [mkbundle stdout] Storing satellite assembly 'C:\source\I18nResourcesBug\MyResources\bin\Release\fr-CA\MyResources.resources.dll' with name 'fr-CA\\MyResources.resources.dll'
>   [mkbundle stdout] Generated obj\Release\bundles\armeabi-v7a\temp.c
>   [mkbundle stdout]
>   [mkbundle stderr]
>   [CC] "C:\android-ndk-r11c\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64\bin\arm-linux-androideabi-gcc.exe" -c -o obj\Release\bundles\armeabi-v7a\temp.o -I C:\android-ndk-r11c\platforms\android-4\arch-arm\usr\include obj\Release\bundles\armeabi-v7a\temp.c
>   [cc stdout]
>   [cc stderr]
>   [LD] C:\android-ndk-r11c\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.exe --shared obj\Release\bundles\armeabi-v7a\temp.o obj\Release\bundles\armeabi-v7a\assemblies.o -o obj\Release\bundles\armeabi-v7a\libmonodroid_bundle_app.so -L C:\android-ndk-r11c\platforms\android-4\arch-arm\usr\lib -lc -lm -ldl -llog -lz
>   [ld stderr]
>   [ld stdout]



## Steps followed to test

1. Build the .apk package for the attached test case in the Release configuration on Windows:
msbuild /p:Configuration=Release /t:SignAndroidPackage I18nResourcesBug\I18nResourcesBug.csproj

2. Install the .apk on device or emulator:
adb install I18nResourcesBug\bin\Release\I18nResourcesBug.I18nResourcesBug-Signed.apk

3. Launch the app on the device or emulator by tapping the icon.




## Testing environment info

Android NDK r11c (64-bit)
Java JDK 8u121 (64-bit)

Android SDK Tools 25.2.5
Android SDK Platform-tools 25.0.3
Android SDK Build-tools 25.0.2

Microsoft Visual Studio Enterprise 2015
Version 14.0.25431.01 Update 3
Microsoft .NET Framework
Version 4.6.01586

Windows 10 (64-bit) Version 1607 (OS Build 14393.1066)
US English locale, US Eastern time zone



### Testing devices

KitKat (Android 4.4 - API 19) Visual Studio Android Emulator
Moto G3 (Android 6.0)
Comment 1 Brendan Zagaeski (Xamarin Support) 2017-04-26 03:03:49 UTC
*** Bug 52845 has been marked as a duplicate of this bug. ***
Comment 2 Brendan Zagaeski (Xamarin Support) 2017-05-05 15:47:12 UTC
*** Bug 56026 has been marked as a duplicate of this bug. ***
Comment 3 FernandoVM 2017-06-03 21:33:25 UTC
Dear, there are an estimated date to release the fix of this bug? This is a critical problem, we can't deploy localized apps. :((
Comment 5 FernandoVM 2017-06-06 17:31:37 UTC
Excellent, great news! I'm waiting to try this next version.

Thanks.
Comment 6 Alok Kulkarni 2017-07-18 09:57:07 UTC
Created attachment 23619 [details]
Logs

Verified Fixed on Build VS2015 15.3 
Microsoft Visual Studio Enterprise 2015
Version 14.0.25431.01 Update 3

Build Info : https://gist.github.com/alok-kulkarni/b9a11f678ea7cbe7b8e2d6d95efcffc4

Screencast : https://www.screencast.com/t/JyPSQFeMH0

Note You need to log in before you can comment on or make changes to this bug.