Incorrect warning about C# 6.0 Language Feature in editor

Completed

Hello All,

This issue is very similar to:

https://resharper-support.jetbrains.com/hc/en-us/community/posts/115000380124-ASP-NET-MVC-C-Language-Level-Not-working

https://resharper-support.jetbrains.com/hc/en-us/community/posts/115000447064--C-6-0-Language-Feature-error-in-VS2017-Razor

https://resharper-support.jetbrains.com/hc/en-us/community/posts/115000215864-Disable-C-7-0-language-feature-errors-inside-of-razor

 

I am using:

VS 15.4.5

R# Ultimate 2017.2.2 or 2017.3.EAP9 (EAP9 used for all the screenshots below).

Targeting .NET Framework 4.6.1

 

Unfortunately, none of the answers in the previous posters' questions work.  Every C# 6 or C# 7 feature used in Razor code is highlighted by R# Intellisense as being an unsupported C# 6.0 Language feature..... even string interpolation and null-propogation, much less any C# 7 things like inline out vars or System.Value.Tuples:

 

I have CodeDom 1.07 installed:

However, .CS files in the same solution have no issues showing the correct code without the red squigglies, including C# 7 features:

 

My web.config has the correct version listed:

Snippet

    <location inheritInChildApplications="false">
    <system.codedom>
      <compilers>
        <compiler language="c#;cs;csharp" extension=".cs" 
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, 
Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.7.0, 
Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" 
compilerOptions="/langversion:7 /nowarn:1659;1699;1701" />       </compilers>     </system.codedom>     </location>

 

... and my project is set to C# 7.0 as well:

 

Microsoft.Net.Compilers is installed as v2.3.2,

 

This happens on all Razor .cshtml files, whether in a Views folder coupled with a Controller, or inside an @function helper in the App_Code folder.

If I disable R#, the red squigglies go away.

If I create an isolated, new project, I do not get this error in Razor code, even if the new project is in the problem solution:

 

 

If I add a new Razor view to the troubled project, the error persists.

The trouble affects all existing projects in the solution.... but only in the text editor.  The solution builds without a single error (or even a single warning!), and the Error List window shows 0 errors, 0 warnings.  I can deploy and run the solution just fine.  It is only Intellisense warnings within the text editor, put there by R#, that is the problem.... but it is a real problem because it is impossible to find true errors in the sea of red down the scroll bar.

I seem to have followed all the steps / solutions from the prior reports above, but cannot solve this.

I cannot provide the entire solution (it's dozens of projects).  I would happily provide the web.config for both a troubled project, and for the "Test" I just added that doesn't present the error.

Any thoughts on why this might be happening, or how it can be corrected?

 

Jeff Woods

Reading, PA

4 comments
Comment actions Permalink

Hello Jeff!

 

Thank you for the detailed feedback.

Could you please try suggestion from the following help article -https://resharper-support.jetbrains.com/hc/en-us/articles/206546989-ReSharper-stopped-working-for-a-single-specific-solution and let us know if it helps.

Thank you.

0
Comment actions Permalink

I have been clearing caches and deleting .suo files as a first line of attack against such bugs for years, including in this instance.  It didn't work.  Also, it isn't that ReSharper has stopped working... it is working, but incorrectly thinks that specific projects in the solution are being built with C# 5 rather than the declared C# 7.

0
Comment actions Permalink

Hello Jeff!

 

So it happened that R# doesn't support <location> tag and it seems to be  the reason why correct language verion is not detected. Here's correspondent issue reported - https://youtrack.jetbrains.com/issue/RSRP-467558

Could you please put  <system.codedom> and all inluded tags out of the <location> tag and check if the problem is still reproduced.

Thank you.

0
Comment actions Permalink

Hello Angelina,

That appears to have fixed it!  Thanks!

Jeff Woods

Reading, PA

 

0

Please sign in to leave a comment.