All controls are instance variables so they can be disposed later. But it's the 
NavigationController that's null - this just happened to execute inside the 
button click event.

My concern is this is a "1 in 1000" problem where 999 times it works fine, then 
something I can't explain like this happens.

Dino

From: [email protected] 
[mailto:[email protected]] On Behalf Of Tony Pujals
Sent: Friday, August 26, 2011 3:13 PM
To: 'Forums, MonoTouch'
Subject: Re: [MonoTouch] How do I fix this?

Is your button with your handler getting declared inside a method or as an 
instance variable. See my answer on stackoverflow:

http://stackoverflow.com/questions/5665297/problem-with-navigationitem-rightbarbuttonitem-after-last-update/6038606#6038606

I think this will help. Feel free to vote it up if it does.

Good luck,

Tony

Tony Pujals | Lead Developer
Office: 408-236-7376 | Visit us at: www.subfuzion.com<http://www.subfuzion.com/>

[Description: Description: SubfuzionLogoSmall]<http://www.subfuzion.com/>
560 S. Winchester Blvd, 5th Floor,  San Jose, CA 95128

From: 
[email protected]<mailto:[email protected]> 
[mailto:[email protected]]<mailto:[mailto:[email protected]]>
 On Behalf Of Dean Cleaver
Sent: Friday, August 26, 2011 12:56 PM
To: Forums, MonoTouch 
([email protected]<mailto:[email protected]>)
Subject: [MonoTouch] How do I fix this?

System.NullReferenceException: Object reference not set to an instance of an 
object
at 
KleverLogic.FlashValet.iPhone.Valet.UpdatePhoneViewController.HandleUpdatePhoneButtonClicked
 (System.Object sender, System.EventArgs e) [0x00015] in 
/xsl-home/kleverlogic/FlashValet/Mobile/iPhone/Valet/UpdatePhoneViewController.cs:86

Seems simple enough... but.

this.NavigationController.NavigationBarHidden = true;

This code has been working for 2 or 3 months, and just now got a dozen or so 
errors like above - how could this be possible? It's a view used once on login, 
it is pretty basic (one label, one text field, one button) and has worked 
flawlessly for months. Still works perfectly on my phone, but clearly one of my 
clients is having problems because the NavigationController is null - but how 
can it be?

Dino

<<inline: image001.png>>

_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to