Open ghisguth opened 3 years ago
@ghisguth Thanks for the detailed analysis here; we'll have to process this one to figure out which layers will need a fix here!
I don't think this discussion is only limited to /analyzerConfig
. Consider that for options like /pathMap
we also treat the argument literally and do no normalization on it.
How we handle file path casing is an aspect of the compiler that I don't think we have an explicit documented plan on. This is likely a good time to do that and add a bit of consistency to how we do it. The general approach we've used to the best of my recollection is:
@chsienki @mavasani @tmat for feedback here as well.
Version Used:
Microsoft (R) Visual C# Compiler version 3.8.0-5.20604.10 (9ed4b774)
Steps to Reproduce:
cd c:\Src\Foo\Bar\
/analyzerconfig:C:\Src\Foo\.editorconfig
(Note disk letter is upper caseC:
)Expected Behavior:
Roslyn will load editor config and apply to all files in
c:\Src\Foo\Bar\
Actual Behavior:
Roslyn ignores the config for analyzers.
Details:
Directory.GetCurrentDirectory()
. https://github.com/dotnet/roslyn/blob/26939574c8e180d5135b2a28f183709b67483634/src/Compilers/Shared/BuildClient.cs#L92Visual Studio impact:
if you open csproj via solution. Visual studio will lowercase disk in path of the csproj and while compile all paths will start from lowercase (e.g. c:\Src\Foo\Bar\Bar.csproj). analyzerconfig option will work as expected.
If you open csproj directly and try to compile. Visual studio will open it with disk as upper case (e.g. C:\Src\Foo\Bar\Bar.csproj). And analyzer config will be ignored.