Skip to content

Fix warning when newline in hintpath - #4598

Merged
wli3 merged 2 commits into
dotnet:masterfrom
wli3:fix-hintpath
Aug 9, 2019
Merged

wli3 merged 2 commits into
dotnet:masterfrom
wli3:fix-hintpath

Conversation

@wli3

@wli3 wli3 commented Aug 8, 2019

Copy link
Copy Markdown

Description

If there are newlines or white spaces passed to Path.GetFullpath, it will throw on fullframework. Adding Path.GetFullpath in previous change caused extra warning from Resolve Assembly Reference. This change added "skip when the path is not valid" to being back the "no warning but skip" behavior of 16.1.

Customer Impact

If the customer has warning as error enabled, a build would be successful in 16.1 but would be fail in the latest version

Regression?

Yes. by #4414, since 16.2

Risk

Low risk.

Test changes in this PR

Additional unit tests and manual end to end tests.


fix #4593

This is a strict fix for the warning problem. Please look at CannotNormalizePathWithNewLineAndSpace test. FileUtilities.NormalizePath will get garbage output like (c:\work\test \r\n c:\work\referenced\file.dll) when called with newline. So File.Exists cannot find the correct file anyway. The fix is only to make it quiet.

It behaves differently in core because Path.GetFullpath no longer throws when there is invalid char
To be discuss

  1. Should we make it work? Instead of skip when contains invalid char, should we Trim it instead?
  2. Is master the right branch? Do I need ask mode template for 16.3?

@wli3 wli3 self-assigned this Aug 8, 2019
@wli3 wli3 changed the title Fix warning when newline in hintpath Need discussion Fix warning when newline in hintpath Aug 8, 2019
@wli3 wli3 changed the title Need discussion Fix warning when newline in hintpath WIP Need discussion Fix warning when newline in hintpath Aug 8, 2019
@wli3
wli3 requested review from nguerrera and rainersigwald August 8, 2019 22:56
@nguerrera

Copy link
Copy Markdown
Contributor

I don't understand how the repro project I saw in 16.1 would have been quiet, but not resolve to the path. I would have expected a build warning for unresolved reference if the path was not interpreted as trimmed in 2.1. Did it resolve from another resolver than HintPath?

@nguerrera

Copy link
Copy Markdown
Contributor

I definitely don't want to have no warning, but also ignore the hint path. I'm assuming either warn and ignore or don't warn and trim.

@nguerrera

Copy link
Copy Markdown
Contributor

Do you have a binlog, or can you make a binlog for 16.1 building this: #4593 (comment)

@rainersigwald

Copy link
Copy Markdown
Member

I agree: I'd like to know exactly what caused the 16.1 behavior before we decide how to fix this.

@nguerrera

Copy link
Copy Markdown
Contributor

Oh, I see the difference. The reference ItemSpec is to System.Net.Http so it resolves to target framework and hint path with new lines is treated as just not found which is not a warning if another resolver finds it.

@nguerrera

Copy link
Copy Markdown
Contributor

So this goes back to what I said originally: we should not trim in sdk conflict resolution if rar does not. What a mess.

@wli3

wli3 commented Aug 9, 2019

Copy link
Copy Markdown
Author

So which way we should we choose?
a. trim RAR hint path so it can find the actual hint path (and it should, some xml formatter will add the new line)
b. keep the change like this, and stop trimming in conflict resolution and quietly skip when there is one

I prefer a. sounds closer to what customer want

@rainersigwald

Copy link
Copy Markdown
Member

a is better behavior, but I think since it's late in 16.3, we should just revert to the 16.1 behavior. Then there's no risk of breaking people with incorrect hint paths that weren't being respected because of whitespace.

@wli3

wli3 commented Aug 9, 2019

Copy link
Copy Markdown
Author

So take this change as is?

I will later change the sdk part.

@wli3 wli3 changed the title WIP Need discussion Fix warning when newline in hintpath Need discussion Fix warning when newline in hintpath Aug 9, 2019
@wli3

wli3 commented Aug 9, 2019

Copy link
Copy Markdown
Author

Also do i need ask mode? 16.3 is master?

@rainersigwald

Copy link
Copy Markdown
Member

master is still 16.3 for the moment, yeah.

)
{
if (!string.IsNullOrEmpty(hintPath))
if (!string.IsNullOrEmpty(hintPath) && !FileUtilities.PathIsInvalid(hintPath))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this deserves a comment. Probably with a link to the bug to consider trimming HintPath in 17.0.

@wli3 wli3 Aug 9, 2019

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comment, fc762c4

and I do need to have an ask mode write up

@wli3 wli3 mentioned this pull request Aug 9, 2019
@wli3 wli3 changed the title Need discussion Fix warning when newline in hintpath \Fix warning when newline in hintpath Aug 9, 2019
@wli3 wli3 changed the title \Fix warning when newline in hintpath Fix warning when newline in hintpath Aug 9, 2019
@wli3 wli3 added this to the MSBuild 16.3 milestone Aug 9, 2019
@wli3 wli3 added the ask-mode label Aug 9, 2019
@wli3

wli3 commented Aug 9, 2019

Copy link
Copy Markdown
Author

get approved from email. merging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Warning from RAR with hint path has extra new line

3 participants