Skip to content
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

C# diagnostic severities set in .editorconfig are ignored, warnings show up in editor anyway #4082

Closed
AArnott opened this issue Sep 25, 2020 · 2 comments

Comments

@AArnott
Copy link
Contributor

AArnott commented Sep 25, 2020

Issue Description

C# compiler warnings show up in the VS Code editor and Problems tab even though an .editorconfig file exists that says that these warnings should be silent.

Steps to Reproduce

This reproduces in VS Code with devcontainers as well as GitHub Codespaces. This does not seem to reproduce outside a devcontainer.

  1. Either clone https://github.com/AArnott/Library.Template or create a Codespace from here.
  2. If using VS Code, Open Folder into the newly cloned repo. When asked, re-open the folder within a devcontainer.
  3. Navigate to test/Library.Tests/CalculatorTests.cs

You may need to wait for omnisharp to spin up. You might have to restart omnisharp after the dotnet SDK is installed, which tends to happen in the background due to devcontainer.json installing prereqs.

Expected Behavior

No warnings, because the test/.editorconfig file sets the CS1591 warning to severity silent.

Actual Behavior

3 CS1591 warnings appear.

image

Logs

OmniSharp log

Starting OmniSharp server at 9/25/2020, 7:48:28 PM Target: /workspaces/Library.Template/Library.sln

OmniSharp server started.
Path: /root/.vscode-server/extensions/ms-dotnettools.csharp-1.23.2/.omnisharp/1.37.1/run
PID: 946

Starting OmniSharp on ubuntu 18.4 (x64)
info: OmniSharp.Services.DotNetCliService
DotNetPath set to dotnet
info: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 1 MSBuild instance(s)
1: StandAlone 16.8.0 - "/root/.vscode-server/extensions/ms-dotnettools.csharp-1.23.2/.omnisharp/1.37.1/omnisharp/.msbuild/Current/Bin"
info: OmniSharp.MSBuild.Discovery.MSBuildLocator
MSBUILD_EXE_PATH environment variable set to '/root/.vscode-server/extensions/ms-dotnettools.csharp-1.23.2/.omnisharp/1.37.1/omnisharp/.msbuild/Current/Bin/MSBuild.exe'
info: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: StandAlone 16.8.0 - "/root/.vscode-server/extensions/ms-dotnettools.csharp-1.23.2/.omnisharp/1.37.1/omnisharp/.msbuild/Current/Bin"
CscToolExe = csc.exe
MSBuildToolsPath = /root/.vscode-server/extensions/ms-dotnettools.csharp-1.23.2/.omnisharp/1.37.1/omnisharp/.msbuild/Current/Bin
CscToolPath = /root/.vscode-server/extensions/ms-dotnettools.csharp-1.23.2/.omnisharp/1.37.1/omnisharp/.msbuild/Current/Bin/Roslyn
BypassFrameworkInstallChecks = true
MSBuildExtensionsPath = /root/.vscode-server/extensions/ms-dotnettools.csharp-1.23.2/.omnisharp/1.37.1/omnisharp/.msbuild
info: OmniSharp.Cake.CakeProjectSystem
Detecting Cake files in '/workspaces/Library.Template'.
info: OmniSharp.Cake.CakeProjectSystem
Could not find any Cake files
info: OmniSharp.MSBuild.ProjectSystem
Detecting projects in '/workspaces/Library.Template/Library.sln'.
info: OmniSharp.MSBuild.ProjectManager
Queue project update for '/workspaces/Library.Template/src/Library/Library.csproj'
info: OmniSharp.MSBuild.ProjectManager
Queue project update for '/workspaces/Library.Template/test/Library.Tests/Library.Tests.csproj'
info: OmniSharp.Script.ScriptProjectSystem
Detecting CSX files in '/workspaces/Library.Template'.
info: OmniSharp.Script.ScriptProjectSystem
Could not find any CSX files
info: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
info: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.Completion.CompletionOptionsProvider, Order: 0
info: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100
info: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.ImplementTypeWorkspaceOptionsProvider, Order: 110
info: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.BlockStructureWorkspaceOptionsProvider, Order: 140
info: OmniSharp.WorkspaceInitializer
Configuration finished.
info: OmniSharp.Stdio.Host
Omnisharp server running using Stdio at location '/workspaces/Library.Template' on host 765.
info: OmniSharp.MSBuild.ProjectManager
Loading project: /workspaces/Library.Template/src/Library/Library.csproj
info: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file '/workspaces/Library.Template/src/Library/Library.csproj'.
info: OmniSharp.MSBuild.ProjectManager
Adding project '/workspaces/Library.Template/src/Library/Library.csproj'
info: OmniSharp.MSBuild.ProjectManager
Loading project: /workspaces/Library.Template/test/Library.Tests/Library.Tests.csproj
info: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file '/workspaces/Library.Template/test/Library.Tests/Library.Tests.csproj'.
info: OmniSharp.MSBuild.ProjectManager
Adding project '/workspaces/Library.Template/test/Library.Tests/Library.Tests.csproj'
info: OmniSharp.MSBuild.ProjectManager
Update project: Library
info: OmniSharp.MSBuild.ProjectManager
Update project: Library.Tests
[warn]: OmniSharp.MSBuild.ProjectManager
Unable to resolve assembly '/workspaces/Library.Template/bin/Library/Debug/netstandard2.0/Library.dll'
info: OmniSharp.MSBuild.ProjectManager
Queue project update for '/workspaces/Library.Template/test/Library.Tests/Library.Tests.csproj'
info: OmniSharp.MSBuild.ProjectManager
Loading project: /workspaces/Library.Template/test/Library.Tests/Library.Tests.csproj
A compatible installed .NET SDK for global.json version [3.1.302] from [/workspaces/Library.Template/global.json] was not found.
Install the [3.1.302] .NET SDK or update [/workspaces/Library.Template/global.json] with an installed .NET SDK:
[warn]: OmniSharp.MSBuild.ProjectManager
Failed to load project file '/workspaces/Library.Template/test/Library.Tests/Library.Tests.csproj'.
/workspaces/Library.Template/test/Library.Tests/Library.Tests.csproj(1,1)
Microsoft.Build.Exceptions.InvalidProjectFileException: The SDK 'Microsoft.NET.Sdk' specified could not be found. /workspaces/Library.Template/test/Library.Tests/Library.Tests.csproj
at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject (System.String errorSubCategoryResourceName, Microsoft.Build.Shared.IElementLocation elementLocation, System.String resourceName, System.Object[] args) [0x00040] in <4322d44f99c84aab9075efd37869f964>:0
at Microsoft.Build.Shared.ProjectErrorUtilities.VerifyThrowInvalidProject[T1] (System.Boolean condition, System.String errorSubCategoryResourceName, Microsoft.Build.Shared.IElementLocation elementLocation, System.String resourceName, T1 arg0) [0x00003] in <4322d44f99c84aab9075efd37869f964>:0
at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject[T1] (Microsoft.Build.Shared.IElementLocation elementLocation, System.String resourceName, T1 arg0) [0x00000] in <4322d44f99c84aab9075efd37869f964>:0
at Microsoft.Build.Evaluation.Evaluator4[P,I,M,D].ExpandAndLoadImportsFromUnescapedImportExpressionConditioned (System.String directoryOfImportingFile, Microsoft.Build.Construction.ProjectImportElement importElement, System.Collections.Generic.List1[Microsoft.Build.Construction.ProjectRootElement]& projects, Microsoft.Build.BackEnd.SdkResolution.SdkResult& sdkResult, System.Boolean throwOnFileNotExistsError) [0x00309] in <4322d44f99c84aab9075efd37869f964>:0
at Microsoft.Build.Evaluation.Evaluator4[P,I,M,D].ExpandAndLoadImports (System.String directoryOfImportingFile, Microsoft.Build.Construction.ProjectImportElement importElement, Microsoft.Build.BackEnd.SdkResolution.SdkResult& sdkResult) [0x00027] in <4322d44f99c84aab9075efd37869f964>:0 at Microsoft.Build.Evaluation.Evaluator4[P,I,M,D].EvaluateImportElement (System.String directoryOfImportingFile, Microsoft.Build.Construction.ProjectImportElement importElement) [0x0000d] in <4322d44f99c84aab9075efd37869f964>:0
at Microsoft.Build.Evaluation.Evaluator4[P,I,M,D].PerformDepthFirstPass (Microsoft.Build.Construction.ProjectRootElement currentProjectOrImport) [0x000e6] in <4322d44f99c84aab9075efd37869f964>:0 at Microsoft.Build.Evaluation.Evaluator4[P,I,M,D].Evaluate () [0x0013c] in <4322d44f99c84aab9075efd37869f964>:0
at Microsoft.Build.Evaluation.Evaluator4[P,I,M,D].Evaluate (Microsoft.Build.Evaluation.IEvaluatorData4[P,I,M,D] data, Microsoft.Build.Construction.ProjectRootElement root, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings, System.Int32 maxNodeCount, Microsoft.Build.Collections.PropertyDictionary1[T] environmentProperties, Microsoft.Build.BackEnd.Logging.ILoggingService loggingService, Microsoft.Build.Evaluation.IItemFactory2[S,T] itemFactory, Microsoft.Build.Evaluation.IToolsetProvider toolsetProvider, Microsoft.Build.Evaluation.ProjectRootElementCacheBase projectRootElementCache, Microsoft.Build.Framework.BuildEventContext buildEventContext, Microsoft.Build.BackEnd.SdkResolution.ISdkResolverService sdkResolverService, System.Int32 submissionId, Microsoft.Build.Evaluation.Context.EvaluationContext evaluationContext, System.Boolean interactive) [0x00047] in <4322d44f99c84aab9075efd37869f964>:0
at Microsoft.Build.Evaluation.Project+ProjectImpl.Reevaluate (Microsoft.Build.BackEnd.Logging.ILoggingService loggingServiceForEvaluation, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings, Microsoft.Build.Evaluation.Context.EvaluationContext evaluationContext) [0x00063] in <4322d44f99c84aab9075efd37869f964>:0
at Microsoft.Build.Evaluation.Project+ProjectImpl.ReevaluateIfNecessary (Microsoft.Build.BackEnd.Logging.ILoggingService loggingServiceForEvaluation, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings, Microsoft.Build.Evaluation.Context.EvaluationContext evaluationContext) [0x00035] in <4322d44f99c84aab9075efd37869f964>:0
at Microsoft.Build.Evaluation.Project+ProjectImpl.ReevaluateIfNecessary (Microsoft.Build.BackEnd.Logging.ILoggingService loggingServiceForEvaluation, Microsoft.Build.Evaluation.Context.EvaluationContext evaluationContext) [0x00000] in <4322d44f99c84aab9075efd37869f964>:0
at Microsoft.Build.Evaluation.Project+ProjectImpl.ReevaluateIfNecessary (Microsoft.Build.Evaluation.Context.EvaluationContext evaluationContext) [0x00007] in <4322d44f99c84aab9075efd37869f964>:0
at Microsoft.Build.Evaluation.Project+ProjectImpl.Initialize (System.Collections.Generic.IDictionary2[TKey,TValue] globalProperties, System.String toolsVersion, System.String subToolsetVersion, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings, Microsoft.Build.Evaluation.Context.EvaluationContext evaluationContext) [0x00127] in <4322d44f99c84aab9075efd37869f964>:0 at Microsoft.Build.Evaluation.Project..ctor (System.String projectFile, System.Collections.Generic.IDictionary2[TKey,TValue] globalProperties, System.String toolsVersion, System.String subToolsetVersion, Microsoft.Build.Evaluation.ProjectCollection projectCollection, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings, Microsoft.Build.Evaluation.Context.EvaluationContext evaluationContext) [0x00073] in <4322d44f99c84aab9075efd37869f964>:0
at Microsoft.Build.Evaluation.Project..ctor (System.String projectFile, System.Collections.Generic.IDictionary2[TKey,TValue] globalProperties, System.String toolsVersion, System.String subToolsetVersion, Microsoft.Build.Evaluation.ProjectCollection projectCollection, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings) [0x00000] in <4322d44f99c84aab9075efd37869f964>:0 at Microsoft.Build.Evaluation.Project..ctor (System.String projectFile, System.Collections.Generic.IDictionary2[TKey,TValue] globalProperties, System.String toolsVersion, Microsoft.Build.Evaluation.ProjectCollection projectCollection, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings) [0x00000] in <4322d44f99c84aab9075efd37869f964>:0
at Microsoft.Build.Evaluation.Project..ctor (System.String projectFile, System.Collections.Generic.IDictionary2[TKey,TValue] globalProperties, System.String toolsVersion, Microsoft.Build.Evaluation.ProjectCollection projectCollection) [0x00000] in <4322d44f99c84aab9075efd37869f964>:0 at Microsoft.Build.Evaluation.ProjectCollection.LoadProject (System.String fileName, System.Collections.Generic.IDictionary2[TKey,TValue] globalProperties, System.String toolsVersion) [0x000f7] in <4322d44f99c84aab9075efd37869f964>:0
at Microsoft.Build.Evaluation.ProjectCollection.LoadProject (System.String fileName, System.String toolsVersion) [0x00000] in <4322d44f99c84aab9075efd37869f964>:0
at OmniSharp.MSBuild.ProjectLoader.EvaluateProjectFileCore (System.String filePath, System.Collections.Generic.IReadOnlyDictionary2[TKey,TValue] projectConfigurationsInSolution) [0x00160] in <1a71fa802bd145748ee923c03674f4d4>:0 at OmniSharp.MSBuild.ProjectLoader.BuildProject (System.String filePath, System.Collections.Generic.IReadOnlyDictionary2[TKey,TValue] configurationsInSolution) [0x0000d] in <1a71fa802bd145748ee923c03674f4d4>:0
at OmniSharp.MSBuild.ProjectFile.ProjectFileInfo.Reload (OmniSharp.MSBuild.ProjectLoader loader) [0x00019] in <1a71fa802bd145748ee923c03674f4d4>:0
at OmniSharp.MSBuild.ProjectManager+<>c__DisplayClass32_0.b__0 () [0x00000] in <1a71fa802bd145748ee923c03674f4d4>:0
at (wrapper delegate-invoke) System.Func1[System.ValueTuple3[OmniSharp.MSBuild.ProjectFile.ProjectFileInfo,System.Collections.Immutable.ImmutableArray1[OmniSharp.MSBuild.Logging.MSBuildDiagnostic],OmniSharp.MSBuild.Notification.ProjectLoadedEventArgs]].invoke_TResult() at OmniSharp.MSBuild.ProjectManager.LoadOrReloadProject (System.String projectFilePath, System.Func1[TResult] loader) [0x0001b] in <1a71fa802bd145748ee923c03674f4d4>:0

Update project: Library.Tests
[warn]: OmniSharp.MSBuild.ProjectManager
Unable to resolve assembly '/workspaces/Library.Template/bin/Library/Debug/netstandard2.0/Library.dll'
info: OmniSharp.MSBuild.ProjectManager
Queue project update for '/workspaces/Library.Template/test/Library.Tests/Library.Tests.csproj'
info: OmniSharp.MSBuild.ProjectManager
Loading project: /workspaces/Library.Template/test/Library.Tests/Library.Tests.csproj
info: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file '/workspaces/Library.Template/test/Library.Tests/Library.Tests.csproj'.
info: OmniSharp.MSBuild.ProjectManager
Update project: Library.Tests
[warn]: OmniSharp.MSBuild.ProjectManager
Unable to resolve assembly '/workspaces/Library.Template/bin/Library/Debug/netstandard2.0/Library.dll'

C# log

Installing C# dependencies... Platform: linux, x86_64, name=ubuntu, version=18.04

Downloading package 'OmniSharp for Linux (x64)' (47203 KB).................... Done!
Validating download...
Integrity Check succeeded.
Installing package 'OmniSharp for Linux (x64)'

Downloading package '.NET Core Debugger (linux / x64)' (54671 KB).................... Done!
Validating download...
Integrity Check succeeded.
Installing package '.NET Core Debugger (linux / x64)'

Downloading package 'Razor Language Server (Linux / x64)' (52580 KB).................... Done!
Installing package 'Razor Language Server (Linux / x64)'

Finished

Environment information

VSCode version: 1.49.2
C# Extension: 1.23.2

Mono Information OmniSharp using built-in mono
Dotnet Information .NET Core SDK (reflecting any global.json): Version: 3.1.402 Commit: 9b5de826fd

Runtime Environment:
OS Name: ubuntu
OS Version: 18.04
OS Platform: Linux
RID: ubuntu.18.04-x64
Base Path: /usr/share/dotnet/sdk/3.1.402/

Host (useful for support):
Version: 3.1.8
Commit: 9c1330dedd

.NET Core SDKs installed:
3.1.201 [/usr/share/dotnet/sdk]
3.1.402 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.1.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.8 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.22 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.3 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.8 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download

Visual Studio Code Extensions
Extension Author Version
azure-account ms-vscode 0.9.3
azure-pipelines ms-azure-devops 1.174.2
csharp ms-dotnettools 1.23.2
docomment k--kato 0.1.18
EditorConfig EditorConfig 0.15.1
vscode-docker ms-azuretools 1.6.0
vscode-markdownlint DavidAnson 0.36.3
vscode-versionlens pflannery 1.0.8
xml DotJoshJohnson 2.5.1
@filipw
Copy link
Contributor

filipw commented Sep 25, 2020

did you enable editorconfig support in the VS Code or Omnisharp settings? it's off by default

@AArnott
Copy link
Contributor Author

AArnott commented Sep 25, 2020

Oh! I didn't know about that. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants