iOS app no longer working in iOS Simulator after update to Xamarin 4

I upgraded to Xamarin 4 and Xamarin.iOS 9.2 yesterday and have been having problems debugging my application in the iOS Simulator ever since. I can still debug on my iOS 9 device, so this isn't a showstopper for me, but the Simulator is occasionally quite useful to be able to use for debugging purposes.

Here's the method that is throwing the unhandled exception:

public LandingPageCell (NSString cellId) : base (UITableViewCellStyle.Default, cellId)
{
    ContentView.BackgroundColor = ColorHolder.NavigationMainSections;

    this.SelectedBackgroundView = new UIView () {
        BackgroundColor = ColorHolder.NavigationMainSectionsSelected
    };

    imageView = new UIImageView ();

    headingLabel = this.TextLabel;
    headingLabel.Font = ColorHolder.Font_LandingPageTableButtons;
    headingLabel.TextColor = ColorHolder.SectionTitle;
    headingLabel.BackgroundColor = UIColor.Clear;


    imageView.ContentMode = UIViewContentMode.ScaleAspectFit;
    ContentView.Add (headingLabel);
    ContentView.Add (imageView);
}

The debugger shows that ColorHolder is an unknown identifier, and the headingLabel.Font = ColorHolder.Font_LandingPageTableButtons; statement throws System.ArgumentNullException: Value cannot be null, presumably since the right side of the statement returns null. ColorHolder is a public class in the same assembly as the code above and it just contains a bunch of public static fields that hold the UIColor and UIFont values for our app.

In ColorHolder, Font_LandingPageTableButtons is declared like this:

public static UIFont Font_LandingPageTableButtons = UIFont.FromName ("MemphisLTStd-Light", 22f);

Neither ColorHolder nor Font_LandingPageTableButtons should be null or unknown identifiers.

Can anyone provide insight into why this might be happening? This only started happening after I upgraded to the latest Xamarin libs yesterday. I'm especially confused by why this doesn't behave like .NET code in any way. Specifically, if ColorHolder is not defined, why doesn't the first statement throw an exception? Has anyone else seen any odd iOS Simulator behavior after the upgrade?

Thanks!

Posts

  • KMullinsKMullins Xamurai USMember, Xamarin Team Xamurai

    Have you tried deleting your obj and bin directories and rebuilding everything fresh? I normally do this when switching version as older bits can stick around an mess things up.

  • JustinLoveroJustinLovero USMember

    @KMullins said:
    Have you tried deleting your obj and bin directories and rebuilding everything fresh? I normally do this when switching version as older bits can stick around an mess things up.

    Hey, that worked! Thanks.

    I ran a Clean on the Solution after the upgrade and figured that was enough. I guess not.

    Cheers.

  • KMullinsKMullins Xamurai USMember, Xamarin Team Xamurai

    So glad to hear that worked for you!

Sign In or Register to comment.