Bug 52893 - FileImageSource is improperly used
Summary: FileImageSource is improperly used
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: iOS (show other bugs)
Version: unspecified
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-02-28 10:41 UTC by James Clancey
Modified: 2017-03-21 15:10 UTC (History)
5 users (show)

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

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:
Status:
RESOLVED FIXED

Description James Clancey 2017-02-28 10:41:30 UTC
Page Icon forces you to use FileImageSource, however it is improperly used on iOS.

https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs#L670
https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Platform.iOS/Renderers/TabbedRenderer.cs#L411

You will notice it abuses the implicit operator to cast the FileImageSource to a string instead of using the FileImageSourceHandler.


The implicit operator should be removed from the FileImageSource to prevent this from happening
https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Core/FileImageSource.cs#L26-L29
Comment 2 Chris King 2017-03-10 23:54:09 UTC
Clancey, that's a public API and would be a breaking change. Don't see how we could change that at this point. If there are bugs that result we'll just have to fix the callsites. Please talk it over with Jason if you think there's reason to push a breaking change.
Comment 3 James Clancey 2017-03-11 00:11:05 UTC
This is not a public api. It's the implementation inside the internal method: https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs#L655-L683
Comment 4 Chris King 2017-03-14 14:49:38 UTC
When you said "the implicit operator should be removed from the FileImageSource" in FileImageSource.cs I assumed you wanted that API removed even though it's public. 

What is the actual and excpeted behavior?
Comment 5 Rui Marinho 2017-03-21 15:10:25 UTC
Should be fixed on 2.3.5-pre1