Search Issue Tracker
Won't Fix
Votes
0
Found in
2018.1.0f1
Issue ID
1028075
Regression
No
.NET 3.5 successfully compiles C#6 features when LangVersion set to C#4 but error shows in IDE
Using .NET 3.5, the C# project that is generated by Unity has a supported language version of 4:
<LangVersion>4</LangVersion>
However, Unity successfully compiles the project with C# 6 features like read-only auto properties, even though it passes `-langversion:4` to the compiler.
To reproduce:
1. Download attached project "LangVersionError.zip" and open in Unity
2. Open "CSharpScript.cs" in IDE by double-clicking file in Unity
3. Observe that IDE will report an Error similar to:
Feature 'readonly automatically implemented properties' is not available in C# 4. Please use language version 6 or greater.
Notes:
- This issue reproduces on both Windows and OSX
- In Unity everything is fine
- Discussion with #devs-scripting is in comments section
Reproduced on Unity 2017.1.3p4, 2017.2.3f1, 2017.3.2f1, 2017.4.2f2, 2018.1.0f2, 2018.2.0b3 and 2018.3.0a1
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Sprite Importer Checkbox Label Truncated in UI (2D Template)
- Light theme icon is missing for Volume Component in the Inspector window
- Volume Profile effects are still showing and active in Game View when the Volume Profile is reset
- Shader Graph Tab Lacks Right Margin for Long Titles
- 2DLight component only renders when ShadowCaster2D components are within range in WebGL builds
Add comment