[Mono-osx] Need help with Objective C Binding

Chris Waldron chris.waldron at booktrack.co
Sun Jan 22 21:10:21 UTC 2012


I'm trying to write a binding for my C# object but when I run the binding
it causes a stack overflow error.  Stepping through the debugger when it
makes that the cake to void_objc_msgSend_IntPtr is recalls the setter.

This is a snippet of my property wrapper ...

static Selector selProductIdentifier = new Selector("productIdentifier");
static Selector selSetProductIdentifier = new Selector(
"setProductIdentifier:");

public new virtual string ProductIdentifier {

    [Export ("productIdentifier", ArgumentSemantic.Copy)]

    get {

        return NSString.FromHandle
(MonoMac.ObjCRuntime.Messaging.IntPtr_objc_msgSend (this.Handle,
selProductIdentifier.Handle));

    }

     [Export ("setProductIdentifier:", ArgumentSemantic.Copy)]

    set {

        if (value == null)

            throw new ArgumentNullException ("value");


        var nsvalue = new NSString (value);

         MonoMac.ObjCRuntime.Messaging.void_objc_msgSend_IntPtr (this.Handle,
selSetProductIdentifier.Handle, nsvalue.Handle); // will call setter
recursively causing stack overflow.

        nsvalue.Dispose ();

         }

}

Has anyone here run into the same or similar problem?  Or am I missing a
step with the binding?

Thanks,
Chris.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-osx/attachments/20120123/12f81c8e/attachment.html>


More information about the Mono-osx mailing list