Closed cn-ml closed 9 months ago
The code has to be there because these attributes are explicitly mentioned in your code.
Attributes.cs
is marked with // <auto-generated/>
and should be ignored by coverage tools. Check if your code coverage tool has "Ignore generated code settings".
Not particularly sure, i assumed coverlet would take care of that by default.
Alternatively, adding an ExcludeFromCodeCcoverageAttribute
would likely help.
I will try to use coverage runsettings first.
@pakrym What you think about adding [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
to the attributes and generated container?
.NET uses System.CodeDom.Compiler.GeneratedCodeAttribute
(https://github.com/search?q=repo%3Adotnet%2Fruntime%20s_generatedCodeAttribute&type=code) would that work?
.NET uses
System.CodeDom.Compiler.GeneratedCodeAttribute
(https://github.com/search?q=repo%3Adotnet%2Fruntime%20s_generatedCodeAttribute&type=code) would that work?
Yes, I've noticed that on projects that I work the code with that attribute is not accounted in test coverage.
Would you like to open a PR? 😉
Would you like to open a PR? 😉
Sure, but will take a while
I think that this issue is solved now, can you confirm @cn-ml?
The fix was released in 0.10.0. Thank you @skarllot !
The classes Jab.FromNamedServicesAttribute
and Jab.JabHelpers
are not annotated with GeneratedCodeAttribute
. Is that on purpose?
The version 0.10.1 fixes it
I just tried to migrate one of my projects from Injectio to Jab and one issue I came across is that the Marker attributes required for annotating the service provider are also contained in my output assembly when building. Is it possible to remove the attributes from the output assembly?
This is an issue to me, because it messes with the code coverage, and also because it is just not necessary to have these markers referenced in the assembly after building.
From what I see it should be possible to use conditionals or msbuild variables to hide these markers. I'm not really familiar with SG yet, but thats what I understood from Andrew Lock's blogpost.
Here is an image on how this looks on my code coverage report[^1].
[^1]: Dont make fun of my coverage, I'm working on it, it's just a rapid prototype.