Open AArnott opened 3 years ago
@AArnott Above steps seem to cause bunch of issues:
Severity Code Description Project File Line Column Category Source Suppression State
Warning CS8034 Unable to load Analyzer assembly c:\temp\CsWin32-main\CsWin32-main\bin\Microsoft.Windows.Sdk.PInvoke.CSharp\Debug\netstandard2.0\YamlDotNet.dll: Could not find file 'c:\temp\CsWin32-main\CsWin32-main\bin\Microsoft.Windows.Sdk.PInvoke.CSharp\Debug\netstandard2.0\YamlDotNet.dll'. GenerationSandbox.Tests (net5.0) 1 1 Roslyn.HostError IntelliSense Active
c:\temp\CsWin32-main\CsWin32-main>msbuild /v:m
Microsoft (R) Build Engine version 16.9.0-preview-20570-04+b04541221 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
C:\Users\mavasani\.nuget\packages\microsoft.build.tasks.git\1.0.0\build\Microsoft.Build.Tasks.Git.targets(24,5): warning : Unable to locate repository with working directory that contains directory 'c:\temp\CsWin32-main\CsWin32-main\src\ScrapeDocs'. [c:\temp\CsWin32-main\CsWin32-main\src\ScrapeDocs\ScrapeDocs.csproj]
C:\Users\mavasani\.nuget\packages\microsoft.build.tasks.git\1.0.0\build\Microsoft.Build.Tasks.Git.targets(47,5): warning : Unable to locate repository with working directory that contains directory 'c:\temp\CsWin32-main\CsWin32-main\src\ScrapeDocs'. [c:\temp\CsWin32-main\CsWin32-main\src\ScrapeDocs\ScrapeDocs.csproj]
C:\Users\mavasani\.nuget\packages\microsoft.sourcelink.common\1.0.0\build\Microsoft.SourceLink.Common.targets(52,5): warning : Source control information is not available - the generated source link is empty. [c:\temp\CsWin32-main\CsWin32-main\src\ScrapeDocs\ScrapeDocs.csproj]
ScrapeDocs -> c:\temp\CsWin32-main\CsWin32-main\bin\ScrapeDocs\Debug\net5.0\ScrapeDocs.dll
C:\Users\mavasani\.nuget\packages\microsoft.build.tasks.git\1.0.0\build\Microsoft.Build.Tasks.Git.targets(24,5): warning : Unable to locate repository with working directory that contains directory 'c:\temp\CsWin32-main\CsWin32-main\src\Microsoft.Windows.Sdk.PInvoke.CSharp'. [c:\temp\CsWin32-main\CsWin32-main\src\Microsoft.Windows.Sdk.PInvoke.CSharp\Microsoft.Windows.Sdk.PInvoke.CSharp.csproj]
Regenerating c:\temp\CsWin32-main\CsWin32-main\obj\Debug\apidocs.yml. This may take a few minutes...
Enumerating documents to be parsed...
Unhandled exception. System.IO.DirectoryNotFoundException: Could not find a part of the path 'c:\temp\CsWin32-main\CsWin32-main\ext\sdk-api\sdk-api-src\content'.
at System.IO.Enumeration.FileSystemEnumerator`1.CreateDirectoryHandle(String path, Boolean ignoreNotFound)
at System.IO.Enumeration.FileSystemEnumerator`1.Init()
at System.IO.Enumeration.FileSystemEnumerator`1..ctor(String directory, Boolean isNormalized, EnumerationOptions options)
at System.IO.Enumeration.FileSystemEnumerable`1..ctor(String directory, FindTransform transform, EnumerationOptions options, Boolean isNormalized)
at System.IO.Enumeration.FileSystemEnumerableFactory.UserFiles(String directory, String expression, EnumerationOptions options)
at System.IO.Directory.InternalEnumeratePaths(String path, String searchPattern, SearchTarget searchTarget, EnumerationOptions options)
at System.IO.Directory.GetFiles(String path, String searchPattern, SearchOption searchOption)
at ScrapeDocs.Program.Worker(CancellationToken cancellationToken) in c:\temp\CsWin32-main\CsWin32-main\src\ScrapeDocs\Program.cs:line 81
at ScrapeDocs.Program.Main(String[] args) in c:\temp\CsWin32-main\CsWin32-main\src\ScrapeDocs\Program.cs:line 60
c:\temp\CsWin32-main\CsWin32-main\src\Microsoft.Windows.Sdk.PInvoke.CSharp\Microsoft.Windows.Sdk.PInvoke.CSharp.targets(13,5): error MSB3073: The command "dotnet c:\temp\CsWin32-main\CsWin32-main\bin\ScrapeDocs\Debug\net5.0\ScrapeDocs.dll ../../ext/sdk-api/sdk-api-src/content ../../obj/Debug/apidocs.yml" exited with code -532462766. [c:\temp\CsWin32-main\CsWin32-main\src\Microsoft.Windows.Sdk.PInvoke.CSharp\Microsoft.Windows.Sdk.PInvoke.CSharp.csproj]
Build FAILED.
C:\Users\mavasani\.nuget\packages\microsoft.build.tasks.git\1.0.0\build\Microsoft.Build.Tasks.Git.targets(24,5): warning : Unable to locate repository with working directory that contains directory 'c:\temp\CsWin32-main\CsWin32-main\src\ScrapeDocs'. [c:\temp\CsWin32-main\CsWin32-main\src\ScrapeDocs\ScrapeDocs.csproj]
C:\Users\mavasani\.nuget\packages\microsoft.build.tasks.git\1.0.0\build\Microsoft.Build.Tasks.Git.targets(47,5): warning : Unable to locate repository with working directory that contains directory 'c:\temp\CsWin32-main\CsWin32-main\src\ScrapeDocs'. [c:\temp\CsWin32-main\CsWin32-main\src\ScrapeDocs\ScrapeDocs.csproj]
C:\Users\mavasani\.nuget\packages\microsoft.sourcelink.common\1.0.0\build\Microsoft.SourceLink.Common.targets(52,5): warning : Source control information is not available - the generated source link is empty. [c:\temp\CsWin32-main\CsWin32-main\src\ScrapeDocs\ScrapeDocs.csproj]
C:\Users\mavasani\.nuget\packages\microsoft.build.tasks.git\1.0.0\build\Microsoft.Build.Tasks.Git.targets(24,5): warning : Unable to locate repository with working directory that contains directory 'c:\temp\CsWin32-main\CsWin32-main\src\Microsoft.Windows.Sdk.PInvoke.CSharp'. [c:\temp\CsWin32-main\CsWin32-main\src\Microsoft.Windows.Sdk.PInvoke.CSharp\Microsoft.Windows.Sdk.PInvoke.CSharp.csproj]
c:\temp\CsWin32-main\CsWin32-main\src\Microsoft.Windows.Sdk.PInvoke.CSharp\Microsoft.Windows.Sdk.PInvoke.CSharp.targets(13,5): error MSB3073: The command "dotnet c:\temp\CsWin32-main\CsWin32-main\bin\ScrapeDocs\Debug\net5.0\ScrapeDocs.dll ../../ext/sdk-api/sdk-api-src/content ../../obj/Debug/apidocs.yml" exited with code -532462766. [c:\temp\CsWin32-main\CsWin32-main\src\Microsoft.Windows.Sdk.PInvoke.CSharp\Microsoft.Windows.Sdk.PInvoke.CSharp.csproj]
4 Warning(s)
1 Error(s)
Ah, sorry. I left the --recursive
switch out of the repro steps. Can you try again?
Thanks. I can now enlist and build the repo, but still am not able to repro the core issue. Opening various files OR turning on full solution analysis still doesn't show any warnings in error list. I am on build Version 16.9.0 Preview 3.0 [30730.13.main]
. I'll keep trying, but looking at your comment VS sometimes shows dozens of warnings
, it seems like this might be some race condition in the way editorconfig documents are detected and added to the workspace. Also tagging @jasonmalinowski
Ya, it's not consistent for me either. In fact, it usually works. But when it doesn't, it's intensely annoying since my error list fills with hundreds of warnings at times.
@AArnott When it repros for you, does it happen the first time you open the solution or the warnings start popping up midway through your VS session? If it is the former, this is very likely a recent race condition introduced when we changed to a different model in Roslyn compiler and IDE to populate and store the editorconfig options using a SyntaxTreeOptionsProvider.
I think it happens at the start of the session.
Moving to @jasonmalinowski - this is likely a race condition from recent changes related to SyntaxTreeOptionsProvider that leads to editorconfig being intermittently ignored in IDE. Not sure what is good way to repro/investigate this though...
Tip: this definitely happens mid-session. It happened twice this afternoon, both times immediately after updating global.json from 3.1.302 to 5.0.100 and at the same time adjusting TargetFrameworks
to drop netcoreapp2.1
and add net5.0
.
These were the changes, made in memory all at once in VS and applied with Save All.
The #49597 you closed as a duplicate has a repo and a video that shows repro steps. On my machine following these steps has a 100% repro rate, did you try those steps?
So I got @AArnott's repro to reproduce...once. @onyxmaster no luck with your repro unfortunately.
For anybody who hits this next: if you have the Project System Tools extension installed, it adds a command Tools > Log Roslyn Workspace Structure which will create a log file that might be useful here.
I hit it today too: manyerrors.zip
using VS 2019 16.10 i see the same behavior: analyzer ignores .editorconfig for "intellisense"
will see if i can provide logs too...
Strange: installed the Tool mentioned here => Vs Restart => issue resolved 🙈 ... no problems (2 days until now)
This report was similar to https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1307480 where we were unable to reproduce.
I've been hitting this again lately too. It's not often, and closing/re-opening the solution seems to solve it.
It's present in VS2022 preview 3.1 also. Reopening solution indeed solves the issue, but I prefer not to reload it because of this:
I can also duplicate this problem. I will try installing the Project System Tools to see if I can still get it to happen.
I think I'm seeing this same problem...though I'm not using an IDE and see it even with a plain old console dotnet build
call (but that would probably make sense if it's a race condition inside Roslyn).
What's interesting is that the number of errors seems to change, so I suspect the .editorconfig
is being intermittently ignored on a per-project basis. Here's two dotnet build
calls seconds apart for a large multi-project solution, one right after the other with a dotnet clean
before each one.
Repeating this exercise continues to report varying numbers of errors (until eventually I get a good build...hopefully).
@daveaglick that would be a separate issue. Can you file a new issue? Thanks!
Sure thing - if it's not related, let me try to gather some more information first so I'm giving you all a clear picture. Always possible (likely?) that I'm holding it wrong in the first place.
Version Used: 16.9 preview 3 (30730.13.main)
Steps to Reproduce:
Open some of the source files in the test projects, or
src\ScrapeDocs\Program.cs
Expected Behavior:
No errors or warnings in the error list. This matches
dotnet build
behavior which shows no errors/warnings.Actual Behavior:
VS sometimes shows dozens of warnings, although their codes are suppressed in
.editorconfig
files found either in the project directory or a directory above.