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...
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
: 51194 ()
Depends on:
Reported: 2016-12-23 11:06 UTC by Akhilesh kumar
Modified: 2017-02-07 08:33 UTC (History)
5 users (show)

Is this bug a regression?: Yes
Last known good build: Working fine with C9 MonoFramework-MDK-

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:

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

I am still able to reproduce this issue with master Mono 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: 
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: 
Build output:


Behavior with latest Master mono

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

IDE log: 
Build output: 

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

csproj filed details: 
Build output: 
Env info: 
Ide log: 

@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- => Bad
>C9: MonoFramework->MDK- => 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.


[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: 

Master Env info: