Bug 31239 - Space in Exported property name causes build for device to fail. Needs better error message in VS.
Summary: Space in Exported property name causes build for device to fail. Needs better...
Status: RESOLVED NOT_REPRODUCIBLE
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: iOS ()
Version: 3.11 (C5)
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Jon Goldberger [MSFT]
URL:
: 29741 ()
Depends on:
Blocks:
 
Reported: 2015-06-18 20:10 UTC by Jon Goldberger [MSFT]
Modified: 2016-12-22 17:59 UTC (History)
8 users (show)

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


Attachments
test Project (12.30 KB, application/zip)
2015-06-18 20:10 UTC, Jon Goldberger [MSFT]
Details
Build Host Log (13.28 KB, text/plain)
2015-06-18 20:12 UTC, Jon Goldberger [MSFT]
Details
Output from the Xamarin Log in Visual Studio (11.06 KB, text/plain)
2015-06-18 20:12 UTC, Jon Goldberger [MSFT]
Details
Relevant part of build output form Xamarin Studio (7.40 KB, text/plain)
2015-06-18 20:20 UTC, Jon Goldberger [MSFT]
Details
Relevant part of build output from Visual Studio (5.58 KB, text/plain)
2015-06-18 20:44 UTC, Jon Goldberger [MSFT]
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 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 NOT_REPRODUCIBLE

Description Jon Goldberger [MSFT] 2015-06-18 20:10:37 UTC
Created attachment 11674 [details]
test Project

## Description

Having a space in Exported property name for a Custom Control causes build for device to fail in both VS and XS. Also in VS this causes the build host connection to be temporarily lost as well, though it reconnects on its own.

## Steps to reproduce

1. Open the attached test project in Xamarin Studio or Visual Studio. Issue occurs in both but the error messages are very different.

2. Deploy to iOS device (issue does not occur on simulator)

Expected result: App will build and deploy.

Actual Result: App build fails with the following errors in VS and XS:

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

Visual Studio:
>Error	1	Failed to deploy application on the target device. Please try to rebuild the solution and try again.	Xamarin.iOS Extension	0	0	


## Note

Open the file SpaceInPropertyView.cs and remove the space from the Exported property:
[Export("Imageview"), Browsable(true)]

Now launch the project to a device and the project will build and deploy as expected. 


## Environment

Xamarin Studio:
=== Xamarin Studio ===

Version 5.9.3 (build 1)
Installation UUID: 2dc9022f-f9a8-424f-8284-bf224cbbfde0
Runtime:
	Mono 4.0.1 ((detached/ed1d3ec)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400010044

=== Xamarin.Android ===

Version: 5.1.3.1 (Business Edition)
Android SDK: /Users/apple/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		2.3    (API level 10)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
Java SDK: /usr
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)

=== Xamarin Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Apple Developer Tools ===

Xcode 6.3.2 (7718)
Build 6D2105

=== Xamarin.iOS ===

Version: 8.10.1.64 (Business Edition)
Hash: e6ebd18
Branch: master
Build date: 2015-05-21 21:55:09-0400

=== Xamarin.Mac ===

Version: 2.0.1.64 (Business Edition)

=== Build Information ===

Release ID: 509030001
Git revision: 5a524e1726ed103fdd4fe37e0356f2b35466ce9d
Build date: 2015-06-02 16:35:08-04
Xamarin addins: 51957cfbd06be911b212671ad05c2c6221ac90f9

=== Operating System ===

Mac OS X 10.10.3
Darwin Jons-iMac.local 14.3.0 Darwin Kernel Version 14.3.0
    Mon Mar 23 11:59:05 PDT 2015
    root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64


Visual Studio:
Microsoft Visual Studio Ultimate 2013
Version 12.0.31101.00 Update 4
Microsoft .NET Framework
Version 4.6.00057

Installed Version: Ultimate

Architecture and Modeling Tools   06181-004-0451031-02209
Microsoft Architecture and Modeling Tools
    
UML® and Unified Modeling Language™ are trademarks or registered trademarks of the Object Management Group, Inc. in the United States and other countries.

LightSwitch for Visual Studio 2013   06181-004-0451031-02209
Microsoft LightSwitch for Visual Studio 2013

Team Explorer for Visual Studio 2013   06181-004-0451031-02209
Microsoft Team Explorer for Visual Studio 2013

Visual Basic 2013   06181-004-0451031-02209
Microsoft Visual Basic 2013

Visual C# 2013   06181-004-0451031-02209
Microsoft Visual C# 2013

Visual C++ 2013   06181-004-0451031-02209
Microsoft Visual C++ 2013

Visual F# 2013   06181-004-0451031-02209
Microsoft Visual F# 2013

Visual Studio 2013 Code Analysis Spell Checker   06181-004-0451031-02209
Microsoft® Visual Studio® 2013 Code Analysis Spell Checker

Portions of International CorrectSpell™ spelling correction system © 1993 by Lernout & Hauspie Speech Products N.V. All rights reserved.

The American Heritage® Dictionary of the English Language, Third Edition Copyright © 1992 Houghton Mifflin Company. Electronic version licensed from Lernout & Hauspie Speech Products N.V. All rights reserved.

Windows Phone SDK 8.0 - ENU   06181-004-0451031-02209
Windows Phone SDK 8.0 - ENU

Application Insights Tools for Visual Studio Package   1.0
Application Insights Tools for Visual Studio

ASP.NET and Web Tools   12.4.60320.0
Microsoft Web Developer Tools contains the following components:
Support for creating and opening ASP.NET web projects
Browser Link: A communication channel between Visual Studio and browsers
Editor extensions for HTML, CSS, and JavaScript
Page Inspector: Inspection tool for ASP.NET web projects
Scaffolding: A framework for building and running code generators
Server Explorer extensions for Microsoft Azure Web Apps
Web publishing: Extensions for publishing ASP.NET web projects to hosting providers, on-premises servers, or Microsoft Azure

ASP.NET Web Frameworks and Tools 2012.2   4.1.21001.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

ASP.NET Web Frameworks and Tools 2013   5.2.21010.0
For additional information, visit http://www.asp.net/

Common Azure Tools   1.3
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Microsoft Advertising SDK for Windows Phone   
Microsoft Advertising SDK for Windows Phone
Build 

Microsoft Azure HDInsight HQL Service   2.0.0.0000
Language service for Hive query

Microsoft Azure HDInsight Tools for Visual Studio   2.0.0.0000
An integrated development environment for HDInsight application development.

Microsoft Azure Mobile Services Tools   1.3
Microsoft Azure Mobile Services Tools

Microsoft Azure Tools   2.4
Microsoft Azure Tools for Microsoft Visual Studio 2013 - v2.4.20730.1601

Microsoft Azure Tools   2.5
Microsoft Azure Tools for Microsoft Visual Studio 2013 - v2.5.30319.1603

Multilingual App Toolkit   3.1.1250.0
Multilingual App Toolkit helps you localize your Windows Store app by providing file management, pseudo and machine translation, translation editor, and build integration. http://go.microsoft.com/fwlink?linkid=245767

NuGet Package Manager   2.8.60318.734
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

Office Developer Tools for Visual Studio 2013 ENU   12.0.31105
Microsoft Office Developer Tools for Visual Studio 2013 ENU

PowerShell Tools   1.3
Provides file classification services using PowerShell

PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

SQL Server Data Tools   12.0.41025.0
Microsoft SQL Server Data Tools

Windows Azure Tools   2.3
Windows Azure Tools for Microsoft Visual Studio 2013 - v2.3.20320.1602

Windows Phone 8.1 SDK Integration   1.0
This package integrates the tools for the Windows Phone 8.1 SDK into the menus and controls of Visual Studio.

Workflow Manager Tools 1.0   1.0
This package contains the necessary Visual Studio integration components for Workflow Manager.

Xamarin   3.11.590.0 (5160db7)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   5.1.3.1 (d419c934e6ce2113653ff4c40214e3a5d5a69440)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.Forms Intellisense   1.0
Provides intellisense for Xamarin.Forms in the XML editor.

Xamarin.iOS   8.10.1.0 (fce006eae308515fc1eaf85fcc0f90699d9c7e8b)
Visual Studio extension to enable development for Xamarin.iOS.

Xamarin.iOS Unified Migration   1.0
Automated migration for Xamarin iOS Classic projects to Unified

Xamarin.TestCloud.Integration   1.0
Early preview of Xamarin Test Cloud integration
Comment 1 Jon Goldberger [MSFT] 2015-06-18 20:12:10 UTC
Created attachment 11675 [details]
Build Host Log

Build host log with all of the "Request handled in xxxmd" lines removed and truncated to show only the time frame when the issue occurred in VS.
Comment 2 Jon Goldberger [MSFT] 2015-06-18 20:12:54 UTC
Created attachment 11676 [details]
Output from the Xamarin Log in Visual Studio
Comment 3 Jon Goldberger [MSFT] 2015-06-18 20:20:01 UTC
Created attachment 11677 [details]
Relevant part of build output form Xamarin Studio

The part of the build output clearly shows error due to the space. Many messages along the lines of:
>/registrar.m:382:40: error: expected ';' at end of declaration list @property (nonatomic, assign) id Image view;
Comment 4 Jon Goldberger [MSFT] 2015-06-18 20:44:32 UTC
Created attachment 11678 [details]
Relevant part of build output from Visual Studio

This is the Touch task part of the build output from visual Studio.

you can see that the connection is killed and that the registrar error that is shown in the XS build output is absent here.
Comment 5 Jon Goldberger [MSFT] 2015-06-18 20:44:59 UTC
s/Touch/MTouch

DYAC
Comment 6 Sebastien Pouliot 2015-06-18 22:12:14 UTC
@Jon, it's not clear what you see as the problem (or question).

[Export] must be _valid_ selectors (it's only used for interop with ObjC) and spaces are not supported in selector names. IOW using spaces will result in errors - and that's perfectly normal.

It happens at build time for devices because of the AOT (ahead of time) compilation, which includes compilation of some ObjC glue for the _static_ registrar. IOW errors are spotted because everything must be processed before deploying to devices.

For the simulator the JIT (just in time) compiler is used, so you'll have a runtime exception when the code is hit (jit'ed) and the _dynamic_ registrar tries to do it's job. IOW the errors are delayed until the execution requires that bit of code logic.
Comment 7 Jon Goldberger [MSFT] 2015-06-18 22:41:34 UTC
OK, I figured that would be the case about spaces being allowed. And I thought I had mentioned here in this bug report, but actually realized that I mentioned it in another related bug report that I thought at least there should be better error reporting on the Visual Studio side. My bad for not stating as much in this report

However I also realize that the poor error message on the VS side might be due to the fact that the MTouch task failing (I believe) kills the connection to the build host. (That I did note above). Neither the Build Output on the VS side nor the mtbserver logs show anything about a registrar error. I was only able to see that and figure out what the issue was when I tried to build the project in Xamarin Studio. 

I will change this to a VS issue about the error message and the disconnection from the build host.
Comment 8 Rolf Bjarne Kvinge [MSFT] 2015-06-19 02:39:06 UTC
BTW the error message from mtouch will be better in XI 8.12.
Comment 9 mag@xamarin.com 2016-01-26 18:51:25 UTC
This issue is not reproducible anymore, given that now the error message is more clear and it's the same that XS shows. It's very descriptive about the problem with the space character.

The new error message now looks like this:

error : Invalid character ' ' (0x20) found in selector 'Image view' for 'SpaceInExportedProperty.SpaceInPropertyView.get_Image()'

error : Invalid character ' ' (0x20) found in selector 'setImage view:' for 'SpaceInExportedProperty.SpaceInPropertyView.set_Image(UIKit.UIImage)'

Tested with latest master XVS (99.0.0.1160), hence closing the issue as Resolved > Not Reproducible
Comment 10 Joaquin Jares 2016-12-22 17:59:04 UTC
*** Bug 29741 has been marked as a duplicate of this bug. ***