Code Analysis Not Working on Many Files

Answered

Edit 1/7: I'm still not sure of the cause, but I have been able to re-enable code analysis by using the ReSharper_EnableDaemon keyboard shortcut Ctrl+Alt+Shift+8 with non-working files open.  Curiously, toggling a working file off adds it to the Code Analysis Exclude list, but there are no other files in the list, despite some clearly acting as though they have been.

Resharper is no longer doing any syntax highlighting.  I have a number of style rules around variable/method naming, using explicit types instead of "var", etc.  Other things like warnings around possible null exceptions are also not being shown.

Other features of Resharper seem to be working normally (build, Ctrl+T search, Alt+Enter for quick operations, etc.).

I've tried digging through the options looking for something that might be causing the issue but haven't found anything (toggled off, saved, toggled back on, saved) that has fixed my issue.

I did perform a Windows Update yesterday, the timing suggests that this is related.  However, I've been unable to find any Visual Studio settings that fix my problem either.

After some more digging I've found some files are working properly, with all the code analysis and syntax highlighting and style rules I expect.  The "Elements to Skip" section of "Code Inspection > Settings" only has "*.min.js" in it, but MANY other files are being ignored.

Edit: VS 2015, R# Ultimate

Edit 2: I've deleted the Resharper transient folders and uninstalled/reinstalled Resharper: no dice.

1
18 comments
Avatar
Permanently deleted user

I have the same issue for a long time. Also tried reinstalling, and resetting settings for both Visual Studio and Resharper. My colleagues also report the same issue.

Do not understand why Jetbrains did not resolve this issue yet, since it seems to be a widespread issue.

0

Hello Werner!

 

Could you please specify if the issue is reproduced on a newly created solution or just some specific one?

If the latter please try suggestion from the following help article - https://resharper-support.jetbrains.com/hc/en-us/articles/206546989

Thank you.

0
Avatar
Permanently deleted user

Hi Angelina,

 

It happens to almost all projects. But it's not really consistent. Some files do get Analysis enabled, some don't.

For the disabled files it says "Analysis is unsupported for document". But if I manually enable it, everything works perfectly fine.

I tried the solution in the link you suggested, but in a more extreme way. I uninstalled Resharper and deleted the complete "C:\Users\Username\AppData\Local\JetBrains" folder. Then I reinstalled Resharper again. Same problem...

I also have the same problems in Visual Studio 2017 which I installed today. Exactly the same.

 

Really hope you can fix this, because Resharper is expensive enough and it's not really usable this way.

0

Hello Werner!

 

Thank you for the reply.

Seems that specified files are a part of NuGet packages and are considered by R# as non-user code.

You may either:

  • manually enable code analyses for the file
  • or remove the files from packages.config file.

 

Thank you.

0
Avatar
Permanently deleted user

Hi Angelina,

 

The files I am talking about are all project classes and models. Has nothing to do with NuGet packages.

The problem has started a few versions ago, before it always worked fine. So there is clearly something going on.

If you want you can have a look trough TeamViewer or something.

0

Thank you for the reply, Werner!

 

Could you please specify if those not analyzed files have large size? 

Could you please provide your packages.config file?

Thanks in advance!

0
Avatar
Permanently deleted user

On 12/6/2017, I experienced a symptom where a C# file (a view model class) was no longer performing the ReSharper analysis.  The symptom was that the icon was a pause symbol with a tooltip that said "Analysis is unsupported for document" (even though this was a simple C# file that had worked previously).  Other files were working fine.

This file was 1320 lines long (it is a file I inherited).

The following attempts to fix this did NOT work:

1. clean solution, rebuild solution -> still a problem

2. close Visual Studio and re-open it -> still a problem

3. close VS and delete bin/obj/TestResults -> still a problem

4. clicked the pause icon -> didn't help, still a problem

The following DID work:

5. the Ctrl+Alt+Shift+8 easter egg...in fact, it seems like I had to do this 3 times (i.e., beyond a simple toggle)

It is also worth noting that my Visual Studio environment had recently started to be slow.  This could simply be a parallel symptom.  I do not think the VS slowness is a cause or a separate symptom but it is hard to know (generally my Visual Studio environment seems healthy and I have been working for a month or 2 without any other significant problems).  That is, it feels to me like the R# analysis is getting hung up, yielding both slow VS performance AND the specific problem with the file.

Also, multiple other C# (*.cs) files were fine.

R# Version:  ReSharper Ultimate 2017.2.1 built on 2017 September 20

My environment is telling me that a R# update is available (2017.2.2)...and it seems like I was recently notified of this...perhaps related, perhaps not.

After the fix, it is reporting "26 warnings" in the tooltip.

1

This fixed it for me too!

Thank you @David

0
Avatar
Permanently deleted user

I am still amazed that this bug has not been solved after all this time. I discovered a lot of my colleagues also have this problem when I discussed my problems with Resharper in the coffee corner.

Every time after installing a new update I hoped the problems would be fixed, but no.

It has nothing to do with NuGet packages or stuff like that. For example in my current project it refuses to enable Code Analyses when I open "/Controllers/Api/WidgetsController.cs". Closing and re-opening the file does not fix is.
The only way to get the Code Analyses enabled is to do CTRL+SHIFT+ALT+8 two times, close the file and then re-open the file. This is madness for a product that costs hundreds of euros a year. In total we pay thousands of euros a year (all licenses) for a product that has this annoying flaw for years now.

Please forward this to your Support/Development department as High priority, because else we might as well cancel our subscription for a product that only works 50% of the time.

1

Hello Werner!

 

Please accept apologies for inconvenience you're experiencing.

Though it will be very helpful if you could provide information stated above:

Could you please specify if those not analyzed files have large size? 

Could you please provide your packages.config file?

Thank you.

0
Avatar
Permanently deleted user

Hello Angelina,

I got in contact with your colleague Sergey Coox, he has a quick look at one of my projects using Screen Sharing and had one idea what might causes the issue.

We (our company) use custom Template NuGet packages to bootstrap new project with Controllers and Models, those packages containt .cs.pp files. For example ContentpageController.cs.pp, which is converted into ContentpageController.cs in the project. According to Sergey some logic in ReSharper is confusing the .cs.pp files from the package files with the .cs files from the project and decides to disable Code Analysis for those files.

I sent him the two Template bootstrap packages so he could reproduce and fix the bug in ReSharper. I already got the confirmation for Sergey that he was able to reproduce the bug perfectly. So a fix for this problem is finally incoming :)

0

2021.1.4 - still there. Thanks David for "the Ctrl+Alt+Shift+8 easter egg"

0

Ewen Wallace Could you describe the issue you get in detail?

0

Andrey Simukov as described at https://youtrack.jetbrains.com/issue/RIDER-24045 - is by design. It's a feature, not a bug, apparently. Mystery solved. I know that issue is for Rider, I am assuming the code is also in R#. 

0

Hello, I'm having the exact same issue, but the daemon thing didn't fix it.

I'm using Microsoft Visual Studio Professional 2022 (64-bit) - Current Version 17.6.4 and R# 232.0.20230731

Multiple files are ignored for no reason. I have the following message when resharper anlyses the issue. Any help would be greatly appreciated

0

Hello Florian Luna

Could you please specify for what files code analysis is ignored?

Thank you.

0

Hello, thanks for the quick answer. I think that the issue is half my bad. One update failed to succeed, and reinstalling it also was not successful (I had the Daemon message) at the first time. Then the install was ok. but code inspcetion still not working (but resharper was enabled on the file). In the end I was working on c++ code from Unreal Engine plugin that is by default not enabled for code inspection. The issue is now fixed and unrelated to the previous messages. thanks again!

0

Please sign in to leave a comment.