Bug 13243 - App crash when valueForKey cannot find the given key
Summary: App crash when valueForKey cannot find the given key
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: 6.2.x
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Rolf Bjarne Kvinge [MSFT]
Depends on:
Reported: 2013-07-15 01:25 UTC by Prashant Cholachagudda
Modified: 2013-07-24 06:23 UTC (History)
3 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Prashant Cholachagudda 2013-07-15 01:25:41 UTC
Consider that you have the following simple code in the main view

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

var test = this.ValueForKey(new NSString("test"));

This will cause the app to hung, or crash immediately. Note that this issue occurs only when running in device.

Current result:
* The code this.ValueForKey(new NSString("test")); causes app to hung or
crash immediately.

Expected result: 
* Since the key "test" cannot be found, it should raise
NSUndefinedKeyException. With the above code, it should be caught properly
in the catch block.
* The app continues to run without crash or hung.
Comment 2 Rolf Bjarne Kvinge [MSFT] 2013-07-24 06:23:20 UTC

monotouch/master-3.0: 95f214dddd59692eb1fd49cb66aef3423322a525

QA: test case included in automated unit tests.