Bug 28757 - IUITableViewDataSource required methods not exported to derived class [On device only]
Summary: IUITableViewDataSource required methods not exported to derived class [On dev...
Status: VERIFIED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: XI 8.8.0
Hardware: PC Mac OS
: --- normal
Target Milestone: 8.10.1 (C5SR1)
Assignee: Rolf Bjarne Kvinge [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2015-04-03 17:36 UTC by Jon Goldberger [MSFT]
Modified: 2015-05-01 10:31 UTC (History)
6 users (show)

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


Attachments
Test Project (12.19 KB, application/zip)
2015-04-03 17:36 UTC, Jon Goldberger [MSFT]
Details
Test case for QA (11.02 KB, application/zip)
2015-04-07 08:30 UTC, Rolf Bjarne Kvinge [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 Goldberger [MSFT] 2015-04-03 17:36:17 UTC
Created attachment 10630 [details]
Test Project

## Description

On device only, if you have a subclass of UIViewController, call it BaseViewController, that has a UITableView in it, and the BaseViewController implements the IUITableViewDataSource interface with the required methods marked as "virtual" to allow further subclassing of BaseViewController, then when a derived class, call it DerivedViewController, is instantiated and used, the BaseViewController implementations of GetCell() and RowsInSection() are called rather than the  DerivedViewController implementations. 

This can be worked around by either:

a) Having the DerivedViewController inherit directly from IUITableViewDataSource

or b) Manually exporting, with the Export attribute, the GetCell() and RowsInSection() implementations in BaseViewController

## Steps to reproduce

1. Open the attached test project and deploy to a physical device.

Expected result: Table view will show three rows with the text "Derived class methods called"

Actual result: One row is displayed with text "Base class methods called"

2. Now change the definition of the TestTableViewDelegatesViewController class to:
public partial class TestTableViewDelegatesViewController : MyTableViewController, IUITableViewDataSource
{...}

3. Deploy to a device.

Expected result: table view will show three rows with the text "Derived class methods called"

Actual result: As expected.

## Notes

tested using an iPhone 5s running iOS 8.2. Reporting customer (noted below in private comment) tested on iPod touch 5g, iPhone 5c and iPhone 6 with same results. 

## My environment:

=== Xamarin Studio ===

Version 5.8.1 (build 8)
Installation UUID: 2dc9022f-f9a8-424f-8284-bf224cbbfde0
Runtime:
	Mono 3.12.1 ((detached/b63df7d)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312010002

=== Apple Developer Tools ===

Xcode 6.2 (6776)
Build 6C131e

=== Xamarin.Mac ===

Version: 1.12.0.14 (Business Edition)

=== Xamarin.Android ===

Version: 4.20.1.0 (Business Edition)
Android SDK: /Users/apple/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		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.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode)

=== Xamarin Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Xamarin.iOS ===

Version: 8.8.1.9 (Business Edition)
Hash: 7e1f69e
Branch: 
Build date: 2015-03-12 15:35:49-0400

=== Build Information ===

Release ID: 508010008
Git revision: f8e52bf493869b6a320a95400553dc9ea8b7ef22
Build date: 2015-03-13 16:16:49-04
Xamarin addins: 84d611cc17567a68daad719327e90af06d2ae327

=== Operating System ===

Mac OS X 10.10.2
Darwin Jons-iMac.local 14.1.0 Darwin Kernel Version 14.1.0
    Thu Feb 26 19:26:47 PST 2015
    root:xnu-2782.10.73~1/RELEASE_X86_64 x86_64
Comment 2 Sebastien Pouliot 2015-04-06 10:24:55 UTC
That sounds like a registration issue -> Rolf
Comment 3 Rolf Bjarne Kvinge [MSFT] 2015-04-07 08:17:31 UTC
Fixed.

maccore/master: ff74d2d474f5c859d90abe2ce1330092f57da8c6.
Comment 4 Rolf Bjarne Kvinge [MSFT] 2015-04-07 08:30:42 UTC
Created attachment 10651 [details]
Test case for QA

The initial test case has the workaround applied, so I'm uploading a new test case that fails without any code changes.
Comment 6 Dylan Kelly 2015-04-23 15:09:29 UTC
Confirmed bug in sample on Xamarin.iOS Version: 8.8.2.7

Verified fix in sample on Xamarin.iOS Version: 8.11.0.478
Comment 7 Rolf Bjarne Kvinge [MSFT] 2015-04-29 08:19:25 UTC
Backported.

maccore/macios-cycle5: 30e6ddf3707643d6d95cd78a720ec0cb6f4225aa
Comment 8 Shruti 2015-05-01 10:31:40 UTC
Before verifying first I reproduced this issue with X.iOS build 8.10.0.156 and when I deploy the attached project to device then observed that One row is displayed with text "Base class methods called".  Now I  changed the definition of the TestTableViewDelegatesViewController class
to public partial class TestTableViewDelegatesViewController :
MyTableViewController, IUITableViewDataSource. then got the expected behaviour that is table view will show three rows with the text "Derived class methods called"

Also, Verified this issue with latest C5 X.iOS 8.10.1.9 and observed that Table view showing three rows with the text "Derived class methods called" in both cases.

Environment Info :
=== Xamarin Studio ===

Version 5.9 (build 436)
Installation UUID: 67eaf3b4-f8a7-4ab4-a9df-3197350ca5dc
Runtime:
	Mono 4.0.1 ((detached/373d684)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400000009

=== Apple Developer Tools ===

Xcode 6.3 (7569)
Build 6D570

=== Xamarin.iOS ===

Version: 8.10.1.8 (Enterprise Edition)
Hash: d534256
Branch: master
Build date: 2015-05-01 04:08:38-0400

=== Xamarin.Android ===

Version: 5.1.0.119 (Enterprise Edition)
Android SDK: /Users/ixamarin78/Desktop/android-sdk-macosx
	Supported Android versions:
		2.3    (API level 10)
		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.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

=== Xamarin Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Xamarin.Mac ===

Version: 2.0.0.273 (Enterprise Edition)

=== Build Information ===

Release ID: 509000436
Git revision: 7e8ba4cbccf7b188ce5e80a90fdc4acdedb5a83f
Build date: 2015-04-28 12:01:46-04
Xamarin addins: 21fd95f743742c5237e22023996c2800ce3f8db3

=== Operating System ===

Mac OS X 10.10.3
Darwin XamnewiMac.local 14.3.0 Darwin Kernel Version 14.3.0
    Mon Mar 23 11:59:05 PDT 2015
    root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64

Hence, I am closing this issue.