Skip to content
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

coverlet.msbuild /p:UseSourceLink=true causes exception #418

Closed
dbolin opened this issue May 21, 2019 · 3 comments · Fixed by #437
Closed

coverlet.msbuild /p:UseSourceLink=true causes exception #418

dbolin opened this issue May 21, 2019 · 3 comments · Fixed by #437
Assignees
Labels
bug Something isn't working

Comments

@dbolin
Copy link

dbolin commented May 21, 2019

On windows 10, dotnet core 3 preview 5.
Using this repo, running the following command:

dotnet test Tests/Apex.Serialization.Tests/Apex.Serialization.Tests.csproj -f netcoreapp2.2 -c Debug --logger "trx;LogFileName=results.trx" /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:Include="[Apex.]" /p:UseSourceLink=true

Fails after printing "Calculating coverage result..." with the error "The given key '' was not present in the dictionary." at at Coverlet.Core.Coverage.GetSourceLinkUrl(Dictionary`2 sourceLinkDocuments, String document)

Everything works as expected if the UseSourceLink switch is omitted.

@MarcoRossignoli
Copy link
Collaborator

@dbolin you can try our nightly build, it should fix your issue https://www.myget.org/feed/coverlet-dev/package/nuget/coverlet.msbuild/2.6.1-g0dd56242f2

@josuuribe
Copy link

josuuribe commented Jun 13, 2020

Hi, I have the exact same issue in Azure DevOps with the last version available, I do not use Sonnar or any other third party tool, it's easy to reproduce:

  1. Use the default Azure Build Pipeline .Net Core template (like Asp.Net Core)
  2. Use these arguments in Azure DevOps .net core task:

--no-build --configuration $(BuildConfiguration) /p:CollectCoverage=true /p:Threshold=85 /p:UseSourceLink=true /p:CoverletOutputFormat=cobertura /p:CoverletOutput=$(Build.SourcesDirectory)/TestResults/Coverage/

image

Thanks,

@MarcoRossignoli
Copy link
Collaborator

@josuuribe pls can you open new issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants