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

Question
-
User211159 posted
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?
Friday, July 6, 2018 10:20 PM
All replies
-
User368901 posted
@Agredo And what is the error? Could you please post the error message? Detailed stacktrace or detailed codes also helps.
Monday, July 9, 2018 8:10 AM -
User211159 posted
@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"
Monday, July 9, 2018 8:35 PM -
User368901 posted
@Agredo Could you please share more detailed Stacktrace? This Stacktrace missed the important exception or error message.
Tuesday, July 10, 2018 12:11 AM -
User211159 posted
@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 :
Wednesday, July 11, 2018 4:57 PM -
User368901 posted
@Agredo , I'm not able to reproduce the problem. Could you share a basic demo through online repo that can reproduce this issue?
Thursday, July 12, 2018 1:29 AM -
User125363 posted
This works on UWP in debug and release mode
var imageSource = ImageSource.FromResource(Source, Assembly.GetExecutingAssembly());
Wednesday, October 7, 2020 3:35 PM