Coder Social home page Coder Social logo

[BUG] Missing code coverage when there is logic that sets a default value for a parameter of a specific type about coverlet HOT 3 OPEN

CristianBordeanFortech avatar CristianBordeanFortech commented on August 15, 2024 2
[BUG] Missing code coverage when there is logic that sets a default value for a parameter of a specific type

from coverlet.

Comments (3)

daveMueller avatar daveMueller commented on August 15, 2024

Thanks for reporting and thanks for the repro. When enabling the log it can be seen that it is the same issue as #1102. The assembly Microsoft.Extensions.DependencyInjection.Abstractions, Version=6.0.0.0, can't be resolved.

To get coverage with the collector in your repro I had to do two things. Add PreserveCompilationContext to the assembly under test.

MissingCoverage.Host.csproj

<Project Sdk="Microsoft.NET.Sdk.Web">
	<PropertyGroup>
            <TargetFramework>net6.0</TargetFramework>
	    <PreserveCompilationContext>true</PreserveCompilationContext>
        </PropertyGroup>
</Project>

And additionally upgrade to coverlet.collector 6.0.1 as we made some improvements to the assembly resolver in this version.

grafik

from coverlet.

CristianBordeanFortech avatar CristianBordeanFortech commented on August 15, 2024

@daveMueller, thanks for having a look in such a short time and providing a solution. What you suggested worked.
The one thing that I don't understand though is why there is a difference if serviceLifetime has a default value or not. If that assembly causes the issue there shouldn't be any difference, no?

from coverlet.

NickBranstein avatar NickBranstein commented on August 15, 2024

@daveMueller, thanks for having a look in such a short time and providing a solution. What you suggested worked. The one thing that I don't understand though is why there is a difference if serviceLifetime has a default value or not. If that assembly causes the issue there shouldn't be any difference, no?

Thanks so much for this - you saved us a ton of headaches. Interestingly enough this works fine for us on 6.0.0 when removing that default parameter. Interesting tidbit, this didn't start happening for us until we upgraded to dotnet 8.

from coverlet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.