Bug 30687 - [Windows Phone 8.1]Embedded Images are found, but do not display
Summary: [Windows Phone 8.1]Embedded Images are found, but do not display
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Windows ()
Version: 1.4.2
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-06-02 15:31 UTC by Jon Douglas [MSFT]
Modified: 2016-04-09 01:17 UTC (History)
5 users (show)

Tags: ac windows
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Jon Douglas [MSFT] 2015-06-02 15:31:24 UTC
*Description

Following the simple tutorial found here:

http://developer.xamarin.com/guides/cross-platform/xamarin-forms/working-with/images/#Embedded_Images

EmdeddedImages do not seem to appear on Windows Phone 8.1, but they will appear on other platforms. The current work around is to use Local Images as this works just fine. Using the respective code:

using System.Reflection;
// ...
// NOTE: use for debugging, not in released app code!
var assembly = typeof(EmbeddedImages).GetTypeInfo().Assembly;
foreach (var res in assembly.GetManifestResourceNames())
    System.Diagnostics.Debug.WriteLine("found resource: " + res);

Our respective .png image is found, but does not seem to assign the stream correctly to the image source at runtime.

*Reproduction Steps

1. In the App.cs ensure the EmbeddedResourceImage(); function is the only called item in the App() ctor(Comment out others)

2. Notice that no image appears

3. Comment out EmbeddedResourceImage(); and uncomment LocalImage(); and notice that it works

4. Test other platforms as both of these methods work on all platforms but Windows Phone 8.1

*Xamarin.Forms Version

1.4.2

*Version Information

Xamarin 3.11.586

Xamarin.Android 5.1.2.1

Xamarin.iOS 8.10.1.0
Comment 2 Chris King 2015-06-02 17:26:45 UTC
Indeed. Image loads on android but not on windows.
Comment 3 Jon Douglas [MSFT] 2015-06-02 18:05:42 UTC
I'm curious as to if this limitation listed on the documentation is valid in this case:

http://developer.xamarin.com/guides/cross-platform/xamarin-forms/windows/#Limitations

Resources - due to the WinRT default trust level, embedded resource loading from a different assembly will not work unless the ReflectionPermission on the source assembly is correctly set. This permission cannot be set on PCL assemblies.
Comment 4 Jason Smith [MSFT] 2016-04-09 01:17:14 UTC
Thank you for taking the time to submit this report. After reviewing the description of this bug, we believe it no longer affects the current version of Xamarin.Forms. If you are still experiencing the issue after updating your packages, please reopen this report with an attached reproduction.
 
For your convenience, we have created some reproduction best practices viewable here: https://gist.github.com/jassmith/92405c300e54a01dcc6d

Warm regards,
Xamarin Forms Team