-
Notifications
You must be signed in to change notification settings - Fork 388
Coverlet throws BadImageFormatException #1612
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
Comments
Please read the documentation and use the proposed parameters.
|
I think you are doing everything correct as described here for e-2-e tests. But I must admit I haven't used coverlet for integration tests in years. |
I did more investigation and understood that BadImageFormatException is not an issue. most probably it is caused by an error also it takes by default candidate libraries which is not mentioned anywhere |
@daveMueller thanks for your response. |
The link I posted has nothing to do with normal unit tests (Code Coverage for integration tests and end-to-end tests). I can remember that I have done this at least once for e-2-e tests with Selenium. If you can provide a simple repro with the tools you are using, I could give it a try myself. |
I don't have repro, I am using Autodesk Revit.exe as a target. so here is the scenario
I can run the revit.exe with coverlet console command but it fails to collect the coverage. |
OK I see, nothing I can reproduce by myself. Can you post a detailed output here? Maybe we can find some hints there. Just set the verbosity level to detailed. (troubleshoot) |
This the log of e-2-e tests
This is normal unit tests
what ever action is done on revit.exe it doesn't collect code coverage |
Sorry can't really identify what the problem is. Like you already mentioned, this looks a bit suspicious.
As also mentioned in the documentation, coverlet is currently a bit limited for e-2-e tests and relies on a graceful Any other ideas @Bertk @MarcoRossignoli? |
Castle.Core.dll might be causing your problem. |
Seeing the same issue while trying to setup coverlet.msbuild. Repro project: https://github.com/SteamRE/SteamKit/blob/master/SteamKit2/Tests/Tests.csproj Install |
@xPaw Thank you for the repo. I did small modifications (AnyCPU) and removed some files. This warning message occurred
I noticed the output folder did not have any PDB files and updated the configuration for embedded debug symbols (SteamKit2, SteamLanguageParser) <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>embedded</DebugType>
</PropertyGroup> ![]() Not sure whether this helps., |
SteamKit2 does output full pdb for a debug build, and SteamLanguageParser is not covered by tests. csproj defaults to outputting portable debug symbols as far as I know.
Not sure what you changed with anycpu, it's already anycpu. EDIT: Seems like changing |
@xPaw I did not analyze the dependencies but removed not necessary files for my tests. I prefer embedded option (uses portable format but not the PDB file) and did not use portable at all. This is also something special in SteamKit2 project file: |
That line only affects packing the pdb into nuget, shouldn't affect tests. |
I do not understand the condition for this setting. Please confirm your issue is resolved and the |
My issue seems to be resolved by changing debug type from |
I am not sure whether this is a regression or bug (see #1003, #1100).
Maybe a hint in coverlet documentation would be helpful. ![]() |
This worked for me. |
Thank you for the feedback. coverlet was created for .NET core and supports .NET framework but there is no plan to support DebugType full (windows only) |
Hi,
I am trying to run Coverlet but it throws the following error for every dll

BadImageFormatException during MetadataReaderProvider.FromPortablePdbStream in InstrumentationHelper.PortablePdbHasLocalSource, unable to check if the module has got local source.
I have sets of e-2-e tests that can be run only through executable application.
here is the command I am following
coverlet D:\d\Source\myProject\bin\Debug --target "C:\Program Files\myProject.exe" --output "D:\coverlet.xml" --format opencover
I can open exe and run tests but I am not getting any code coverage.
Any Idea how to fix this issue?
I m using coverlet.console on .net framework project
The text was updated successfully, but these errors were encountered: