Closed osdm closed 6 years ago
@OmarTawfik please take a look
@osdm thanks for reporting! will take a look. @jaredpar @jcouv to confirm triage.
@OmarTawfik This bug is reported to be fixed with milestone 15.8! When do you plan to rollout this update to Visual Studio?
@leonpierre this fix is in the latest 15.8 preview. We can't talk about exact dates for when 15.8 will be released in non-preview form.
Investigation A change in src/Compilers/CSharp/Portable/CommandLine/CSharpCommandLineParser.cs made in https://github.com/dotnet/roslyn/commit/d23cc53f65501798ae46e8ab9f3aa74077a7586d causes a bug.
There, PathUtilities.IsValidFilePath is called for a fileName instead of a filePath. Inside it, new FileInfo(fileName) is created, and there is no parent directory in fileName, so current directory is used. In our case current directory is a path to compiler binaries, and it is rather long. If path to compiler binaries length + file name length exceed 260 characters, then PathTooLongException is thrown and that results in CS2021 error.
Compiler errors should not depend on a path to compiler binaries, only on path to files being compiled.
Version Used: 2.8 (from dev15.7)
Steps to Reproduce:
Expected Behavior: No errors are produced
Actual Behavior: CSC : error CS2021: File name '...\MyCompany.SomeNamespace.SubNamespace.MoreNamespace.OneMoreNamespace.EvenMoreNamespace.Control.ShowMeSomeOptionsOptionsPagePanel.resources' is empty, contains invalid characters, has a drive specification without an absolute path, or is too long