-
-
Notifications
You must be signed in to change notification settings - Fork 19
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
System.ArgumentOutOfRangeException in fresh solution #34
Comments
Thanks for reporting this. I found that Could you provide the output of |
Thant's for the quick response, sure: `
|
It's the second time I've made this kind of mistake. The problem is that I'm looking for the headers in English. There is an environment variable I can feed into the command that should correct this without requiring any changes in your environment. I'm on lunch, but I don't feel comfortable trying to throw something together without time to do some additional testing first. I'll let you know when I can get something you can try. |
I'm attaching a test package that should force en-US as the culture for the dotnet list command when it runs inside NuGetDefense. This should allow it to parse the output. Let me know how it goes when you get a chance to run it |
That build failed the ci test. I'll see what I can do about it. |
Thanks for working this fast on this problem, really appreciated! |
Found the issue, I made a small deserialization change right after this one that broke it. And I inverted a check in that original version. This should work for you. If it does, I'll push it up to NuGet.Org as 1.0.9 |
Hey thanks for the quick update, unfortunately I'm still getting the same error:
After checking a bit I realized |
Update:
1>C:\Users\xxx\source\repos\NugetDefenseTest\ConsoleApp1\ConsoleApp1.csproj(9,6): error : 8 vulnerabilities found for bootstrap @ 3.0.3 |
I'm about to go to sleep and it will probably be a good 16 hours before I can look at it again. If worst comes to worse, I'll try to dig into the dotnet code and pull out the localized strings that may end up in the output. I'm guessing the NVD scan error is a separate issue. I'll see what I can do to reproduce that while I'm at it. |
Thanks a lot for your effort, really appreciated. |
I believe I have a working method that should be language independant as long as no cultures use something other than the ">" for the package lines.
|
I added a partial test that used the output you provided earlier to ensure I don't accidentally do something like that again. I hope to have a version up we can test for that soon. I'm just now looking into reproducing the second exception. If you have a project with transitive dependencies, I'd love to add the |
I believe I have the issue with NVD fixed (writing tests now). Expect a test build sometime tonight. |
NuGetDefense.1.0.9-pre0003.nupkg.zip (Should also be available from the GitHub Package Repository as v1.0.9-ci0005, but I haven't had much luck with adding it as a source outside of GitHub Actions) Hopefully this takes care of it, I added a check for the key before adding it to the vulnerablity dictionary that NVD uses. |
Great job, thank you! Seems to work now:
|
96bca90 should fix the issue and has been released as v1.0.9 |
First things first: Great seeing you put work into this package, thanks a lot for that.
Describe the bug
When building my solution I encounter a System.ArgumentOutOfRangeException: Length cannot be less than zero.
To Reproduce
Steps to reproduce the behavior:
{ "WarnOnly": false, "Log": null, "VulnerabilityReports": {}, "Logs": null, "CheckTransitiveDependencies": true, "ErrorSettings": { "ErrorSeverityThreshold": 5, "Cvss3Threshold": -1, "IgnoredPackages": [ { "Id": "NugetDefense", "Version": "1.0.8.0" } ], "IgnoredCvEs": [], "AllowedPackages": [], "WhiteListedPackages": null, "BlockedPackages": [], "BlacklistedPackages": null }, "OssIndex": { "Enabled": true, "BreakIfCannotRun": true }, "NVD": { "SelfUpdate": false, "TimeoutInSeconds": 15, "Enabled": true, "BreakIfCannotRun": true } }
error : Encountered a fatal exception while checking for Dependencies in C:\Users\***\source\repos\NugetDefenseTest\ConsoleApp1\ConsoleApp1.csproj. Exception: System.ArgumentOutOfRangeException: Length cannot be less than zero. (Parameter 'length') 1> at System.String.Substring(Int32 startIndex, Int32 length) 1> at NuGetDefense.Core.NuGetFile.<>c__DisplayClass7_0.<ParseListPackages>b__2(String l) 1> at System.Linq.Enumerable.WhereSelectEnumerableIterator
2.MoveNext()1> at System.Linq.Enumerable.ToDictionary[TSource,TKey](IEnumerable
1 source, Func
2 keySelector, IEqualityComparer1 comparer) 1> at NuGetDefense.Core.NuGetFile.ParseListPackages(String dotnetListOutput) 1> at NuGetDefense.Core.NuGetFile.dotnetListPackages(String projectFile, String targetFramework) 1> at NuGetDefense.Core.NuGetFile.LoadPackages(String targetFramework, Boolean checkTransitiveDependencies) 1> at NuGetDefense.Program.Main(String[] args)
Expected behavior
I expected a successful build with positive / negative NugetDefense messages.
Screenshots
Tools (please complete the following information):
Additional context
The text was updated successfully, but these errors were encountered: