When I tried to run code metrics in Visual Studio 2013 for c# project (Analyze -> Calculate Code Metrics for Solution) I get following error:
"an error occurred while calculating code metrics"
This error occurred even for the newly created project, so it was not related with some reference issues.
To solve this issue I've executed following command as an Administrator:
regsvr32 "C:\Program Files (x86)\Common Files\microsoft shared\MSEnv\VsLangproj.olb"