Bug 16468 - You_Should_Not_Call_base_In_This_Method exception
Summary: You_Should_Not_Call_base_In_This_Method exception
Status: VERIFIED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: 7.0.4.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: 7.0.6
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-11-26 16:54 UTC by onureren
Modified: 2013-12-16 12:21 UTC (History)
3 users (show)

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

Description onureren 2013-11-26 16:54:43 UTC
UISegmentedControl which is used to switch between the views of a UITabController which is hidden (see the code below). It was working until a few days ago. But now it throws You_Should_Not_Call_base_In_This_Method exception on the line where tabs.selectedIndex is set.

The weird part is, I didn't make any change in this implementation (the only thing I remember is updating the Xamarin version). Besides it still works in simulator but fails on device.

Code sample:

segmentControl.ValueChanged += (sender, e) => { var selectedSegmentId = (sender as UISegmentedControl).SelectedSegment;

            if(selectedSegmentId.Equals(0)){
                segmentControl.SetImage (UIImage.FromFile ("mapsinglepassive.png"), 0);
                segmentControl.SetImage (UIImage.FromFile ("listsingleactive.png"), 1);
                this.tabs.SelectedIndex = 1;
            }else {
                segmentControl.SetImage (UIImage.FromFile ("mapsingleactive.png"), 0);
                segmentControl.SetImage (UIImage.FromFile ("listsinglepassive.png"), 1);
                this.tabs.SelectedIndex = 0;
            }
        };

Exception detail:

Instance {MonoTouch.Foundation.You_Should_Not_Call_base_In_This_Method: Exception of type 'MonoTouch.Foundation.You_Should_Not_Call_base_In_This_Method' was thrown.
    at MonoTouch.MapKit.MKMapViewDelegate.RegionChanged (MonoTouch.MapKit.MKMapView mapView, Boolean animated) [0x00000] in /Developer/MonoTouch/Source/monotouch/src/MapKit/.pp-MKMapViewDelegate.g.cs:375
    at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging:void_objc_msgSendSuper_int (intptr,intptr,int)
    at MonoTouch.UIKit.UITabBarController.set_SelectedIndex (Int32 value) [0x0002b] in /Developer/MonoTouch/Source/monotouch/src/UIKit/.pp-UITabBarController.g.cs:238
    at PathiApp.HomeViewController+<ViewDidLoad>c__AnonStorey1F.<>m__30 (System.Object sender, System.EventArgs e) [0x00053] in /Users/onureren/Desktop/PathiApp/PathiApp/Screens/HomeViewController.cs:83
    at MonoTouch.UIKit.UIControlEventProxy.Activated () [0x00000] in /Developer/MonoTouch/Source/monotouch/src/UIKit/.pp-UIControl.cs:30
    at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
    at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/.pp-UIApplication.cs:38
    at PathiApp.Application.Main (System.String[] args) [0x00008] in /Users/onureren/Desktop/PathiApp/PathiApp/Main.cs:16 } MonoTouch.Foundation.You_Should_Not_Call_base_In_This_Method
Comment 1 Sebastien Pouliot 2013-11-26 17:16:08 UTC
When you set (change) the `SelectedIndex` of a `UITabController` you're effectively hiding an existing view controller and then showing a new one.

The exception comes from a `MKMapViewDelegate` - so it's likely that the hidden/shown view controller has a `MKMapView`. One that use a delegate where a *required* member is not provided (RegionChanged from the stack trace) an actual implementation.

So this likely comes from a change inside one of the view controllers. The fact that i works on the simulator is (likely) because the MapView region does not change (unless you simulate a different location).

There's not much I can tell you without having the source code.
Comment 2 onureren 2013-11-28 13:41:36 UTC
@Sebastien Pouliot thanks a lot, you are right! the problem is fixed after I add RegionChanged method.
Comment 3 PJ 2013-12-11 18:45:41 UTC
This fix is planned to be released with Xamarin.iOS 7.0.6, which should hit the beta channel before December 23rd.
Comment 4 Mohit Kheterpal 2013-12-16 12:21:55 UTC
As per comment 2, this issue is resolved.
Hence closing this issue.