Bug 22046 - MT0042 warning for missing monotouch.dll reference is displayed incorrectly as an error in XamarinVS
Summary: MT0042 warning for missing monotouch.dll reference is displayed incorrectly a...
Status: VERIFIED NOT_REPRODUCIBLE
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: iOS ()
Version: 3.3
Hardware: PC Mac OS
: High normal
Target Milestone: 3.7
Assignee: Adrian Alonso
URL:
Depends on:
Blocks:
 
Reported: 2014-08-12 14:36 UTC by Brendan Zagaeski (Xamarin Team, assistant)
Modified: 2014-09-30 06:34 UTC (History)
6 users (show)

Tags:
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 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:
VERIFIED NOT_REPRODUCIBLE

Description Brendan Zagaeski (Xamarin Team, assistant) 2014-08-12 14:36:49 UTC
I suspect this is an intentional change between Xamarin.iOS 7.2.5.5 and Xamarin.iOS 7.2.6.28: `mtouch` now prints an MT20042 warning unless `monotouch.dll` is included on the command line with a "-r" flag.

Unfortunately, this exposes a problem that has been hiding in XamarinVS since 3.0.54 or earlier, and therefore causes a "regression." In particular, if the remote build phase hits a "real" error at some point, then XamarinVS will incorrectly display any _warnings_ from the standard error of `mtouch` as "fake" errors, obscuring the "real" error.




## Steps to reproduce the regression in XamarinVS 3.0.54 or later

1. Create a new Single View iPhone application.


2. Under "Project Properties -> iOS Bundle Signing", select a Provisioning Profile that does _not_ match the "Project Properties -> iOS Application -> Identifier". This intentionally breaks the build during the code signing step.


3. Click the green triangle "start debugging" button to attempt to build, deploy, and start debugging on device.



### Result with Xamarin.iOS 7.2.6.28 on the build host

"View -> Error List" displays the following error:
> Error    1    MT0042:No reference to either monotouch.dll or Xamarin.iOS.dll was found. A reference to monotouch.dll will be added.


The Output -> Build window shows:
> ------ Build started: Project: iOSApp1, Configuration: Debug iPhone ------
>   iOSApp1 -> C:\Users\Brendan\Desktop\iOSApp1\iOSApp1\bin\iPhone\Debug\iOSApp1.exe
> Build started.
> OK
> Build server returned an Error.
> warning MT0042: No reference to either monotouch.dll or Xamarin.iOS.dll was found. A reference to monotouch.dll will be added.
> 
> Remote build step failed.
> Build FAILED.


The big problem is that these "fake" errors distract from the "real" error in the Mac Server Log:
> Error: Project bundle ID 'com.your-company.iOSApp1' does not match specified provisioning profile
> 	Provisioning profile: "iOS Team Provisioning Profile: com.example.helloworldios"
> 	    Signing Identity: "iPhone Developer: A Company"
> 	              App ID: ""
> Error: Project bundle ID 'com.your-company.iOSApp1' does not match specified provisioning profile



### Result with Xamarin.iOS 7.2.5.5 on the build host

"View -> Error List" displays _no_ errors.


The Output -> Build window shows:
> ------ Build started: Project: iOSApp1, Configuration: Debug iPhone ------
>   iOSApp1 -> C:\Users\Brendan\Desktop\iOSApp1\iOSApp1\bin\iPhone\Debug\iOSApp1.exe
> Build started.
> Server returned an error. The remote server returned an error: (500) Internal Server Error.
> Server error code: 500
> Internal Server Error
> InfoPlistBuilder failure during build
> Project bundle ID 'com.your-company.iOSApp1' does not match specified provisioning profile
> Exception thrown: Project bundle ID 'com.your-company.iOSApp1' does not match specified provisioning profile
> 
> Remote build step failed.
> Build FAILED.


The Mac Server Log contains the same errors as with Xamarin.iOS 7.2.6.28.




## Example `mtouch` command from XamarinVS 3.3.47

Starting /Developer/MonoTouch/usr/bin/mtouch -v -sdkroot "/Applications/Xcode.app/Contents/Developer" --cache "/Users/macuser/Library/Caches/Xamarin/mtbs/builds/iOSApp1/5ff39e18-af2d-4aa0-a38d-3bfb9bc882f2/output/temp/mtouch-cache" --nomanifest --nosign -dev "/Users/macuser/Library/Caches/Xamarin/mtbs/builds/iOSApp1/5ff39e18-af2d-4aa0-a38d-3bfb9bc882f2/output/Debug/iPhone/iOSApp1.app" -debug -linksdkonly -sdk "7.1" -targetver "7.0" --abi=armv7 "/Users/macuser/Library/Caches/Xamarin/mtbs/builds/iOSApp1/5ff39e18-af2d-4aa0-a38d-3bfb9bc882f2/assemblies/iOSApp1.exe"




## Example `mtouch` command from Xamarin Studio 5.2 (build 386)

/Developer/MonoTouch/usr/bin/mtouch -sdkroot "/Applications/Xcode.app/Contents/Developer" --cache "/Users/macuser/Desktop/iOSApp1/iOSApp1/obj/iPhone/Debug/mtouch-cache" --nomanifest --nosign -dev "/Users/macuser/Desktop/iOSApp1/iOSApp1/bin/iPhone/Debug/iOSApp1.app" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.Xml.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.Core.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll" -debug -linksdkonly -sdk "7.1" -targetver "7.0" --abi=armv7 "/Users/macuser/Desktop/iOSApp1/iOSApp1/bin/iPhone/Debug/iOSApp1.exe"





## Next steps

I think there are 2 separate pieces to fix:



1. Update the XamarinVS `mtouch` command line to include the required explicit "-r" references.

There's also a chance I'm misunderstanding the MT0042 warning. If the explicit references are not actually recommended, then the warning behavior of `mtouch` can be changed instead.



2. Change XamarinVS so that it displays warnings from `mtouch` as warnings rather than errors. Just to reiterate, XamarinVS does not display the MT0042 warning _at all_ unless the build process hits _another_ error. That's why the steps to reproduce intentionally break the build with a "bad" provisioning profile.




Thanks!
Comment 6 Mohit Kheterpal 2014-09-30 06:34:56 UTC
I have checked this issue with XVS 3.7.178 + X.iOS 8.2.0.190 and I am getting same behavior as mentioned in comment 5.

Hence closing this issue by marking it as verified.