Bug 30300 - Base classes throw You_Should_Not_Call_base_In_This_Method
Summary: Base classes throw You_Should_Not_Call_base_In_This_Method
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: XI 8.10
Hardware: PC Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2015-05-21 07:21 UTC by Kent
Modified: 2015-05-21 09:00 UTC (History)
2 users (show)

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 for Bug 30300 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Kent 2015-05-21 07:21:07 UTC
The insistence of the UIKit base classes on throwing this exception makes it difficult to write decorator style classes that work reliably.

Take, for example, an attempt to write a UITableViewSource that wraps another UITableViewSource and supplements its behavior in some fashion. The wrapper needs to override all relevant methods and forward them onto the inner source. If the inner source has not overridden the method, an exception is thrown. The wrapper is forced to use RespondsToSelector to ascertain whether it is safe to make the call to the inner instance. This is onerous.

Moreover, the adapter know has a conundrum: if the inner instance does not respond to the selector, what should it do in the case where a return value is expected? It can only return default(TReturnType).

What is the advantage to the base UIKit classes throwing this exception rather than just ignoring the request or returning default(TReturnType)? Is there some way this could be made easier?
Comment 1 Udham Singh 2015-05-21 09:00:21 UTC
I have checked this issue and able to reproduce the reported behaviour. To reproduce this issue I have followed the steps mentioned below.

1. Create a simple iOS app (Single View).
2. Implement the below code in method 'FinishedLaunching'.
>var x = base.AccessibilityPerformMagicTap ();
3. Run the app and got the issue.

Screencast : http://www.screencast.com/t/4ovKDgm5f
Error Log : https://gist.github.com/Udham1/a75688fbe9159320af7d
Application output : https://gist.github.com/Udham1/d4a461daccc3ac9a7e73
Ide Log : https://gist.github.com/Udham1/1a20a1fcc9726534b8bf

Environment Info : 

=== Xamarin Studio ===

Version 5.9.2 (build 2)
Installation UUID: ce927b2a-2c07-44c5-b186-09cfdafba6dc
	Mono 4.0.1 ((detached/11b5830)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400010043

=== Apple Developer Tools ===

Xcode 6.2 (6776)
Build 6C131e

=== Xamarin.iOS ===

Version: (Enterprise Edition)
Hash: bd0e341
Branch: master
Build date: 2015-05-20 21:56:40-0400

=== Build Information ===

Release ID: 509020002
Git revision: 43735a4b905b571f69cf9428a3ea7b52aef55476
Build date: 2015-05-18 09:38:12-04
Xamarin addins: ab18ddff45f507ed74f36c2b65df9aee22e28a56

=== Operating System ===

Mac OS X 10.9.5
Darwin Xamarin76s-Mac-mini.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