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

Warning : [coverlet] BadImageFormatException during MetadataReaderProvider.FromPortablePdbStream #1348

Closed
SamHuoJudiAi opened this issue Jun 8, 2022 · 3 comments
Labels
as-designed Expected behaviour

Comments

@SamHuoJudiAi
Copy link

Hi,

I am using the following:

  • Dotnet Framework 4.7.2
  • coverlet.msbuild 2.9.0 (issue is in the latest)

When I run:

dotnet test

I keep getting the following warning (excessively):

C:<..>\packages\coverlet.msbuild.2.9.0\build\coverlet.msbuild.targets(31,5): warning : [coverlet] BadImageFormatException during MetadataReaderProvider.FromPortablePdbStream in InstrumentationHelper.PortablePd
bHasLocalSource, unable to check if module has got local source. [..]

Looking at the code the error seems to be from here on line 156: https://github.com/coverlet-coverage/coverlet/blob/master/src/coverlet.core/Helpers/InstrumentationHelper.cs

I believe the issue is the pdb generated are Full/pdbOnly and not embedded/portable as the code is expecting. Perhaps it is best to check DebugDirectoryEntry.IsPortableCodeView to check if portable and if not use some other way to get MetaData.

@MarcoRossignoli
Copy link
Collaborator

At the moment coverlet works with portable pdb and that part of the code is used as heuristic to decide if cover or not the module, we decided to be relaxed and simply instrument with the risk to not be able to get a good coverage(missing pdb info).
Can you move to portable pdb?

@MarcoRossignoli MarcoRossignoli added the as-designed Expected behaviour label Jun 24, 2022
@SamHuoJudiAi
Copy link
Author

@MarcoRossignoli , thanks for the reply. Yes, I have moved to portable pdb to resolve the logging issues.

@MarcoRossignoli
Copy link
Collaborator

Glad hear that, feel free to close the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
as-designed Expected behaviour
Projects
None yet
Development

No branches or pull requests

2 participants