[Mono-bugs] [Bug 548126] New: Get cast exception when calling Runtime.GetNSObject()

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Oct 19 10:22:18 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=548126


           Summary: Get cast exception when calling Runtime.GetNSObject()
    Classification: Mono
           Product: MonoTouch
           Version: unspecified
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Runtime
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: duane at wandless.net
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Description of Problem:
Using a pre-1.2 monotouch.dll and btouch.exe.

Using btouch I generated a DLL.  I added a reference to this DLL in my project.
 At runtime I received invalid cast exception on the line from the *.g.cs file:

return (Director) Runtime.GetNSObject
(MonoTouch.ObjCRuntime.Messaging.IntPtr_objc_msgSend (objClass.Handle,
selSharedDirector.Handle));

By running btouch with the -outdir option and adding the generated *.g.cs
directly to the project everything works as expected.

Expected Results:
Having the ability to reference a DLL generated by btouch would be ideal.


Additional Information:

Director.cs file used as input to btouch.exe
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using System.Drawing;

namespace Cocos2D
{
    [BaseType (typeof (NSObject))]  
    interface Director
    {
        [Static, Export ("sharedDirector")]  
        Director SharedDirector();  
    }
}

this line in the app will cause invalid cast exception.
Cocos2D.Directory.SharedDirector();


http://code.google.com/p/cocos2d-iphone/
--gcc_flags "-L${ProjectDir} -lcocos2d -all_load -framework OpenGLES -framework
CoreGraphics -framework Foundation -framework QuartzCore -ObjC"

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list