Bug 24861 - Runtime.ConnectMethod doesn't work
Summary: Runtime.ConnectMethod doesn't work
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: master
Hardware: PC Mac OS
: Normal normal
Target Milestone: 8.8 iOS8.2/WatchKit
Assignee: Rolf Bjarne Kvinge [MSFT]
Depends on:
Reported: 2014-11-26 11:33 UTC by Rolf Bjarne Kvinge [MSFT]
Modified: 2015-03-09 22:41 UTC (History)
4 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 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 Rolf Bjarne Kvinge [MSFT] 2014-11-26 11:33:28 UTC
Test case:

class A : NSObject {
	public void Test() {
		Console.WriteLine ("Tested!");

public override bool FinishedLaunching (UIApplication app, NSDictionary options)
	var typeInfo = typeof (A);
	var methodInfo = typeInfo.GetMethod ("Test");
	Runtime.ConnectMethod (methodInfo, new Selector ("_test"));

	var a = new A ();
	Messaging.void_objc_msgSend (a.Handle, Selector.GetHandle ("_test"));
Comment 1 Arpit Jha 2014-12-01 05:09:39 UTC
 have checked this issue and observed that getting an exception of  ‘NSInvalidArgumentException Reason: ‘ 

I have followed following steps to reproduce this issue.
1.Create an iOS ->classic -> Singleview application.
2.Mentioned code of bug description  in viewcontroller.cs
3.Set pointer on ViewDidLoad () method exit.
4.Observed that breakpoints gets hit and getting an exception of ‘NSInvalidArgumentException’ 

I observed that on using mentioned code in bug description , getting an exception of ‘NSInvalidArgumentException ’ . Are you talking about the same behavior ?

Please let me know If I missed anything to reproduce it.

Screencast :  http://www.screencast.com/t/GKmWXaNQ
Ide log : https://gist.github.com/Shruti360/ad9c38b3228891abfa63
Exception Detail : https://gist.github.com/Shruti360/48e7d188396e06e548f6

Environment Info:
=== Xamarin Studio ===

Version 5.5.4 (build 15)
Installation UUID: 3d25a767-a003-4a7d-9f5e-e57987cf6cf0
	Mono 3.10.0 ((detached/92c4884)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 310000031

=== Apple Developer Tools ===

Xcode 6.2 (6736)
Build 6C86e

=== Xamarin.Mac ===

Version: (Enterprise Edition)

=== Xamarin.Android ===

Version: (Enterprise Edition)
Android SDK: /Users/mac360_xamarin/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.1   (API level 12)
		4.0.3 (API level 15)
		4.4   (API level 19)
Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

=== Xamarin.iOS ===

Version: (Enterprise Edition)
Hash: 840a925
Build date: 2014-11-16 21:03:22-0500

=== Build Information ===

Release ID: 505040015
Git revision: f93940a35458a18052f1a25e106e62ca970d9c40
Build date: 2014-11-19 15:32:41-05
Xamarin addins: dc23cbd91a3a0e1d326328e1229e86c942a49ec8

=== Operating System ===

Mac OS X 10.10.0
Darwin mac360-xamarins-Mac-mini.local 14.0.0 Darwin Kernel Version 14.0.0
    Fri Sep 19 00:26:44 PDT 2014
    root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64
Comment 2 Rolf Bjarne Kvinge [MSFT] 2014-12-01 05:27:26 UTC
Yes, the bug is the "NSinvalidArgumentException".
Comment 3 Rolf Bjarne Kvinge [MSFT] 2014-12-02 04:43:57 UTC

maccore/master: bc76f86d4d658333dc89133aaff57aacaed29f75
monotouch/master: 17ec7ec6caba60e99385ddff61b7ddd5b732e3d7

QA: unit tests were added.