Skip to content
This repository has been archived by the owner on Dec 18, 2017. It is now read-only.

Commit

Permalink
Handle null versions in dependencies
Browse files Browse the repository at this point in the history
- Added test in WalkerFacts

#1161
  • Loading branch information
davidfowl committed Feb 4, 2015
1 parent bd9d03b commit 31d24b2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public override int GetHashCode()
{
Name = library.Name,
IsGacOrFrameworkReference = library.IsGacOrFrameworkReference,
VersionRange = new SemanticVersionRange
VersionRange = library.Version == null ? null : new SemanticVersionRange
{
MinVersion = library.Version,
VersionFloatBehavior = SemanticVersionFloatBehavior.None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public LibraryDescription GetDescription(LibraryRange libraryRange, FrameworkNam
{
Name = libraryRange.Name,
IsGacOrFrameworkReference = libraryRange.IsGacOrFrameworkReference,
Version = libraryRange.VersionRange.MinVersion
Version = libraryRange.VersionRange?.MinVersion
},
Dependencies = Enumerable.Empty<LibraryDependency>(),
Resolved = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ public void RejectedDependenciesToNotCarryConstraints()
.Package("e", "1.0", that => that.Needs("x", "1.0"))
.Package("e", "2.0", that => that.Needs("x", "2.0"))
.Package("x", "1.0")
.Package("x", "2.0");
.Package("x", "2.0")
.Package("g", version: null);

var walker = new DependencyWalker(new[] { testProvider });
walker.Walk("a", new SemanticVersion("1.0"), VersionUtility.ParseFrameworkName("net45"));
Expand Down Expand Up @@ -244,7 +245,7 @@ public TestDependencyProvider Package(string name, string version, Action<Entry>
Key = new Library
{
Name = name,
Version = new SemanticVersion(version)
Version = version == null ? null : new SemanticVersion(version)
}
};

Expand Down

0 comments on commit 31d24b2

Please sign in to comment.