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
Status: CONFIRMED
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime (show other bugs)
Version: XI 8.10
Hardware: PC Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-05-21 07:21 UTC by Kent
Modified: 2015-05-21 09:00 UTC (History)
2 users (show)

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


Attachments

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
Runtime:
	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: 8.10.1.61 (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

Note You need to log in before you can comment on or make changes to this bug.