Git Product home page Git Product logo

Comments (9)

bjorkstromm avatar bjorkstromm commented on June 28, 2024 1

Fixed in 5549980, I've now pushed 0.3.1 to NuGet. Will be available soon.

from depends.

bjorkstromm avatar bjorkstromm commented on June 28, 2024

Thanks! Would you mind submitting the contents of project.assets.json located on obj folder? The error seems to be related to parsing that file.

from depends.

jefflafay avatar jefflafay commented on June 28, 2024

I'm getting the same issue and it's because there are two targets. So maybe the code needs to be updated to handle multiple targets? I'm providing a top level view of my project.assets.json because it's 24k lines and I think that the multiple targets probably highlight the issue since Single() is going to throw an exception with multiple targets. Work around in the code might be First() or FirstOrDefault() but that's just my first thought and opinion.

{ "version": 3, "targets": { ".NETCoreApp,Version=v2.2": { // ... whole lot of data! }, ".NETCoreApp,Version=v2.2/win-x64": { // ... whole lot of data! } } }

from depends.

bjorkstromm avatar bjorkstromm commented on June 28, 2024

Thanks, will see if I’m able to reproduce. Multiple targets should not be sn issue, but for some reason the project.assets.json contains two targets with same TFM. Which is weird.

from depends.

jefflafay avatar jefflafay commented on June 28, 2024

Multiple targets would always be an issue if you're calling Single() on a collection with more than one, that's why its usage is seldom. First() and FirstOrDefault() tend to be best practice unless you've already explicitly checked that there is a single element before trying to access it.

from depends.

bjorkstromm avatar bjorkstromm commented on June 28, 2024

Hence the predicate inside the Single(), https://github.com/mholo65/depends/blob/master/src/Depends.Core/DependencyAnalyzer.cs#L205, and an expectation not to find more than one matching elements. In the project.assets.json files I worked with, when testing I’ve seen multiple targets, but only one target per target framework. I can’t understand why there are more than one target with same target framework, therefore it would be great to have a look at such file.

from depends.

jefflafay avatar jefflafay commented on June 28, 2024

I'm not sure why this project does that but I do have other projects that target windows and macos but the same framework. That could be another instance.

I'll look over my file and make sure it doesn't have anything sensitive. Should I just post the file contents here or would you like me to send it to you another way? Thanks for the help!

from depends.

bjorkstromm avatar bjorkstromm commented on June 28, 2024

Now I see. <OutputType>Exe</OutputType> in the .csproj will create two targets in project.assets.json for the same target framework. One with the RID (runtime identifier) and one without. Need to dig deeper and decide which one of these to pick.

from depends.

jefflafay avatar jefflafay commented on June 28, 2024

Fantastic, let me know if you need any other info.

from depends.

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.