Bug 37743 - registrar.m: error: assigning to 'SEL' from incompatible type 'id' (TODO: return delegate)
Summary: registrar.m: error: assigning to 'SEL' from incompatible type 'id' (TODO: ret...
Status: RESOLVED DUPLICATE of bug 34440
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: XI 9.4 (iOS 9.2)
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Rolf Bjarne Kvinge [MSFT]
Depends on:
Reported: 2016-01-16 06:07 UTC by Frank A. Krueger
Modified: 2016-01-18 10:27 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 Frank A. Krueger 2016-01-16 06:07:29 UTC
When compiling my app for the device, I get the following registrar errors.

The app compiles fine and runs on the simulator.

		TODO: return delegate
		TODO: return delegate
		TODO: return delegate
		Process exited with code 1, command:
		/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang  -gdwarf-2 -I/Library/Frameworks/Xamarin.iOS.framework/Versions/ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk -Qunused-arguments -miphoneos-version-min=9.2 -arch arm64 -c -DDEBUG  -o /Users/fak/Dropbox/Projects/Upsight/Upsight.iOS/obj/iPhone/Debug/mtouch-cache/registrar.arm64.o -Wno-receiver-forward-class -x objective-c++ /Users/fak/Dropbox/Projects/Upsight/Upsight.iOS/obj/iPhone/Debug/mtouch-cache/registrar.m
		/Users/fak/Dropbox/Projects/Upsight/Upsight.iOS/obj/iPhone/Debug/mtouch-cache/registrar.m:6585:7: error: assigning to 'SEL' from incompatible type 'id'
		                res = retobj;
		                    ^ ~~~~~~

Full Build Log: http://pastebin.com/YsjDcZtP

=== Xamarin Studio ===

Version 5.10.1 (build 6)
Installation UUID: e51e2705-c52a-4ae8-aa07-c481d6ab8a7a
	Mono 4.2.1 (explicit/6dd2d0d)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 402010102

=== Xamarin.Profiler ===

Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Apple Developer Tools ===

Xcode 7.2 (9548)
Build 7C68

=== Xamarin.iOS ===

Version: (Enterprise Edition)
Hash: 7322991
Branch: master
Build date: 2015-12-08 16:20:29-0500

=== Xamarin.Android ===

Version: (Enterprise Edition)
Android SDK: /Users/fak/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)
		5.0   (API level 21)
		6.0   (API level 23)

SDK Tools Version: 24.4.1
SDK Platform Tools Version: 23.1
SDK Build Tools Version: 23.0.2

Java SDK: /usr
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)

=== Xamarin Android Player ===

Version: 0.6.5
Location: /Applications/Xamarin Android Player.app

=== Xamarin.Mac ===

Version: (Enterprise Edition)

=== Xamarin Inspector ===

Hash: 1b526e6
Branch: master
Build date: Tue Nov 17 20:54:30 UTC 2015

=== Build Information ===

Release ID: 510010006
Git revision: 0b60eecdb531933734519c13257d16a780274aab
Build date: 2015-12-04 20:28:20-05
Xamarin addins: 9876fd7c9837977178411ec7375b4352c0a0d6af
Build lane: monodevelop-lion-cycle6-baseline

=== Operating System ===

Mac OS X 10.11.2
Darwin lepton.local 15.2.0 Darwin Kernel Version 15.2.0
    Fri Nov 13 19:56:56 PST 2015
    root:xnu-3248.20.55~2/RELEASE_X86_64 x86_64
Comment 1 Frank A. Krueger 2016-01-16 06:33:15 UTC
This class repros the bug:

type MyAccessibilityCustomAction()=
    inherit UIKit.UIAccessibilityCustomAction()
    override x.get_Selector()=
        printfn "get_Selector"
    override x.set_Selector(value)=
        printfn "set_Selector %O" value
Comment 2 Frank A. Krueger 2016-01-16 06:54:20 UTC
This is the register function that's failing:

static SEL native_to_managed_trampoline_173 (id self, SEL _cmd, MonoMethod **managed_method_ptr, const char *r0, const char *r1)
	MonoMethod *managed_method = *managed_method_ptr;
	void *arg_ptrs [0];
	MonoObject *mthis;
	if (mono_domain_get () == NULL)
		mono_jit_thread_attach (NULL);
	mthis = NULL;
	if (self) {
		mthis = xamarin_get_managed_object_for_ptr_fast (self);
	if (!managed_method) {
		managed_method = xamarin_get_reflection_method_method (xamarin_get_method_direct(r0, r1, 0, NULL));
		*managed_method_ptr = managed_method;
	xamarin_check_for_gced_object (mthis, _cmd, self, managed_method);
	MonoObject * retval = mono_runtime_invoke (managed_method, mthis, arg_ptrs, NULL);

	SEL res;
	if (!retval) {
		res = NULL;
	} else {
		id retobj;
		retobj = xamarin_get_handle_for_inativeobject ((MonoObject *) retval);
		xamarin_framework_peer_lock ();
		[retobj retain];
		xamarin_framework_peer_unlock ();
		[retobj autorelease];
		mt_dummy_use (retval);
		res = retobj;

	return res;
Comment 3 Rolf Bjarne Kvinge [MSFT] 2016-01-18 10:27:10 UTC
Frank, this is fixed in the XI version in the alpha channel (9.4.1).

*** This bug has been marked as a duplicate of bug 34440 ***