Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Images not appearing for Windows UWP in release mode.

I'm experiencing an issue where images do not appear. This happens ONLY in release mode and only for the UWP app.

I have tried:

  • accessing the images as Embedded Resources in the app project. This works in debug mode but not in Release.
  • accessing the images as Content, build always. This works in debug but not in Release.
  • using the built in Image control as well as FFImageLoading, with the same result- works in Debug but not in Release.
  • this seems to be regardless of the image container/ layout, it affects every image in the app.

Images work as expected for Android and iOS. I an using XF version

Does anyone have any advice on this issue, or can you refer to an issue in Bugzilla?


  • @DanielL, thanks for the info but this issue is occuring when using the standard Xamarin.Forms Image control as well as FFImageLoading image loading.

  • fabiuz84fabiuz84 USMember ✭✭

    I have a similar issue. My app is a simple app that loading a list of images on startup, and on Android working good, but on UWP ( and on Windows 8) app, when i compile in "Release" mode ( on X86,X64 and ARM platforms) , the images aren't loaded, but when I switch to "Debug" mode the images are loaded and showed correctly! My images are in PLC project and are registered as "Embedded Resources". I have other little images that I've added to platform project (UWP, ANdroid,ecc) and builded as "Content" and these are loaded correctly in any configuration also in UPW app. This is a very strange issue, i tried to clean, rebuid, build in other PC but nothing change. I've tried to change the setting of build for "Release" configuration disabling "Compiling with .NET native tool chain" and "Optimize code" but this tentative is not usefull, and after I enabled in "Debug" configuration the same options like "Release" the problem is the same, Debug config is OK and Release config has the problem with "Embedded Resources" image.

  • fabiuz84fabiuz84 USMember ✭✭

    I found a solution for the issue that i've explain before. In my case, when I go to set the ImageSource from the Embedded Resource I must pass the assembly reference that contain the resource:

    var assembly = typeof(XamFormsMVVM.DataSource.Filmography.FilmsRepository).GetTypeInfo().Assembly;
    var imageSource = ImageSource.FromResource(Source, assembly);

    (XamFormsMVVM.DataSource.Filmography.FilmsRepository depend from your project structure)

    and the image is loaded correctly.

  • Works! thanks Fabio!

  • BenjaminPoftBenjaminPoft USMember ✭✭

    I had the same problem. The images didn't appear in my UWP app so I figured out that i had to adjust the source path for images placed in the assets folder.
    You have to add "Assets/..." to the source path like:

    <Image Grid.Row="0" Aspect="AspectFit" HorizontalOptions="Center" Source="Assets/Icon.png" />

  • dpedrinhadpedrinha DEMember ✭✭✭
    edited March 2017

    Just faced the same problem.

    But there's no such thing as GetTypeInfo() anymore.

    Fortunately it's not needed anymore, it works with just typeof:
    var assembly = typeof(MyAppName.MyFolder.MyClassName); ImageSource myImageSource = ImageSource.FromResource(myImageFileName, assembly);

    Well, at least on the emulator it works on release mode, I don't have an UWP device to test it.

  • DevologyDevology GBMember ✭✭✭

    @dpedrinha I can confirm that it works on UWP in release mode.

    Here's my line...

    var imageSource = ImageSource.FromResource(Source, Assembly.GetExecutingAssembly());
Sign In or Register to comment.