-
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
Handle unsupported paths in ProjectInSolution.AbsolutePath #6238
Handle unsupported paths in ProjectInSolution.AbsolutePath #6238
Conversation
dotnet#5950 introduced a call to `Path.GetFullPath()` to get a path that is normalized. However, in some cases Visual Studio stores unsupported paths which will cause `Path.GetFullPath()` to throw. `Path.GetFullPath()` can also throw a `PathTooLongException` which is now handled. Fixes dotnet#6236
Copy/pasting my comment from the issue: @jeffkl looking at dates for 16.9 servicing releases. Looks like final sign off for 16.9.2 is in five days, and sign off for 16.9.3 is 4/12. If this code path really doesn't get hit much during builds (particularly web builds), I'm open to just catching the exception and leaving it at that. |
Whatever we decide, this should target |
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.
LGTM
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.
Looks mostly good!
} | ||
catch (Exception) | ||
{ | ||
// The call to GetFullPath can throw if the relative path is a URL or the paths are too long for the current file system |
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.
Could we add a simpler path normalization here like (look for \..\
) -> remove along with the prior path segment?
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.
I'd hate to get the logic wrong, I think the new code is pretty good to handle the situation more correctly.
src/Build.UnitTests/Construction/SolutionProjectGenerator_Tests.cs
Outdated
Show resolved
Hide resolved
Wow that's interesting, on .NET Core
I'll have to call |
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.
LGTM! Thanks!
Handle unsupported paths in ProjectInSolution.AbsolutePath (#6238)
Fixes #6236
Context
#5950 introduced a call to
Path.GetFullPath()
to get a path that is normalized. However, in some cases Visual Studio stores unsupported paths which will causePath.GetFullPath()
to throw.Path.GetFullPath()
can also throw aPathTooLongException
which is now handled.Changes Made
Revert to legacy code path of just calling
Path.Combine()
then do thePath.GetFullPath()
in atry...catch
on a best effort.Testing
Regression test added
Notes
https://developercommunity.visualstudio.com/t/msbuild-failing-with-web-site-project-in/1359528