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.

Image as Embadded Ressource shows "operation is not supported on this platform" in UWP and Release

AgredoAgredo USMember ✭✭

This line throws the error:

Image = ImageSource.FromResource("Retailer.Images.background_market.jpg");

In Debug Mode this works perfectly...

How can I fix this Problem?



  • ElvisXiaElvisXia Member, Forum Administrator, Xamarin Team Xamurai

    @Agredo And what is the error? Could you please post the error message? Detailed stacktrace or detailed codes also helps.

  • AgredoAgredo USMember ✭✭

    @ElvisXia I get this in StackStrace

    at System.Func`3.BeginInvoke(T1 arg1, T2 arg2, AsyncCallback callback, Object object) in f:\dd\ndp\fxcore\CoreRT\src\System.Private.Interop\src\System\Runtime\InteropServices\Marshal.cs:line 1402
    at Xamarin.Forms.ImageSource.FromResource(String resource, Assembly sourceAssembly)
    at Retailer.ViewModels.UserLogInPageViewModel.SetAllUIProperties() in C:\Users\chris\Documents\Projects\RetailApp\Retailer\Retailer\Retailer\ViewModels\UserLogInPageViewModel.cs:line 157

    Source is: "System.Private.CoreLib"

  • ElvisXiaElvisXia Member, Forum Administrator, Xamarin Team Xamurai

    @Agredo Could you please share more detailed Stacktrace? This Stacktrace missed the important exception or error message.

  • AgredoAgredo USMember ✭✭
    edited July 2018

    @ElvisXia I dont hove a more detailed StackTrace. I put this line into a try bracket and cached the exeption in release mode of the App. (this happens only in release mode for UWP apps)

    I forgot a important information!

    I bind the property Image :

    <Image. Source="{Binding Image}" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" Aspect="AspectFill"/>

  • ElvisXiaElvisXia Member, Forum Administrator, Xamarin Team Xamurai
    edited July 2018

    @Agredo , I'm not able to reproduce the problem. Could you share a basic demo through online repo that can reproduce this issue?

  • DevologyDevology GBMember ✭✭✭

    This works on UWP in debug and release mode

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