Bug 50710 - [master]Getting "Invalid debug option portable" error on building Xamarin Mac template application.
Summary: [master]Getting "Invalid debug option portable" error on building Xamarin Mac...
Status: VERIFIED FIXED
Alias: None
Product: Tools
Classification: Mono
Component: msbuild ()
Version: 4.8.0 (C9)
Hardware: PC Mac OS
: Highest critical
Target Milestone: 4.8.0 (C9)
Assignee: Ankit Jain
URL:
: 51194 ()
Depends on:
Blocks:
 
Reported: 2016-12-23 11:06 UTC by Akhilesh kumar
Modified: 2017-02-07 08:33 UTC (History)
5 users (show)

Tags:
Is this bug a regression?: Yes
Last known good build: Working fine with C9 MonoFramework-MDK-4.8.0.423.macos10.xamarin.universal_d9a9f4edf51931842e0bcbdd5c8286bb6ae8d456

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 GitHub or 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 FIXED

Comment 1 Jonathan Pryor 2017-01-04 18:57:59 UTC
@Akhilesh: What is the value of the `$(DebugType)` MSBuild property in your `.csproj`?

Also, "master" of *what*?

The problem, as per the build output, is here:

> /mcs execution started with arguments: /noconfig /debug:portable /debug+ /optimize- /out:obj/x86/Debug/teerer.exe ...

In particular, the `/debug:portable` option is provided by the build host, and provided to `mcs`.

My *assumption* is that `$(DebugType)` is set to `Portable` in your .csproj, in which case xbuild/msbuild/whatever is doing what it should (as far as I know), in which case the problem lies with `mcs` not supporting the `/debug:portable` option.

Additionally, if `mcs` is the *real* mcs, this might not ever be fixed, in that IIRC *Roslyn* is supposed to be the default compiler toolchain for C10, and Roslyn *does* (should?) support `/debug:portable`.
Comment 2 Akhilesh kumar 2017-01-06 07:05:53 UTC
*************************************************
Behavior with Old Master mono 4.9.0.1410:
*************************************************

I am still able to reproduce this issue with master Mono 4.9.0.1410 build. I am still getting build error on building Xamarin Mac template. Screenshot: https://www.screencast.com/t/DQNVNAJoH

>What is the value of the `$(DebugType)` MSBuild property in your `.csproj`?

.csproj File details: 
https://gist.github.com/AkhileshKumar01/b3f48e8786fb843281ea136364e353bb
In my .csproj filed DebugType is  <DebugType>pdbonly</DebugType>

>Also, "master" of *what*?

Master means I am observing this issue with master Mono build.

IDE log: 
https://gist.github.com/AkhileshKumar01/8025ddedd28ecef671408321dab3a17a
Build output:
https://gist.github.com/AkhileshKumar01/a4a9ba677c8f058472228ffe4544dea6

Build: 
MonoFramework-MDK-4.9.0.1410.macos10.xamarin.universal_d30ee1904c6c3dbba3acd972d04b177d9827561a

*************************************************
Behavior with latest Master mono 4.9.0.1456:
*************************************************

But with latest master Mono: MonoFramework-MDK-4.9.0.1456.macos10.xamarin.universal_b428249c7aace859020cc931b2a7f570e5c72ed9, I am unable to reproduce this issue. And the .csproj file with this mono is https://gist.github.com/AkhileshKumar01/122fa10460c345999f5fe49fd1ed9f56

IDE log: 
https://gist.github.com/AkhileshKumar01/2b83257dff1befefb4703dd81b31887d
Build output: 
https://gist.github.com/AkhileshKumar01/269a3adb875d6ed1ecb4550f449c9559


*************************************************
Behavior with latest C9 Mono 4.8.0.429:
*************************************************
This issue does not exist with C9 mono build.

csproj filed details: 
https://gist.github.com/AkhileshKumar01/bede7bee3e206143558d0491d4e5f953
Build output: 
https://gist.github.com/AkhileshKumar01/94565d01a48d2c9153c4e0735745196d
Env info: 
https://gist.github.com/AkhileshKumar01/0ba322007bf85685fba57152f6739852
Ide log: 
https://gist.github.com/AkhileshKumar01/94b671ae9dd1ccfa087a7022daaadb8c


@Jonathan, please let me know if I can provide any thing else.
Comment 3 Akhilesh kumar 2017-01-06 13:05:09 UTC
I had reported this issue against master mono build. With C9 mono builds it was working fine.

>Build info:
>Master: MonoFramework-MDK-4.9.0.1410.macos10.xamarin.universal_d30ee1904c6c3dbba3acd972d04b177d9827561a => Bad
>C9: MonoFramework->MDK-4.8.0.423.macos10.xamarin.universal_d9a9f4edf51931842e0bcbdd5c8286bb6ae8d456 => Good
Comment 4 Ankit Jain 2017-02-02 23:28:16 UTC
The bug is reported against MSBuild, but the project is being built with xbuild. `Component` has a separate option for xbuild btw. When building from XS, the default is xbuild. And you get msbuild if you explicitly enable the option via global preferences.

https://github.com/mono/mono/pull/4322

[xbuild] Disable pre-2.0 csc hack to use /debug:portable
This hack should not be required now, as roslyn emits the correct debug
files with /debug:full and /debug:pdbonly, on non-windows platform.

This manifested as https://bugzilla.xamarin.com/show_bug.cgi?id=50710 ,
where the Xamarin.Mac targets override `$(CscToolExe)` to use `mcs`, but
xbuild's `ManagedCompiler` *always* converts `DebugType={full,pdbonly}`
to `/debug:portable`, which would cause mcs to complain.
Comment 5 Ankit Jain 2017-02-03 16:22:25 UTC
The fix has been merged.
Comment 6 Ankit Jain 2017-02-03 22:54:15 UTC
*** Bug 51194 has been marked as a duplicate of this bug. ***
Comment 7 Akhilesh kumar 2017-02-07 08:33:19 UTC
I have checked this issue with latest C9 and master builds, now I am successfully able to build and run Xamarin Mac template application.

So i am closing this issue.

C9 Env info: 
https://gist.github.com/AkhileshKumar01/e02de8e29c6cee3333d4a8c4dc5e09e2

Master Env info: 
https://gist.github.com/AkhileshKumar01/f4d0a972c0ba4974ea39507f31a97ebc