Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
Whenever I try to load a nib file that contains custom classes using (for example) the following piece of code:
var views = NSBundle.MainBundle.LoadNib("TTMainSideMenuCell",null,null);
TTMainSideMenuCell cell = Runtime.GetNSObject( views.ValueAt(0) ) as TTMainSideMenuCell;
I get the exception:
Objective-C exception thrown. Name: NSUnknownKeyException Reason: [<UITableViewCell 0x79bdddd0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key mainBadgeView
This piece of code worked fine before switching to the Unified API and updating the outlets in XCode still
updates the designer file of the TTMainSideMenuCell class.
For some reason the LoadNib method seems to be trying to hook up the outlets on the file's owner (which is null, as intended) instead of the TTMainSideMenuCell class as it did before.
This issue only occurs when the interface definition contains custom classes. When using a non-inherited UITableViewCell and other readily available classes in UIKit loading the nib works fine.
Just before the exception occurs the following errors appear in the output indicating that the custom classes in the interface definition cannot be found.
Unknown class TTMainSideMenuCell in Interface Builder file.
Unknown class MKBadgeView in Interface Builder file.
The classes shown in this error are both managed C# classes that should have been exposed to
ObjC/IB because of their [Register("<ClassName>")] attribute on their .designer
partial class. In the auto-generated XCode interface builder project these classes are visible and are shown to be properly hooked up to their respective layout elements.
Whenever this issue appears differs per build. Sometimes a clean and rebuild is enough to make the issue go away, only for it to seemingly randomly return sometime later. Sometimes rebooting Xamarin Studio and rebuilding is required.
The issue also seems to appear more often in i386 (Simulator) builds than ARM7 + ARM64 (Device) based builds.
Can you get build logs for a successful and a broken build so that we can compare them and see if there's something significant there?
Created attachment 9335 [details]
Diagnostic build log of broken build
Created attachment 9336 [details]
Diagnostic build log of working build
Comparing the output of the IBToolTask between the builds shows that the broken build doesn't invoke ibtool. This looks like a bug in our MSBuild logic.
Jeff, can you have a look?
If it doesn't invoke ibtool, then it's because the timestamp on the output file is newer than the timestamp on the source file.
Try cleaning your build and then rebuilding.
Cleaning and rebuilding didn't solve the issue.
However, updating to the recently released Xamarin.iOS 8.8 did solve the issue. All custom classes are properly loaded again. (Tried on multiple machines and after multiple clean and rebuild cycles. Seems to be solved)
(Before this update our company used the Xamarin.iOS 8.6.1 release, where it was still broken)
Looks like XI 8.8 solved the problem. Closing