Forum Xamarin Xamarin.iOS

System.Reflection.TargetInvocationException

JustinHoweJustinHowe USMember ✭✭

Hi all,

I have the following code which is throwing a System.Reflection.TargetInvocationException of "Loading..." when a button is pressed that calls this popover view. If I comment out the object reference for query, it's fine. What gives?

using System;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using System.IO;

namespace StudentAssistant
{
    public partial class WorkbookSaveController : UIViewController
    {
        public ParseQuery query = new ParseQuery();

        public WorkbookSaveController (IntPtr handle) : base (handle)
        {
        }

        public override void ViewDidLoad ()
        {
            base.ViewDidLoad ();



            btnSave.TouchUpInside += (sender, e) =>
            {
                if (txtSaveAs.Text != null) {
                    var saveAsName = Convert.ToString(txtSaveAs.Text);

                    query.SaveImage(saveAsName);

                } else {
                    new UIAlertView ("Error","Please specify a save as name!", null, "Ok", null).Show ();
                }
            };  

        }
    }
}

Posts

  • JohnMillerJohnMiller USForum Administrator, Xamarin Team Xamurai

    @JustinHowe,

    You could get a better idea of the problem from the inner exception and stack trace. Can you provide those?

    (although Im sure someone else can look at this and see the problem more quickly)

  • JustinHoweJustinHowe USMember ✭✭

    Thanks @John, that helped me find the problem. The stack trace took about a minute to load, and until then showed "Loading...". Since it took a while, I thought it wasn't going to show anything. I grabbed a drink and by the time I was back, the very end showed me the line of code that caused the problem.

  • JohnMillerJohnMiller USForum Administrator, Xamarin Team Xamurai

    @JustinHowe,

    Nice!

Sign In or Register to comment.