Bug 52530 - Failed to compile the generated registrar code.
Summary: Failed to compile the generated registrar code.
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: XI 10.2 (iOS 10.1)
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Future Cycle (TBD)
Assignee: rokvin
Depends on:
Reported: 2017-02-15 16:39 UTC by andriuskirilovas
Modified: 2017-02-17 16:02 UTC (History)
5 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 andriuskirilovas 2017-02-15 16:39:35 UTC
When compiling iOS app for actual device I'm getting this warning:

MyApp/iOS/MTOUCH: Warning MT4146: The Name parameter of the Registrar attribute on the class 'FloatLabeledEntry.FloatLabeledTextField' contains an invalid character: ' ' (0x20) (MT4146) (MyApp.iOS)

followed by this error:

MyApp/iOS/MTOUCH: Error MT4109: Failed to compile the generated registrar code. Please file a bug report at http://bugzilla.xamarin.com (MT4109) (MyApp.iOS)

The library that I'm using (https://github.com/gshackles/FloatLabeledEntry) indeed has Register attribute with spaces in the name applied to a class:

[Register ("Float Labeled Text Field"), DesignTimeVisible (true)]
public class FloatLabeledTextField : UITextField

When targeting simulator it compiles and works well.
Comment 1 Timothy Risi 2017-02-15 20:01:52 UTC

This appears to be an error in the FloatLabeledEntry, not in Xamarin.iOS itself.  The warning (MT4146) is correct that whitespace is not allowed in the Register attribute, so that is something that would need to be fixed by the developer of the Library being used.

The reason the error doesn't appear in the simulator is that the simulator uses a JIT compiler, while the device uses an AOT compiler.  They also use different registrars by default, so the error will show up at build time for device, but would be delayed on the simulator until the program actually tries to call it.

It looks like our documentation is currently missing an entry for MT4146, so we will fix that.
Comment 2 andriuskirilovas 2017-02-15 20:33:20 UTC

in v1.1.1 of FloatLabeledEntry this issue is fixed i.e. spaces removed from Register attribute so issue is resolved.
Comment 3 Rolf Bjarne Kvinge [MSFT] 2017-02-17 08:32:29 UTC
Comment 4 Sebastien Pouliot 2017-02-17 16:02:01 UTC
This was merged in master https://github.com/xamarin/xamarin-macios/commit/cf14456cd58105342a467bcfd2ac7314e02401b2