-
Notifications
You must be signed in to change notification settings - Fork 470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code Metrics data is not calculated #6150
Comments
@bcollamore Thank you for reporting the issue and the detailed analysis. In the past whenever we have encountered such issues, bumping up the MSBuildLocator version in the repo and publishing a new Metrics NuGet package has resolved the issue. Can you please try the same and let us know if that helps? |
roslyn-analyzers/eng/Versions.props Line 63 in a26d1a2
|
@mavasani I have had mixed success with updating MSBuildLocator, because it traditionally seems to update infrequently. But version 1.5.3 released a month ago, so this is a great idea. But unfortunately, even weirdly, it did not help. |
Hi @mavasani, was there an update on this issue? For the time being we had to revert to MsBuild 16 to run the code metrics tool for our projects. |
Thanks @pachecoke. Are you able to create a PR to add the above mentioned PackageReference?
|
Hi @mavasani, @pachecoke, pls see linked PR. (This is my first submission to this repo - please pardon any logistical errors.) |
Tagging @mavasani as PR buddy. |
@bcollamore Should this be closed now as fixed with #6183 ? |
@Youssef1313 yes, it's confirmed fixed in latest beta. |
Thank you @bcollamore for confirmation. I'm going to close this as fixed. |
Analyzer
CodeMetrics
Analyzer source
NuGet Package: Microsoft.CodeAnalysis.Metrics
Version: 3.3.3 (& 3.3.4-beta1.22362.3/latest)
Describe the bug
Metrics file is produced with default values rather than actual values. (See below.)
Steps To Reproduce
Standard Code Metrics instructions
Expected behavior
A complete metrics.xml file produced.
Actual behavior
An essentially empty metrics.xml file is produced, e.g.:
Additional context
Running in a debugger revealed that the call to workspace.OpenProjectAsync has this Diagnostic property (when run via msbuild and the Nuget Package):
This led me to this version update of System.Memory.
The problem is that newer versions of msbuild use a newer version of System.Memory that has a breaking change. When the Metrics Task is run (as defined in the CodeMetrics Nuget Package), it launches Metrics.exe with an incompatible version of the DLL.
To confirm the problem, hacking this:
into the Metrics.exe.config file in the Nuget cache circumvents the issue.
And adding the following PackageReference to Metrics.csproj "fixes" the issue:
The generic flavor of this problem is discussed here.
An additional suggestion is to update the CodeMetrics documentation to consider having CI/CD pipelines rely on Metrics.exe directly in order to avoid this generic problem.
The text was updated successfully, but these errors were encountered: