Bug 16760 - Reference Condition is not obeyed
Summary: Reference Condition is not obeyed
Status: RESOLVED DUPLICATE of bug 17180
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: iOS add-in ()
Version: 4.2.x
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: master
Assignee: Jeffrey Stedfast
URL:
Depends on:
Blocks:
 
Reported: 2013-12-12 16:55 UTC by Joe Friedrichsen
Modified: 2014-03-07 16:15 UTC (History)
4 users (show)

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


Attachments
This project reproduces the problem (12.19 KB, application/zip)
2013-12-12 16:55 UTC, Joe Friedrichsen
Details
Sample output from building the Debug application (23.13 KB, text/plain)
2013-12-12 16:56 UTC, Joe Friedrichsen
Details
Sample output from building the Release application (25.32 KB, text/plain)
2013-12-12 16:56 UTC, Joe Friedrichsen
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 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 DUPLICATE of bug 17180

Description Joe Friedrichsen 2013-12-12 16:55:29 UTC
Created attachment 5649 [details]
This project reproduces the problem

It appears that using a Condition in a Reference works half-way through the tool chain: mcs is able to obey the condition, but mtouch ignores it.

When I build an application that uses a Reference with a Condition, I see that mcs (correctly) only uses the reference for the active configuration, but mtouch (incorrectly) uses both flavors. The release application uses the Debug assembly and executes the code included via #DEBUG.

Instructions to reproduce:
0. Update the attached application solution to use your own signing credentials
1. Build the debug assembly
2. Build the release assembly
3. Build the debug application, save the build output
4. Build the release application, save the build output

Error indicators:
0. For the debug and release application build outputs, compare the calls to mcs and to mtouch
   mcs only uses *either* debug or release
   mtouch uses *both* debug and release
1. Lines 43..44 of ReleaseBuildOutput.txt
   The debug assembly is copied to the release build cache
2. Run the release application on a device, then look at device's Console output from the Xcode Organizer:
   "ExerciseConditionalReferences[PID] <Warning>: Echo 'Hello' via debug"
Comment 1 Joe Friedrichsen 2013-12-12 16:56:29 UTC
Created attachment 5650 [details]
Sample output from building the Debug application
Comment 2 Joe Friedrichsen 2013-12-12 16:56:57 UTC
Created attachment 5651 [details]
Sample output from building the Release application
Comment 3 Mikayla Hutchinson [MSFT] 2013-12-12 17:47:28 UTC
Note that iOS projects currently use Xamarin Studio's old internal build engine, which only supports a subset of MSBuild features. This will be fixed when we port the iOS build code to MSBuild.
Comment 4 Joe Friedrichsen 2013-12-13 11:32:21 UTC
Ok, thanks for explanation of the situation. In the mean time, what can I do?

Some of the assemblies I use are built by me, so I can use project references to correctly account for the debug/release variants at build time. Are there other things I can do for these?

Some of the assemblies I uses are not built by me and I don't have access to their source, which means I cannot use project references. I can use two projects -- one for debug and one for release -- but are there other things I can do for these?
Comment 5 Mikayla Hutchinson [MSFT] 2013-12-16 20:34:54 UTC
Perhaps you could work around it with a prebuild step to copy the assemblies into some particular place, then reference those. For example, the prebuild command for the Debug configuration would copy lib/Debug/Foo.dll to lib/Foo.dll, the prebuild command for the Release configuration would copy lib/Release/Foo.dll to lib/Foo.dll, and you would reference lib/Foo.dll.
Comment 6 Jeffrey Stedfast 2014-03-07 16:15:52 UTC

*** This bug has been marked as a duplicate of bug 17180 ***