Bug 7833 - Cannot get bindings project to work
Summary: Cannot get bindings project to work
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: 5.2
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2012-10-14 21:58 UTC by Dean Cleaver
Modified: 2012-10-15 10:52 UTC (History)
2 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 Dean Cleaver 2012-10-14 21:58:29 UTC
I've tried to create a new bindings project, but it simply crashes my app. I feel like I'm missing something somewhere, but I am not sure what.

I created a new bingings project called "DTDeviceSdk". It has a default namespace of DTDeviceSdk and an output of DTDeviceSdk.dll

Into that I added "libdtdev.a" and the associated linkwith.cs file it generated.

My ApiDefinition.cs has been whittled down to this (I had other methods, but removed them trying to track the problem):

using System;
using System.Drawing;

using MonoTouch.ObjCRuntime;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using MonoTouch.ExternalAccessory;

namespace DTDeviceSdk
	[BaseType (typeof (NSObject))]
	interface DTDeviceDelegate {
	[BaseType (typeof (EAAccessoryDelegate), Delegates = new string[] { "WeakDelegate" }, Events = new Type[] { typeof( DTDeviceDelegate ) } )]
	interface DTDevices {

		[Export( "delegate", ArgumentSemantic.Assign )]
		NSObject WeakDelegate { get; set; }
		[Wrap( "WeakDelegate" )]
		DTDeviceDelegate Delegate { get; set; }

This all seems to compile fine. However, in my app when I call this:

DTDevices device = new DTDevices();

The app ends, and the crash log has these 5 lines repeated over and over:

0   ...rLogicFlashValetiPhoneValet	0x00e9bc70 monotouch_trampoline (monotouch-glue.m:804)
1   ...rLogicFlashValetiPhoneValet	0x0009f788 wrapper_managed_to_native_MonoTouch_ObjCRuntime_Messaging_void_objc_msgSend_IntPtr_intptr_intptr_intptr (monotouch.dll.7.s:46164)
2   ...rLogicFlashValetiPhoneValet	0x00b362fc wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr (mscorlib.dll.7.s:152160)
3   ...rLogicFlashValetiPhoneValet	0x00dd445c mono_jit_runtime_invoke (mini.c:5786)
4   ...rLogicFlashValetiPhoneValet	0x00e4f6e0 mono_runtime_invoke (object.c:2757)

Is there something obvious I have missed?
Comment 1 Rolf Bjarne Kvinge [MSFT] 2012-10-15 05:24:52 UTC
Usually you'll get stack overflows like this when your native library wasn't linked into the finaly binary for some reason. There are a couple of reasons for this:

* Your LinkWtih attribute doesn't specify the architecture you're building for.
* The native library doesn't include a binary for the architecture you're building for.

So to track down can you attach the following:

* Your linkwith.cs file.
* The csproj file.
* Full build output (add -v -v -v to the additional mtouch arguments and then rebuild).
Comment 2 Dean Cleaver 2012-10-15 10:52:19 UTC
Looks like it was the project being compiled for Armv6/7 and the library only being for 7. The project was set to be only 7 but with the problems I was having with the selector issues I rolled back and forgot to change it again.