bjorkstromm / depends

Tool for generating dependency trees for .NET projects
MIT License
556 stars 43 forks source link

Fix for KeyNotFoundException when a package dependency does not appear in the list of libraries taken from the lock file #26

Closed TomTondeur closed 2 years ago

TomTondeur commented 2 years ago

Hi, I recently discovered this tool and it seems really helpful, especially for the kind of projects I have to deal with at work which have very big dependency trees that are constantly being updated.

Unfortunately, when trying this tool on some of those projects, I've been getting a KeyNotFoundException on line 307. It seems that -for some reason- some of the dependencies of my packages are not listed in lock file, except as dependencies. I haven't been able to find an explanation for why that is, I only really have surgace-level knowledge of project.assets.json contents. I'm getting this with various packages (eg: Nerdbank.GitVersioning, NETStandard.Library) but have been unable to put together a minimal repro.

Regardless, my project files build and run just fine at the moment, so I assume this must be valid and should be a situation this tool ought to handle.

bjorkstromm commented 2 years ago

Hi! @TomTondeur thanks for this PR. I'd like to discuss some of the changes before merging this. Minimal repro would be nice, but I understand if it's not possible. If not, maybe it's possible to share the project.assets.json file?

bjorkstromm commented 2 years ago

Thank you for you contribution @TomTondeur! Your changes have been merged.

TomTondeur commented 2 years ago

Thanks for getting the fix into master, @bjorkstromm !