migueldeicaza / MonoTouch.Dialog

Tools to simplify creating dialogs with the user using MonoTouch
MIT License
431 stars 211 forks source link

JSON ontap NullReferenceExeption #128

Closed Wautvda closed 10 years ago

Wautvda commented 12 years ago

Every time I try to use the ontap attribute in a JSON file to create the markup for a monotouch Dialog my application throws a nullreferenceExeption. I've also tried it with the code from this solution and it gives the same error:

System.NullReferenceException: Object reference not set to an instance of an object at MonoTouch.Dialog.JsonElement+cAnonStoreyC.<>m15 () [0x00000] in :0 at MonoTouch.Dialog.StringElement.Selected (MonoTouch.Dialog.DialogViewController dvc, MonoTouch.UIKit.UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath) [0x00000] in :0 at MonoTouch.Dialog.DialogViewController.Selected (MonoTouch.Foundation.NSIndexPath indexPath) [0x00000] in :0 at MonoTouch.Dialog.DialogViewController+Source.RowSelected (MonoTouch.UIKit.UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath) [0x00000] in :0 at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr) at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00042] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:29 at Synergy.Application.Main (System.String[] args) [0x00000] in /Users/mac01/Dropbox/Stage ESC/Synergy/Synergy/Main.cs:18

dmacd commented 12 years ago

Just ran in to a similar issue. Using nearly identical code in my own assembly, the reflection call find the right class and works fine. But when trying to reference my class from within the MonotTouch.Dialog assembly it fails. Type.GetType is returning null for my type, possibly because it isnt looking outside its own assembly or the calling assembly (which I figured would contain my code, but I guess not). Not really sure how to resolve this besides just reimplementing it in my own code.

timrisi commented 10 years ago

I'm able to use the ontap attribute successfully on the current master