-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Include the name of the conflicting assembly as a part of warning MSB3277 #2379
Merged
AndyGerlicher
merged 7 commits into
dotnet:master
from
theunrepentantgeek:feature/improve-message-for-msb3277
Oct 4, 2017
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9a67833
Modify ResolveAssemblyReference to include assembly name in the message
theunrepentantgeek ea66621
Modify tests that trigger MSB3277 to verify the message
theunrepentantgeek ec85ec5
Promote check outside of inner loop
theunrepentantgeek b50c788
Add new test to explicitly test the message in MSB3277
theunrepentantgeek a756072
Add unit test to ensure multiple conflicts are correctly reported
theunrepentantgeek f31e60c
Fixes for compilation and test failures
theunrepentantgeek b6b3691
Add asserts to affected tests
theunrepentantgeek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3538,7 +3538,7 @@ public void ConflictBetweenNonCopyLocalDependencies() | |
|
||
Execute(t); | ||
|
||
Assert.Equal(2, t.ResolvedDependencyFiles.Length); | ||
Assert.Equal(3, t.ResolvedDependencyFiles.Length); | ||
Assert.True(ContainsItem(t.ResolvedDependencyFiles, s_myLibraries_V2_DDllPath)); // "Expected to find assembly, but didn't." | ||
Assert.True(ContainsItem(t.ResolvedDependencyFiles, s_myLibraries_V1_DDllPath)); // "Expected to find assembly, but didn't." | ||
Assert.Equal(1, t.SuggestedRedirects.Length); | ||
|
@@ -3770,6 +3770,7 @@ public void ConflictWithBackVersionPrimary() | |
bool result = Execute(t); | ||
|
||
Assert.Equal(1, e.Warnings); // @"Expected one warning." | ||
e.AssertLogContainsMessageFromResource(AssemblyResources.GetString, "ResolveAssemblyReference.FoundConflicts", "D"); | ||
|
||
Assert.Equal(0, t.SuggestedRedirects.Length); | ||
Assert.Equal(3, t.ResolvedFiles.Length); | ||
|
@@ -3808,12 +3809,98 @@ public void ConflictWithBackVersionPrimaryWithAutoUnify() | |
bool result = Execute(t); | ||
|
||
Assert.Equal(1, e.Warnings); // @"Expected one warning." | ||
e.AssertLogContainsMessageFromResource(AssemblyResources.GetString, "ResolveAssemblyReference.FoundConflicts", "D"); | ||
|
||
Assert.Equal(0, t.SuggestedRedirects.Length); | ||
Assert.Equal(3, t.ResolvedFiles.Length); | ||
Assert.True(ContainsItem(t.ResolvedFiles, s_myLibraries_V1_DDllPath)); // "Expected to find assembly, but didn't." | ||
} | ||
|
||
/// <summary> | ||
/// Consider this dependency chain: | ||
/// | ||
/// App | ||
/// References - B | ||
/// Depends on D version 2 | ||
/// References - D, version 1 | ||
/// | ||
/// Both D1 and D2 are CopyLocal. This is a warning because D1 is a lower version | ||
/// than both D2 so that can't unify. These means that eventually when | ||
/// they're copied to the output directory they'll conflict. | ||
/// </summary> | ||
[Fact] | ||
public void ConflictGeneratesMessageReferencingAssemblyName() | ||
{ | ||
ResolveAssemblyReference t = new ResolveAssemblyReference(); | ||
|
||
MockEngine e = new MockEngine(); | ||
t.BuildEngine = e; | ||
|
||
t.Assemblies = new ITaskItem[] | ||
{ | ||
new TaskItem("B"), | ||
new TaskItem("D, Version=1.0.0.0, Culture=neutral, PublicKeyToken=aaaaaaaaaaaaaaaa") | ||
}; | ||
|
||
t.SearchPaths = new string[] | ||
{ | ||
s_myLibrariesRootPath, s_myLibraries_V2Path, s_myLibraries_V1Path | ||
}; | ||
|
||
t.TargetFrameworkDirectories = new string[] { s_myVersion20Path }; | ||
|
||
bool result = Execute(t); | ||
|
||
Assert.Equal(1, e.Warnings); // @"Expected one warning." | ||
|
||
// Check that we have a message identifying conflicts with "D" | ||
e.AssertLogContainsMessageFromResource(AssemblyResources.GetString, "ResolveAssemblyReference.FoundConflicts", "D"); | ||
} | ||
|
||
|
||
/// <summary> | ||
/// Consider this dependency chain: | ||
/// | ||
/// App | ||
/// References - B | ||
/// Depends on D version 2 | ||
/// Depends on G, version 2 | ||
/// References - D, version 1 | ||
/// References - G, version 1 | ||
/// | ||
/// All of Dv1, Dv2, Gv1 and Gv2 are CopyLocal. We should get two conflict warnings, one for D and one for G. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice! |
||
/// </summary> | ||
[Fact] | ||
public void ConflictGeneratesMessageReferencingEachConflictingAssemblyName() | ||
{ | ||
ResolveAssemblyReference t = new ResolveAssemblyReference(); | ||
|
||
MockEngine e = new MockEngine(); | ||
t.BuildEngine = e; | ||
|
||
t.Assemblies = new ITaskItem[] | ||
{ | ||
new TaskItem("B"), | ||
new TaskItem("D, Version=1.0.0.0, Culture=neutral, PublicKeyToken=aaaaaaaaaaaaaaaa"), | ||
new TaskItem("G, Version=1.0.0.0, Culture=neutral, PublicKeyToken=aaaaaaaaaaaaaaaa") | ||
}; | ||
|
||
t.SearchPaths = new string[] | ||
{ | ||
s_myLibrariesRootPath, s_myLibraries_V2Path, s_myLibraries_V1Path | ||
}; | ||
|
||
t.TargetFrameworkDirectories = new string[] { s_myVersion20Path }; | ||
|
||
bool result = Execute(t); | ||
|
||
Assert.Equal(2, e.Warnings); // @"Expected two warnings." | ||
|
||
// Check that we have both the expected messages | ||
e.AssertLogContainsMessageFromResource(AssemblyResources.GetString, "ResolveAssemblyReference.FoundConflicts", "D"); | ||
e.AssertLogContainsMessageFromResource(AssemblyResources.GetString, "ResolveAssemblyReference.FoundConflicts", "G"); | ||
} | ||
|
||
/// <summary> | ||
/// Consider this dependency chain: | ||
/// | ||
|
@@ -3853,7 +3940,7 @@ public void ConflictWithForeVersionPrimary() | |
Assert.True(result); // @"Expected a success because this conflict is solvable." | ||
Assert.Equal(3, t.ResolvedFiles.Length); | ||
Assert.True(ContainsItem(t.ResolvedFiles, s_myLibraries_V2_DDllPath)); // "Expected to find assembly, but didn't." | ||
Assert.Equal(1, t.ResolvedDependencyFiles.Length); | ||
Assert.Equal(2, t.ResolvedDependencyFiles.Length); | ||
} | ||
|
||
|
||
|
@@ -4482,7 +4569,7 @@ public void Regress265054() | |
Execute(t); | ||
|
||
Assert.Equal(2, t.ResolvedFiles.Length); | ||
Assert.Equal(3, t.ResolvedDependencyFiles.Length); | ||
Assert.Equal(4, t.ResolvedDependencyFiles.Length); | ||
Assert.True(ContainsItem(t.ResolvedDependencyFiles, s_myLibraries_V1_DDllPath)); // "Expected to find assembly, but didn't." | ||
Assert.True(ContainsItem(t.ResolvedDependencyFiles, s_myLibraries_V1_DDllPath)); // "Expected to find assembly, but didn't." | ||
|
||
|
@@ -8938,4 +9025,4 @@ private static void GenerateRedistAndProfileXmlLocations(string fullRedistConten | |
File.WriteAllText(profileRedistList, profileListContents); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the new one here
G
, added for the new test? Please add an assert for it as "documentation".