我有一系列有效的.coverage文件,我正在尝试使用Microsoft.VisualStudio.Coverage.Analysis.CoverageInfo.BuildDataSet()方法合并为一个数据集。但是,我遇到异常“ Microsoft.VisualStudio.CodeCoverage.Analysis.SymbolsNotFoundException:找不到图像文件'myassembly.dll'的符号。”
我需要帮助解决此异常。
我已验证/尝试过的事情:
public static void CombineFiles(IEnumerable<string> files, string DestFilePath)
{
CoverageDS data = JoinCoverageFiles(files).BuildDataSet();
data.ExportXml(DestFilePath);
}
// From https://blogs.msdn.microsoft.com/phuene/2009/12/04/programmatic-code-coverage-data-merging-in-visual-studio-2010/
private static CoverageInfo JoinCoverageFiles(IEnumerable<string> files)
{
if (files == null)
throw new ArgumentNullException("files");
// This will represent the joined coverage files
CoverageInfo result = null;
foreach (string file in files)
{
// Create from the current file
CoverageInfo current = CoverageInfo.CreateFromFile(file, new MissingFileCallback(OnMissingFile));
if (result == null)
{
// First time through, assign to result
result = current;
continue;
}
// Not the first time through, join the result with the current
CoverageInfo joined = null;
joined = CoverageInfo.Join(result, current);
result = joined;
}
}
return result;
}