Bug 26208 - Android crashes when assigning a Button.Image to a FileImageSource
Summary: Android crashes when assigning a Button.Image to a FileImageSource
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.3.1
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2015-01-20 15:01 UTC by Jason Awbrey
Modified: 2015-01-30 10:58 UTC (History)
5 users (show)

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

sample project (360.78 KB, application/zip)
2015-01-20 15:04 UTC, Jason Awbrey

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:

Description Jason Awbrey 2015-01-20 15:01:51 UTC
We have an app that creates an image dynamically (from a signature pad) and writes it to local storage.  It then creates a FileImageSource and assigns it to a Button's Image property.

on iOS this works.  On Android, it crashes when the button's Image property is assigned, with this message: 

[ResourceType] No package identifier when getting value for resource number 0x00000000

the FileImageSource appears to be created successfully using the Android path.

See the attached sample project for a simple example of this issue.

Please note that in our production app we are NOT using a remote image (so we cannot use UrlImageSource), we are actually creating the image with a SignaturePad and storing it locally.
Comment 1 Jason Awbrey 2015-01-20 15:04:23 UTC
Created attachment 9422 [details]
sample project
Comment 2 Sadik Ali 2015-01-21 03:53:45 UTC
I have checked this issue and able to reproduce this. To reproduce this issue I have followed the 
sample application and instruction provided in bug description.

Steps I followed:
1. Open attached test sample in Xs.
2. Set android as startup project.
3. Build, and deploy it on emulator, it deploy successfully.
4. Click on image, observed that following error in application output:
"[ResourceType] No package identifier when getting value for resource number 0x00000000"

Here is the screencast for the same: http://www.screencast.com/t/v59ilNObNmt

Error Details: https://gist.github.com/Rajneesh360Logica/91315bb790caa956690e
Application Output: https://gist.github.com/Rajneesh360Logica/05722f81f0ec9a482c8d
Build Output: https://gist.github.com/Rajneesh360Logica/67182bbd753c0d7d7715
Ide Logs: https://gist.github.com/Rajneesh360Logica/8cc2249c37156a398e6c
Android Tolls Log: https://gist.github.com/Rajneesh360Logica/2a9ae3e05ed74158f3fc
Device Log: https://gist.github.com/Rajneesh360Logica/ba89937b4acd68e00762

Environment Info:

=== Xamarin Studio ===

Xamarin Forms:

Version 5.7.1 (build 14)
Installation UUID: 011d70a5-dede-428b-ab04-ef451c2e539d
	Mono 3.12.0 ((detached/a813491)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312000068

=== Xamarin.Android ===

Version: (Business Edition)
Android SDK: /Users/MM/Desktop/android-sdk-macosx
	Supported Android versions:
		2.1    (API level 7)
		2.2    (API level 8)
		2.3    (API level 10)
		3.1    (API level 12)
		4.0    (API level 14)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
Java SDK: /usr
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Apple Developer Tools ===

Xcode 6.1 (6604)
Build 6A1052d

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: dd1b996
Build date: 2015-01-15 15:06:20-0500

=== Xamarin.Mac ===

Version: (Business Edition)

=== Build Information ===

Release ID: 507010014
Git revision: a4dd61ad7f8b3695be4b17bcb5c3ae6b81438cf7
Build date: 2015-01-19 15:21:09-05
Xamarin addins: 081208fe3bbf40e24a562867c6c7fba20a9b94b6

=== Operating System ===

Mac OS X 10.9.5
Darwin MacMini.local 13.4.0 Darwin Kernel Version 13.4.0
    Sun Aug 17 19:50:11 PDT 2014
    root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64
Comment 3 Rui Marinho 2015-01-27 11:35:51 UTC
Hi XamarinForms doesn't support referencing a image that is not in the bundle. So the url being used from PCLStorage to construct the FileImageSource is not supported by XF framework.
Comment 4 Jason Awbrey 2015-01-30 10:58:39 UTC
This needs to be made explicitly clear in the docs.

I'd also suggest that if FileImageSource is passed a path that is not supported, it should throw an Exception.