Skip to content

Commit

Permalink
no debug
Browse files Browse the repository at this point in the history
  • Loading branch information
daveMueller committed Mar 21, 2023
1 parent 185b650 commit 1c96001
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 38 deletions.
2 changes: 0 additions & 2 deletions src/coverlet.core/Abstractions/ISourceRootTranslator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,5 @@ internal interface ISourceRootTranslator
string ResolveFilePath(string originalFileName);
string ResolveDeterministicPath(string originalFileName);
IReadOnlyList<SourceRootMapping> ResolvePathRoot(string pathRoot);

Dictionary<string, List<SourceRootMapping>> SourceRootMapping { get; }
}
}
36 changes: 5 additions & 31 deletions src/coverlet.core/Helpers/InstrumentationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public bool PortablePdbHasLocalSource(string module, AssemblySearchType excludeA
{
if (excludeAssembliesWithoutSources.Equals(AssemblySearchType.MissingAll))
{
bool anyDocumentMatches = MatchDocumentsWithSourcesMissingAll(metadataReader, module);
bool anyDocumentMatches = MatchDocumentsWithSourcesMissingAll(metadataReader);

if (!anyDocumentMatches)
{
Expand All @@ -211,45 +211,19 @@ public bool PortablePdbHasLocalSource(string module, AssemblySearchType excludeA
return true;
}

private IEnumerable<(string documentName, bool documentExists)> DocumentSourceMap(MetadataReader metadataReader, string module = "")
private IEnumerable<(string documentName, bool documentExists)> DocumentSourceMap(MetadataReader metadataReader)
{
var foo = metadataReader.Documents.Select(docHandle =>
return metadataReader.Documents.Select(docHandle =>
{
Document document = metadataReader.GetDocument(docHandle);
string docName = _sourceRootTranslator.ResolveFilePath(metadataReader.GetString(document.Name));
return (docName, _fileSystem.Exists(docName));
});

var baa = metadataReader.Documents.Select(docHandle =>
{
Document document = metadataReader.GetDocument(docHandle);
string docName = _sourceRootTranslator.ResolveFilePath(metadataReader.GetString(document.Name));
return (docName, metadataReader.GetString(document.Name));
});

if (module.Contains("coverlet.tests.projectsample.empty"))
{
//throw new Exception(string.Join(Environment.NewLine,
// baa.Select(x =>
// $"Translator.Name: {x.docName}{Environment.NewLine}MetaData.Name: {x.Item2}{Environment.NewLine}Exists: {_fileSystem.Exists(x.docName)}{Environment.NewLine}SourceRoot: {_sourceRootTranslator.SourceRootMapping.Count}")));

throw new Exception(string.Join(Environment.NewLine,
new string[]
{
$"Translator.Name: {baa.First().docName}",
$"MetaData.Name: {baa.First().Item2}",
$"Exists: {_fileSystem.Exists(baa.First().docName)}"
}.Concat(_sourceRootTranslator.SourceRootMapping.Values.SelectMany(x => x.Select(y => $"ProjectPath: {y.ProjectPath}{Environment.NewLine}OrigPath: {y.OriginalPath}")))));

}


return foo;
}

private bool MatchDocumentsWithSourcesMissingAll(MetadataReader metadataReader, string module = "")
private bool MatchDocumentsWithSourcesMissingAll(MetadataReader metadataReader)
{
return DocumentSourceMap(metadataReader, module).Any(x => x.documentExists);
return DocumentSourceMap(metadataReader).Any(x => x.documentExists);
}

private (bool allDocumentsMatch, string notFoundDocument) MatchDocumentsWithSourcesMissingAny(
Expand Down
5 changes: 0 additions & 5 deletions src/coverlet.core/Instrumentation/Instrumenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,6 @@ public bool CanInstrument()
}
catch (Exception ex)
{
if (_module.Contains("coverlet.tests.projectsample.empty"))
{
throw new Exception("EXCEPTION", ex);
}

_logger.LogWarning($"Unable to instrument module: '{_module}'\n{ex}");
return false;
}
Expand Down

0 comments on commit 1c96001

Please sign in to comment.