Fix null ref exception when referencing csproj

This commit is contained in:
Victor Hurdugaci 2016-07-14 11:48:48 -07:00
parent 9f6a691655
commit c769d8dee9
1 changed files with 4 additions and 1 deletions

View File

@ -48,7 +48,10 @@ namespace Microsoft.DotNet.Watcher.Core.Internal
if (File.Exists(projectLockJsonPath))
{
var lockFile = LockFileReader.Read(projectLockJsonPath, designTime: false);
ProjectDependencies = lockFile.ProjectLibraries.Select(dep => GetProjectRelativeFullPath(dep.Path)).ToList();
ProjectDependencies = lockFile.ProjectLibraries
.Where(dep => !string.IsNullOrEmpty(dep.Path)) // The dependency path is null for xproj -> csproj reference
.Select(dep => GetProjectRelativeFullPath(dep.Path))
.ToList();
}
else
{