Bug 39847 - Using MasterDetailPage class as a ExportRenderer does not load in Android.
Summary: Using MasterDetailPage class as a ExportRenderer does not load in Android.
Status: VERIFIED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Android (show other bugs)
Version: 2.1.0
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Rui Marinho
URL:
: 38117 42818 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-03-22 18:28 UTC by Jon Douglas [MSFT]
Modified: 2017-01-26 00:19 UTC (History)
5 users (show)

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


Attachments
MasterDetailPage (6.85 MB, application/x-7z-compressed)
2016-03-22 18:28 UTC, Jon Douglas [MSFT]
Details


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:
VERIFIED FIXED

Description Jon Douglas [MSFT] 2016-03-22 18:28:27 UTC
Created attachment 15490 [details]
MasterDetailPage

*Description:

Using the ExportRenderer functionality with a MasterDetailPage inside Xamarin.Android does not seem to load unless there is a subclass created of the parent class (MasterDetailPage).

For example:

[assembly: ExportRenderer(typeof(MasterDetailPage), typeof(masterDetailPOC.Droid.NativeDroidMasterDetail))]

Does not work in Xamarin.Android, however the iOS equivalent will work:

[assembly: ExportRenderer(typeof(MasterDetailPage), typeof(masterDetailPOC.iOS.Custom.NativeiOSMasterDetail), UIUserInterfaceIdiom.Pad)]

However we can get this to work in Xamarin.Android if we create a subclass of MasterDetailPage and then refer to that type instead:

[assembly: ExportRenderer(typeof(masterDetailPOC.mstDetail), typeof(masterDetailPOC.Droid.NativeDroidMasterDetail))] 

*Reproduction:

See the following reproduction attachment. You can open up the solution and run the Xamarin.Android project.

You will see the following definition in the NativeDroidMasterDetail.cs file. Notice that putting a breakpoint/etc in the NativeDroidMasterDetail.cs file will not be hit.

//[assembly: ExportRenderer(typeof(masterDetailPOC.mstDetail), typeof(masterDetailPOC.Droid.NativeDroidMasterDetail))] 
[assembly: ExportRenderer(typeof(MasterDetailPage), typeof(masterDetailPOC.Droid.NativeDroidMasterDetail))]

However if we swap these items:

[assembly: ExportRenderer(typeof(masterDetailPOC.mstDetail), typeof(masterDetailPOC.Droid.NativeDroidMasterDetail))] 
//[assembly: ExportRenderer(typeof(MasterDetailPage), typeof(masterDetailPOC.Droid.NativeDroidMasterDetail))]

Breakpoints are hit and the renderer are loaded just fine.

*Version Information:

Xamarin.Forms 2.1.0.2526
Xamarin.Android 6.0.2.1
Xamarin.iOS 9.4.2.24
Comment 1 Rui Marinho 2016-04-19 17:03:44 UTC
Should be fixed in 2.3
Comment 2 Parmendra Kumar 2016-05-02 17:38:51 UTC
I have checked this issue with Xamarin.Forms 2.3.0-pre2 and its working fine. 


Hence closing this issue.
Comment 3 E.Z. Hart [MSFT] 2017-01-26 00:19:01 UTC
*** Bug 38117 has been marked as a duplicate of this bug. ***
Comment 4 E.Z. Hart [MSFT] 2017-01-26 00:19:14 UTC
*** Bug 42818 has been marked as a duplicate of this bug. ***