Bug 10599 - "C# Project Options - Build - C# Language Version" not saved correctly
Summary: "C# Project Options - Build - C# Language Version" not saved correctly
Status: VERIFIED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: C# Binding ()
Version: unspecified
Hardware: Other Other
: --- normal
Target Milestone: ---
Assignee: Mike Krüger
URL:
Depends on:
Blocks:
 
Reported: 2013-02-22 20:14 UTC by kevin13
Modified: 2013-03-06 16:14 UTC (History)
3 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 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:
VERIFIED FIXED

Description kevin13 2013-02-22 20:14:08 UTC
Description of Problem:


Steps to reproduce the problem:
1. create a new "Android Application"
2. popup "Project Options"
3. In "Build" / "General" section, You can change "C# Language Version" as "Default", "ISO-1", "ISO-2", Version 2, Version 4, Version 5
4. Select "Version 5"
5. Try build, it will fail with this error message "Invalid option 'Version5' for /langversion; must be ISO-1, ISO-2, 3, 4, 5 or Default (CS1617)"


Actual Results:
CS1617 error occurred

Expected Results:
It has to build with option "Version5"


How often does this happen? 
Everytime.

Additional Information:
Open .csproj directly in notepad

  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
..[ommitted]...
    <LangVersion>Version5</LangVersion>
  </PropertyGroup>

you change "Version5" to "5" and save it.

 <LangVersion>5</LangVersion>

It will work!
Comment 1 Mikayla Hutchinson [MSFT] 2013-02-23 18:37:55 UTC
Fixed.
Comment 2 narayanp 2013-03-06 05:17:02 UTC
We have check this issue with following builds:

X.S 4.0.2.1
MFA 4.6.01046
Mono Framework 2.10.11

Observations:
For Mac:
1. On selecting 'Version 5', 'Version 4' in "C# Language Version", we are still getting same build error: 
"/Users/apple/Projects/ss/ss: Error CS1617: Invalid -langversion option `5'. It must be `ISO-1', `ISO-2', `3' or `Default' (CS1617)".

2. On selecting 'IOS-1' in "C# Language Version", we are getting 18 build error.
Build output: https://gist.github.com/atin360/8470a8ba83f7ba804308
Screencast: http://www.screencast.com/t/3NQC7i609

3. On selecting 'ISO-2', 'Version 3' and 'Default' android application build successfully.

Note:
On opening .csproj directly in notepad, for different "C# Language Version" it displays:
<LangVersion>5</LangVersion> for 'Version 5'
<LangVersion>4</LangVersion> for 'Version 4'
<LangVersion>ISO-1</LangVersion> for 'ISO-1'
<LangVersion>ISO-2</LangVersion> for 'ISO-2'
 

For Windows:
1. On selecting 'Version 5', 'Version 4', 'Version 3', 'ISO-2' and 'Default' android application build successfully.

2. On selecting 'IOS-1' in "C# Language Version", we are getting 15 build errors.
Build output: https://gist.github.com/atin360/d33c8528a55b66963061 

Note: On opening .csproj directly in notepad, it displays <LangVersion>ISO-1</LangVersion> for 'ISO-1' C# Language Version.

Hence, reopening this issue.
Comment 3 Mikayla Hutchinson [MSFT] 2013-03-06 14:43:25 UTC
What git revision are you testing? This was fixed in 5263deb8b7e65a5b59482d15b766d2cfec9dfe21 which may have not made it into 4.0.2.
Comment 4 PJ 2013-03-06 15:28:42 UTC
It was fixed on the 23rd, well before we branched 4.0.2, git branch --contains backs this up:

dynamic-044:monodevelop pjbeaman$ git branch --contains 5263deb8b7e65a5b59482d15b766d2cfec9dfe21
* master
  xs-4.0.2


(git branch --contains lists the branches that contain the commit and xs-4.0.2 is on the list)
Comment 5 PJ 2013-03-06 16:14:52 UTC
Ok Lal,

I've got a bit more info for you:

MAC

1) This is a separate bug. The version is being passed correctly by Xamarin Studio, but the compiler is not supporting version 5.

This issue should be filed separately and will be fixed by Mono 3.0

2) This is expected behavior. The project you are building uses features that are not available in C# version 1. The build errors should tell you this. Example:

"MainActivity.cs(26,53): error CS1644: Feature `generics' cannot be used because it is not part of the C# 1.0 language specification"


3) Sounds good!

WINDOWS

1) Sounds good!

2) Same issue as 2 above, the project you are building requires features that aren't  available in version 1 of C#.


Thanks for verifying! Please be sure to re-file MAC issue 1.

Based on  comment 2, I'm VERIFYING that Xamarin Studio is now properly passing '5' instead of 'version5', which is the original issue.