Code inspection results are wildly different between R# and Inspections(.NET) on TeamCity
Hi,
we are trying to run the Resharper code inspections on our TeamCity CI server - but the results we are getting from the CI server are wildly different to the reports that we get from running Resharper locally through Visual Studio.
We have a custom set of profile dot.settings rules that are applied to both the local and CI build.
When run locally on the solution the number of inspections totals around 2202 (calculated from adding up the numbers at the end of each error group) shown in the inspections results window but when the inspection report is produced on TeamCity the numbers are Total 3439 and errors 2550.
As these numbers are so different we went further into the results - and where we can find an error within Visual Studio for a particular method it cannot be found within the inspections report on TeamCity.
Are there further configurations required to produce comparable results within both TeamCity and locally executed code inspection task?
many thanks
Please sign in to leave a comment.
OK - I have some further information on this issue - I have found that even though the project is built within Visual Studio 2012 and the R# inspection is run against this environment when building in TeamCity if I use the msbuild 2013 toolset rather than the msbuild 4.0 toolset the results from b ot R# and Inspections (.NET)match up.
I do not yet fully understand the implications of building a VS 2012 project with msbuild 2013 or yet fully understand why building with a slightly newer runner resolves all of the anomalies between the 2 different approaches to code inspection.
The toolset referenced within the project is still set at 4.0 and currently my suspicions are down to the fact that there may be some .net 4.5.1 code included within the project which is handled within Visual Studio but running the build on TeamCity with the VS 2012 runner the msbuild/toolset version 4.0 only copes with code to .net version 4.5 and not the enhanced 4.5.1 - these are only suspicions as I have no evidence yet.
If anyone can help me understand what is going on I would appreciate it but for now I think I may have a workaround.
many thanks
further information around this issue.
I have googled and searched this forum about this issue and trying to find a resolution and see that I am certainly not the first to experience this issue but cannot seem to find anyone that has resolved the problem - so I will just keep adding to this post in case it helps anyone with the approaches I have attempted.
The latest findings are that if the msbuild 2013 tools are installed on the TeamCity build agents (without changing either the toolset variable within the project - toolsetversion="4.0" - or the build runner - in my case Visual Studio 12 - used within TeamCity) the vast majority of compiler errors are removed. Certainly the errors that say C# 3.0 language feature issue is resolved.
This then leaves a number of errors that can be matched (and are pertinent) to the solution and the results from running R# code inspections within Visual Studio.
However, the issue then observed is that R# code inspection now identifies errors around 'code style' that do not appear within the TeamCity Inspections (.NET) runner - so we still have a mismatch of results
I will carry on attempting to find a resolution or explanation for this behaviour
having just freshly run an inspection on the solution within Visual Studio I can see that for a particular file within R# I have 144 items flagged. These break down into;
Use 'var' (built-in types)
Use Object initializer
Redundant parentheses
Convert to constant
Invert 'if' statement to reduce nesting
Convert 'if' statement to 'switch' statement
Implicitly captured closure: scenarioActionData
By contrast when the Inspections (.NET) runner completes the only issues identified are;
Use object initializer (31)
These do match line for line with the same error highlighted within R# but there are 113 errors that are not reported from the Inspections runner
should I take this issue to TeamCity?
I think is the last comment for this.
I believe the differences now between the results obtained through Visual Studio and running Inspections (.NET) on TeamCity are down to the fact that TeamCity does not seem to display hints and restricts itself to only showing errors, warnings and suggestions.
Having said that here are the steps I had to take to get sensible correlation between the 2 code inspection methods using Visual Studio 12 to design the project and the Visual Studio 12 runner on the TeamCity build server;
1. Upgrade both the runner in TeamCity and ReSharper within Visual Studio to the same version of the ReSharper Command Line Tools
2. Install msbuild tools 2013 onto the TeamCity build agent servers (even if you never use the Visual Studio 2013 runner)
These 2 simple steps have allowed me to get to a place where both sets of results (although not if you just go on the numbers) look to match