Xamarin.UWP: Image from embedded resource throws “Operation is not supported on this platform” error
If you are getting the error “Operation is not supported on this platform” when you are trying to set an ImageResource from file for an image on Xamarin.UWP, then the problem comes from this line of code:
IconSource = ImageSource.FromResource("afolder.animage.jpg");
The solution: Image as Embadded Ressource shows “operation is not supported on this platform” in UWP and Release (microsoft.com)
In a short brief: You need to use the second parameter for FromResource method call. You must pass an assembly in order to success on UWP platform. iOS and Android is not affected with this error.
IconSource = ImageSource.FromResource("afolder.animage.jpg", typeof(AClassFromTheAssembly).Assembly);
Leave a Reply Cancel reply
This site uses Akismet to reduce spam. Learn how your comment data is processed.
Hi, I am András,
I am a seasoned software engineer from Budapest, Hungary with a strong focus on mobile app development using .NET MAUI and Xamarin.Forms. My expertise also extends to website building for my happy customers and other complex system designing. I am passionate about developing well-organized, maintainable software solutions.