Bug 59618 - Can't build iOS library with C# 7
Summary: Can't build iOS library with C# 7
Alias: None
Product: iOS
Classification: Xamarin
Component: Tools ()
Version: XI 10.10 (d15-2)
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2017-09-20 17:28 UTC by tmrog
Modified: 2017-09-20 18:02 UTC (History)
3 users (show)

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

About details (2.37 KB, text/rtf)
2017-09-20 17:28 UTC, tmrog

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:

Description tmrog 2017-09-20 17:28:48 UTC
Created attachment 24837 [details]
About details

I have some code I have changed based on code suggestions in Visual Studio 2017.  Some of these were to use new language features of C# 7.

Now, I cannot build my iOS library project with getting compiler errors.  All my other projects compile fine.

Error CS1644: Feature `declaration expression' cannot be used because it is not part of the C# 6.0 language specification (CS1644) 

I tried changing the "C# Language Version" to "Version 7" or "Latest" but that causes another error.

Error CS1617: Invalid -langversion option Latest'. It must be ISO-1', `ISO-2', Default or value in range 1 to 6 (CS1617)
Comment 1 John Miller [MSFT] 2017-09-20 17:35:31 UTC

Could you provide some sample code or an entire project that reproduces these errors? Thanks!
Comment 2 tmrog 2017-09-20 17:58:55 UTC
@John Miller - I could not reproduce with a clean project so I decided to compare project files between the working and none working.  In the non-working, I had the following lines at the bottom of the project:


This was to fix an issue found due to this bug: 


I removed the lines and all works now.
Comment 3 Vincent Dondain [MSFT] 2017-09-20 18:02:58 UTC
Glad you found the issue (:

`mcs` only supports a subset of C#7 features which explains why it's fixed if you use csc (evolution).