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

Common Language Runtime detected an invalid program #26

Closed
latop2604 opened this issue Jul 24, 2018 · 7 comments
Closed

Common Language Runtime detected an invalid program #26

latop2604 opened this issue Jul 24, 2018 · 7 comments

Comments

@latop2604
Copy link

latop2604 commented Jul 24, 2018

I'm try to use altcover (globaltool 3.5.569) to generate coverage for my netcore 2.1 app, using "Instrument now, test later, runner mode"

But half of my tests failed with the error message "System.InvalidProgramException : Common Language Runtime detected an invalid program."

And then the report can still be generated (reportgenerator) but is partial.

I use theses commands :

altcover --opencover -o=__saved_cart --inplace -c=0 "-c=[Fact]" -x cart.opencover.xml -i api-cart/src/Cart.Tests/bin/Debug/netcoreapp2.1/ --fileFilter=Reference.cs
altcover Runner -x dotnet -r api-cart/src/Cart.Tests/bin/Debug/netcoreapp2.1 -- test api-cart/src/Cart.Tests --no-build --no-restore
Nombre total de tests : 57. Réussis : 34. Non réussis : 23. Ignorés : 0.
Échec de la série de tests.
Durée d'exécution des tests : 12,4410 Secondes
Getting results...
... /Users/xxx/xxx/cart.opencover.xml.0.acv (32 175b)
13 420 visits recorded in 00:00:00.1235400 (108 629 visits/sec)
A total of 13 420 visits recorded
Coverage statistics flushing took 0,513 seconds
Visited Classes 33 of 332 (9.94)
Visited Methods 125 of 689 (18.14)
Visited Points 510 of 4748 (10.74)
Visited Branches 60 of 1512 (3.97)
==== Alternative Results (includes all methods including those without corresponding source) ====
Alternative Visited Classes 33 of 449 (7.35)
Alternative Visited Methods 125 of 1135 (11.01)

If a use the nuget package AltCover everything seem ok.

@SteveGilham
Copy link
Owner

This will be something similar to issues #13, #14 and #15, where there's some IL idiom I've not used in any of my test code so far, so this is going to come down to finding a cut-down repro. Running PEVerify over the failing assembly should indicate where things have been broken.

My first suspicion is that this will be in the unit tests, as managing the tracking context is quite invasive, and that is what caused the problems in the previous issues (that can be tested by omitting the -c arguments).

@latop2604
Copy link
Author

Arf, ok. I will try to find a repro

@latop2604
Copy link
Author

I run my test again without the -c parameter. And everything seem ok. All test pass.
Maybe should be a good idee to remove it from the wiki page

@SteveGilham
Copy link
Owner

I expected that the problem would be that the adding the tracking instrumentation would be what broke the IL; and that the tests would run OK without that (and that the tracking information would probably not be of significant use to you).

I would still be interested in finding what it was in your unit tests that I managed to break, so if you do ever manage to get a simple repro, please do pass it to me.

@SteveGilham
Copy link
Owner

Wiki page updated; I'll leave it up to you whether you want to close the issue now you're unblocked.

@SteveGilham SteveGilham added the cannot repro Need a simple case of the issue to work from label Jul 25, 2018
@SteveGilham
Copy link
Owner

Closing for the moment as no repro; leaving as an open ticket on the current kanban.

@SteveGilham SteveGilham added duplicate and removed cannot repro Need a simple case of the issue to work from labels Nov 26, 2020
@ffMathy
Copy link
Contributor

ffMathy commented Dec 2, 2020

This is exactly what I was experiencing in #105, which has been resolved now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants