Bug 7932 - User defined Runtime Attributes From IB causes a crash
Summary: User defined Runtime Attributes From IB causes a crash
Status: RESOLVED INVALID
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: 6.1.x
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-10-23 01:01 UTC by James Clancey
Modified: 2012-10-24 02:25 UTC (History)
2 users (show)

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


Attachments
TestCase (7.53 KB, application/zip)
2012-10-23 01:01 UTC, James Clancey
Details


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:
Status:
RESOLVED INVALID

Description James Clancey 2012-10-23 01:01:35 UTC
Created attachment 2775 [details]
TestCase

If you add a user defined runtime attribute to something through using Interface builder you get the following runtime error: 


Unhandled Exception:
0   KeyValueBug                         0x0008ed2e mono_handle_exception_internal_first_pass + 2190
1   KeyValueBug                         0x00090772 mono_handle_exception_internal + 1602
2   KeyValueBug                         0x000912bf mono_handle_exception + 47
3   KeyValueBug                         0x000d4232 mono_x86_throw_exception + 306
4   ???                                 0x0b496f8f 0x0 + 189362063
5   CoreFoundation                      0x013c8318 __handleUncaughtException + 728
6   libobjc.A.dylib                     0x0401b0b9 _ZL15_objc_terminatev + 86
7   libc++abi.dylib                     0x0435ca65 _ZL19safe_handler_callerPFvvE + 13
8   libc++abi.dylib                     0x0435cacd __cxa_bad_typeid + 0
9   libc++abi.dylib                     0x0435dbc2 _ZL23__gxx_exception_cleanup19_Unwind_Reason_CodeP17_Unwind_Exception + 0
10  libobjc.A.dylib                     0x0401af89 _ZL26_objc_exception_destructorPv + 0
11  CoreFoundation                      0x013c7fb1 -[NSException raise] + 17
12  Foundation                          0x01a06711 -[NSObject(NSKeyValueCoding) setValue:forUndefinedKey:] + 282
13  Foundation                          0x01987ec8 _NSSetUsingKeyValueSetter + 140
14  Foundation                          0x019879b7 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 267
15  UIKit                               0x02772573 -[UIView(CALayerDelegate) setValue:forKey:] + 168
16  Foundation                          0x019b2428 -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 412
17  UIKit                               0x02baa7e4 -[UINibKeyValuePair apply] + 70
18  libobjc.A.dylib                     0x0402e663 -[NSObject performSelector:] + 62
19  CoreFoundation                      0x0133a45a -[NSArray makeObjectsPerformSelector:] + 314
20  UIKit                               0x0293dbb3 -[UINib instantiateWithOwner:options:] + 1299
21  UIKit                               0x02802e37 -[UIViewController _loadViewFromNibNamed:bundle:] + 280
22  UIKit                               0x02803418 -[UIViewController loadView] + 302
23  UIKit                               0x02803648 -[UIViewController loadViewIfRequired] + 73
24  UIKit                               0x02803882 -[UIViewController view] + 33
25  UIKit                               0x02752a25 -[UIWindow addRootViewControllerViewIfPossible] + 66
26  UIKit                               0x02752dbf -[UIWindow _setHidden:forced:] + 368
27  UIKit                               0x02752f55 -[UIWindow _orderFrontWithoutMakingKey] + 49
28  UIKit                               0x0275bf67 -[UIWindow makeKeyAndVisible] + 65
at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging.void_objc_msgSend (intptr,intptr) <IL 0x0000a, 0x00064>
at MonoTouch.UIKit.UIWindow.MakeKeyAndVisible () [0x00010] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIWindow.g.cs:124
at KeyValueBug.AppDelegate.FinishedLaunching (MonoTouch.UIKit.UIApplication,MonoTouch.Foundation.NSDictionary) [0x00031] in /Users/Clancey/Projects/KeyValueBug/KeyValueBug/AppDelegate.cs:33
at (wrapper runtime-invoke) <Module>.runtime_invoke_bool__this___object_object (object,intptr,intptr,intptr) <IL 0x00059, 0x00185>
33  KeyValueBug                         0x0000a732 mono_jit_runtime_invoke + 722
34  KeyValueBug                         0x0016c1ce mono_runtime_invoke + 126
35  KeyValueBug                         0x0020eb88 monotouch_trampoline + 3688
36  UIKit                               0x0271f7b7 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 266
37  UIKit                               0x0271fda7 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1248
38  UIKit                               0x02720fab -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 805
39  UIKit                               0x02732315 -[UIApplication handleEvent:withNewEvent:] + 1022
40  UIKit                               0x0273324b -[UIApplication sendEvent:] + 85
41  UIKit                               0x02724cf8 _UIApplicationHandleEvent + 9874
42  GraphicsServices                    0x04d0ddf9 _PurpleEventCallback + 339
43  GraphicsServices                    0x04d0dad0 PurpleEventCallback + 46
44  CoreFoundation                      0x012b4bf5 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
45  CoreFoundation                      0x012b4962 __CFRunLoopDoSource1 + 146
46  CoreFoundation                      0x012e5bb6 __CFRunLoopRun + 2118
47  CoreFoundation                      0x012e4f44 CFRunLoopRunSpecific + 276
48  CoreFoundation                      0x012e4e1b CFRunLoopRunInMode + 123
49  UIKit                               0x027207da -[UIApplication _run] + 774
50  UIKit                               0x0272265c UIApplicationMain + 1211
at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) <IL 0x00056, 0x001f5>
at MonoTouch.UIKit.UIApplication.Main (string[],string,string) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38
at KeyValueBug.Application.Main (string[]) [0x00000] in /Users/Clancey/Projects/KeyValueBug/KeyValueBug/Main.cs:17
at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <IL 0x00049, 0x0012e>
55  KeyValueBug                         0x0000a732 mono_jit_runtime_invoke + 722
56  KeyValueBug                         0x0016c1ce mono_runtime_invoke + 126
57  KeyValueBug                         0x00170354 mono_runtime_exec_main + 420
58  KeyValueBug                         0x00175745 mono_runtime_run_main + 725
59  KeyValueBug                         0x00067985 mono_jit_exec + 149
60  KeyValueBug                         0x00203e92 main + 1986
61  KeyValueBug                         0x00003735 start + 53

[ERROR] FATAL UNHANDLED EXCEPTION: MonoTouch.Foundation.MonoTouchException: Objective-C exception thrown.  Name: NSUnknownKeyException Reason: [<UIRoundedRectButton 0xc242b70> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key styleId.
  at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging:void_objc_msgSend (intptr,intptr)
  at MonoTouch.UIKit.UIWindow.MakeKeyAndVisible () [0x00010] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIWindow.g.cs:124 
  at KeyValueBug.AppDelegate.FinishedLaunching (MonoTouch.UIKit.UIApplication app, MonoTouch.Foundation.NSDictionary options) [0x00031] in /Users/Clancey/Projects/KeyValueBug/KeyValueBug/AppDelegate.cs:33 
  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) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38 
  at KeyValueBug.Application.Main (System.String[] args) [0x00000] in /Users/Clancey/Projects/KeyValueBug/KeyValueBug/Main.cs:17
Comment 1 Sebastien Pouliot 2012-10-23 09:02:20 UTC
Not sure. I assumed you needed to create a custom class and define properties (or override SetValue) to deal with extra (user) attributes (otherwise what do they mean ?). In those cases the above exception make sense, i.e. UIRoundedRectButton tells you it does not know what to do with `styleId`.

There could be other scenarios I have not seen (not looked much into IB). If so could you share them ?
Comment 2 James Clancey 2012-10-24 02:25:29 UTC
Sebastien you are right, I need to make a call into pixate to load it first.