resharper-unity: Supported C# level is incorrect with .NET 3.5

The supported C# level with .NET 3.5 is currently always set to 4 by the CsprojAssetPostprocessor:

// Unity 5.5+ supports C# 6, but only when targeting .NET 4.6. The enum doesn’t exist pre Unity 5.5 https://github.com/JetBrains/resharper-unity/blob/master/unity/JetBrains.Rider.Unity.Editor/EditorPlugin/AssetPostprocessors/CsprojAssetPostprocessor.cs#L406

However, Unity actually supports C# 6 even with .NET 3.5. For example this compiles without a problem: screen shot 2018-04-19 at 13 36 45

screen shot 2018-04-19 at 13 36 38

But it fails in Rider: screen shot 2018-04-19 at 13 39 41

I have tested this with Unity 2017.2. I don’t know exactly when they switched to the new compiler that always supports C# 6.0.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 26 (14 by maintainers)

Commits related to this issue

Most upvoted comments

fixed in 0.0.42-preview.16

Note that this is still an issue with the incremental compiler 0.0.42-preview.14. It will set the language version to “7” rather than 7.2, and doesn’t check the value before writing.