msbuild: Replace ignored IO exceptions with path syntax checking

MSBuild is using IO exceptions to tell whether things are strings or files. This is making it hard for other teams to debug VS (and probably has some perf implications too). We should replace the IO exceptions with path syntax checking.

The exceptions seem to be coming from Path.GetFullPath, but msbuild may be using other .net APIs too.

To check for valid paths we can use something like: https://github.com/Microsoft/msbuild/blob/master/src/Shared/FileUtilities.cs#L526-L536 And then refactor all code paths that use exceptions to re-use some common piece of code that validates the path.

One way to repro this is to create an empty asp.net core web application and open it.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 16 (16 by maintainers)

Most upvoted comments

[Perf triage] @cdmihai, I don’t see a single thrown exception when opening, closing, building, and switching configurations of an empty ASP.NET Core MVC project on Dev16.10 Preview 1. The issue description does not have a callstack so can’t verify it in the code but empirically it appears to be fixed. OK to close?