Skip to content

NullReferenceException in NpmLockfileDetectorBase #1239

@gbtec-georgs

Description

@gbtec-georgs

given a package-lock.json file
and the package-lock.json file does not contain a dependencies object.
when I run the component-detection.exe (4.9.6+build.130.1d1e13bfa74ff8a3becf4dcd71954a750e1f7bc7)
then component detection succeeds
however, I get the following scary error in the output:

Could not parse Jtokens from <some-path>\package-lock.json file.
System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.ComponentDetection.Detectors.Npm.NpmLockfileDetectorBase.ProcessIndividualPackageJTokens(ISingleFileComponentRecorder singleFileComponentRecorder, JToken packageLockJToken, IEnumerable`1 packageJsonComponentStream, Boolean skipValidation)
   at Microsoft.ComponentDetection.Detectors.Npm.NpmLockfileDetectorBase.<>c__DisplayClass25_0.<OnFileFoundAsync>b__3(JToken token)
   at Microsoft.ComponentDetection.Detectors.Npm.NpmLockfileDetectorBase.ProcessAllPackageJTokensAsync(IComponentStream componentStream, JTokenProcessingDelegate jtokenProcessor)
   at Microsoft.ComponentDetection.Detectors.Npm.NpmLockfileDetectorBase.SafeProcessAllPackageJTokensAsync(IComponentStream componentStream, JTokenProcessingDelegate jtokenProcessor)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions