Code Analysis problems in 10.0.2
Since upgrading to ReSharper 10.0.2 I've been experiencing problems with solution-wide code analysis. It works fine initially, then as soon as I build the solution it starts rescanning everything and eventually detects more than 60,000 errors (it's a big solution!). This persists through subsequent builds, making it almost impossible to code, until I force a rebuild, then it scans the files again and after a few minutes I'm back down to 0 errors. Before upgrading (from version 9.something) this didn't happen. Note that I'm using Visual Studio build, not the new ReSharper one.
A bit of research suggests this may be something to do with referencing different versions of the same assemblies, but I'm finding it really hard to track down exactly where this might be happening. A full diagnostic build log identified some assembly version problems that I doubt I'll be able to fix easily as they come from NuGet packages such as CommonServiceLocator, many of which have references to, for example, older versions of mscorlib and System.
Can you give me any advice as to how to solve this problem? Or is it something that requires a fix in ReSharper?
Thanks,
Karli
Please sign in to leave a comment.
Hello Karli,
What are types of projects in the solution? What Visual Studio version do you use?
Thanks!
Hi Alexander,
Thanks for getting back to me!
I'm using Visual Studio 2012 version 11.0.50727.1 currently, but should be upgrading to VS 2015 soon. If that solves the problem I'll be very happy. There are 54 projects in the solution lately, all C#, mostly class libraries but also WPF applications, WCF and web service projects and one or two ASP.NET and console apps. Currently, all projects are included in solution-wide inspections.
Karli,
Please send me some dumps when the red code appears in the solution (please use "Submit a request" button above to create a new private support ticket to send me such files):
a) Run Visual Studio with "/ReSharper.Internal" key to run R# in debug mode;
b) Open the problem solution;
c) Open any code file from the problem project where you experience a red code;
d) hit Alt+Enter shortcut in any place in the file;
e) type "Dump Project Model" and save the result file as "Dump Project Model.txt";
f) Hit Alt+Enter shortcut in any place in the file;
g) Type "Show VS References given to project";
h) Save such file as "Show VS References given to project.txt";
Then send me all txt files generated by ReSharper and some screenshots of the issue you experience (via a private ticket as I mentioned before).
Thanks!
I've investigated a bit further, and it seems as though at some point in the past someone re-targetted the project framework versions but left the NuGet packages alone, so there's a mix of net40 and net45 references. Some info at http://stackoverflow.com/questions/12006991/retargeting-solution-from-net-4-0-to-4-5-how-to-retarget-the-nuget-packages has led to me uninstalling and reinstalling the offending packages, and it seems to be improving things, so I'll finish doing that first before sending you the dump files. This seems like it's probably the problem, and perhaps a check for this could be added to future ReSharper released to help others with the same issue!
I'll be in touch if it turns out there are more problems.
Thanks,
Karli
Hello Karli
Thanks for letting us know.
Thanks!
Hi Alexander,
I have now solved this issue. After updating my references, I was still getting the same problem, but perhaps not quite so bad (10K errors instead of 50K errors). I tried various things included moving the resharper caches, deleting .suo files and so on, and then I took a look at the dump files you asked me to provide. When I compared the project model just after a total re-build to the project model after an ordinary build, I could see that multiple project references had gone missing. Comparing the VS references dumps showed me that a version number of a referenced assembly had mysteriously changed from 1.0.0.0 to 0.0.0.0.
That led me to look at the "Msbuild access" setting in the general ReSharper settings. I changed this to "Obtain data from msbuild after each compilation" and that seems to have solved the problem. There may be some underlying assembly conflict that is causing the issue in the first place, but for now I'm satisfied that I can at least continue to use ReSharper without seeing thousands of errors, so that's good enough for me.
Anyway, I thought I'd mention that here in case anyone else encounters the same problem!
Thanks,
Karli
Hello Karli!
Thanks for the update!
Are you able to send us the dump files you collected since we are interested in analyzing them on our side as well?
Thanks!
Hi,
I've investigated this, and unfortunately there's a lot of information in those files that I'm not sure people would be happy about sharing. If I get a moment, I might try to create a test project with the same issue and send you the dump files for that as well. I suspect it's related to having one or all of a) multiple target platforms, b) lots of projects / project types, c) NuGet references with conflicting dll references (specifically, reference A and B packages where A refers to a dll in package C and B includes the DLL itself). There may also be an issue surrounding net40 and net45 targetting, but I think I eliminated that earlier on.
Thanks,
Karli