Bug 104 - MonoTouch should provide better diagnostics on registration failure
Summary: MonoTouch should provide better diagnostics on registration failure
Status: RESOLVED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: 4.x
Hardware: PC Mac OS
: --- enhancement
Target Milestone: Untriaged
Assignee: Rolf Bjarne Kvinge [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2011-07-28 17:21 UTC by Rodrigo Kumpera
Modified: 2014-03-03 09:00 UTC (History)
2 users (show)

Tags: registration
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:
Status:
RESOLVED FIXED

Description Rodrigo Kumpera 2011-07-28 17:21:45 UTC
Right now when MT finds a wrapper type without its corresponding objc class we throw on Device and ignore on simulator.

A better approach would be to hookup into the runtime loader and register only when the vtable is requested or explicitly needed[1].

This would give us a neat startup boost and close the gap between device and simulator builds.

Besides that, failing to load a type kind of make sense. It reduces the surface for weird crashes as nothing can use those broken types for very long. And the TLE will probably result in the app aborting as it's expected to.

[1]XIB files can reference user types. We can overcome that by registering empty classes and installing an init method that performs registration.
Comment 1 Rolf Bjarne Kvinge [MSFT] 2012-10-24 08:11:46 UTC
I'm not entirely sure we can throw when the type is registered (if we register everything at startup), because it is allowed to have wrapper types in the app without corresponding native types (an app may for instance have iOS6-only types, but still execute gracefully on iOS5).

Maybe we can add debug code to monotouch.dll and make it so that it's only used in debug mode (i.e. a separate monotouch.dll and monotouch-debug.dll, like we already have for libmonotouch.a).
Comment 2 Rolf Bjarne Kvinge [MSFT] 2014-03-03 09:00:27 UTC
IIRC this was implemented some time ago.