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
- “Label” name in Sprite Library Editor window lacks character limit causing long names go under the Object Field
- Preview image (screenshot) is not available after capturing snapshot in Memory Profiler
- Crash on UNITY_FT_Stream_ReadAt when changing TMPro properties after unloading an AssetBundle
- Particles spawn at the same position when using raw byte address buffer in VFX Graph
- Decal Shader Graph - Custom vertex interpolators are always 0
Add comment