Bug 35846 - Wrong signature for UIPopoverPresentationControllerDelegate.WillRepositionPopover
Summary: Wrong signature for UIPopoverPresentationControllerDelegate.WillRepositionPop...
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: XI 9.1 (iOS 9.1)
Hardware: PC Mac OS
: Normal normal
Target Milestone: (C7)
Assignee: Bugzilla
Depends on:
Reported: 2015-11-13 15:23 UTC by Jimmy
Modified: 2016-06-03 13:21 UTC (History)
4 users (show)

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

Project to Reproduce the Issue (14.26 KB, application/zip)
2015-11-13 15:23 UTC, Jimmy

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:

Description Jimmy 2015-11-13 15:23:55 UTC
Created attachment 13808 [details]
Project to Reproduce the Issue

The targetRect and inView parameters to WillRepositionPopover should be defined with "ref".

The current signature results in an exception when overridden in a derived class:

public override void WillRepositionPopover(UIPopoverPresentationController popoverPresentationController, CGRect targetRect, UIView inView)

Exception thrown:
System.ExecutionEngineException: Invalid type encoding for parameter
  at at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args, IntPtr principal, IntPtr delegate) [0x00005] in /Users/builder/data/lanes/2077/1d27ac2c/source/maccore/src/UIKit/UIApplication.cs:74
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/builder/data/lanes/2077/1d27ac2c/source/maccore/src/UIKit/UIApplication.cs:58
  at PopoverDelegateBugRepro.Application.Main (System.String[] args) [0x00008] in /Users/jhutson/Projects/PopoverDelegateBugRepro/Main.cs:20

Attached is a repro project PopoverDelegateBugRepro. Tap the "Show Popover" button, then rotate the device.

Xamarin Studio
Version 5.9.8 (build 0)
Installation UUID: 35c84030-f8d3-4c6e-aca1-31c699d3bb14
	Mono 4.0.5 ((detached/1d8d582)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400050001

Version: (Business Edition)
Android SDK: /Users/jhutson/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		2.3    (API level 10)
		4.0.3  (API level 15)
		4.4    (API level 19)
		4.4.87 (API level 20)
Java SDK: /usr
No Java runtime present, requesting install.

Xamarin Android Player
Not Installed

Apple Developer Tools
Xcode 7.1 (9079)
Build 7B91b

Version: (Business Edition)
Hash: bae2cdb
Branch: master
Build date: 2015-11-09 17:44:57-0500

Not Installed

Build Information
Release ID: 509080000
Git revision: cc5f6e5658589ca7f46210c57fad947e75f30abd
Build date: 2015-10-21 19:27:41-04
Xamarin addins: d77f191bd7d3451adf837b85b38f2b7c60004400

Operating System
Mac OS X 10.10.5
Darwin mymac 14.5.0 Darwin Kernel Version 14.5.0
    Tue Sep  1 21:23:09 PDT 2015
    root:xnu-2782.50.1~1/RELEASE_X86_64 x86_64
Comment 1 Jimmy 2015-11-13 15:26:01 UTC
In the repro project, open the PopoverPresentationControllerDelegate.cs file for details on the repro and proposed new method signature.
Comment 2 Sebastien Pouliot 2015-11-16 17:42:41 UTC
Yes, it's a bug (bad signature) and the one you provided is the right one.
Comment 3 Sebastien Pouliot 2015-11-16 20:46:41 UTC
Fixed in maccore/master fb7375fede5dec0499e57a1fb2d25c963d25c18c