dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.84k stars 661 forks source link

Duplicate attribute and autogenerated program warnings #3230

Open HughGrovesArup opened 4 years ago

HughGrovesArup commented 4 years ago

Issue Description

I have a solution with two class libraries and one test (MSTest) library. After publishing I have files in the obj folder that trigger a series of warnings. I have tried to exclude obj and bin with my omnisharp.json file but this does not help.

image

Omnisharp.json contents

{
    "fileOptions": {
        "userExcludeSearchPatterns": [
            "**/obj/**/*",
            "**/bin/**/*"
        ]
    }
}

Steps to Reproduce

Create a solution with a class library and msbuild test project and publish.

Expected Behavior

Should not show any warnings (dotnet build, publish, test all work).

Actual Behavior

Logs

OmniSharp log

Starting OmniSharp server at 15/08/2019, 10:19:53 Target: c:\Users\Hugh.Groves\Documents\designcheck2\DesignCheck2\DesignCheck2.sln OmniSharp server started. Path: C:\Users\Hugh.Groves\.vscode\extensions\ms-vscode.csharp-1.21.0\.omnisharp\1.34.0\OmniSharp.exe PID: 19912 [info]: OmniSharp.Stdio.Host Starting OmniSharp on Windows 6.2.9200.0 (x64) [info]: OmniSharp.Services.DotNetCliService DotNetPath set to dotnet [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator Located 2 MSBuild instance(s) 1: Visual Studio Build Tools 2017 15.9.28307.770 - "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin" 2: StandAlone 16.0 - "C:\Users\Hugh.Groves\.vscode\extensions\ms-vscode.csharp-1.21.0\.omnisharp\1.34.0\.msbuild\Current\Bin" [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator MSBUILD_EXE_PATH environment variable set to 'C:\Users\Hugh.Groves\.vscode\extensions\ms-vscode.csharp-1.21.0\.omnisharp\1.34.0\.msbuild\Current\Bin\MSBuild.exe' [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator Registered MSBuild instance: StandAlone 16.0 - "C:\Users\Hugh.Groves\.vscode\extensions\ms-vscode.csharp-1.21.0\.omnisharp\1.34.0\.msbuild\Current\Bin" CscToolExe = csc.exe CscToolPath = C:\Users\Hugh.Groves\.vscode\extensions\ms-vscode.csharp-1.21.0\.omnisharp\1.34.0\.msbuild\Current\Bin\Roslyn MSBuildExtensionsPath = C:\Users\Hugh.Groves\.vscode\extensions\ms-vscode.csharp-1.21.0\.omnisharp\1.34.0\.msbuild MSBuildToolsPath = C:\Users\Hugh.Groves\.vscode\extensions\ms-vscode.csharp-1.21.0\.omnisharp\1.34.0\.msbuild\Current\Bin [info]: OmniSharp.Cake.CakeProjectSystem Detecting Cake files in 'c:\Users\Hugh.Groves\Documents\designcheck2\DesignCheck2'. [info]: OmniSharp.Cake.CakeProjectSystem Could not find any Cake files [info]: OmniSharp.MSBuild.ProjectSystem Detecting projects in 'c:\Users\Hugh.Groves\Documents\designcheck2\DesignCheck2\DesignCheck2.sln'. [info]: OmniSharp.MSBuild.ProjectManager Queue project update for 'c:\Users\Hugh.Groves\Documents\designcheck2\DesignCheck2\DesignCheck2\DesignCheck2.csproj' [info]: OmniSharp.MSBuild.ProjectManager Queue project update for 'c:\Users\Hugh.Groves\Documents\designcheck2\DesignCheck2\DesignCheck2.Tests\DesignCheck2.Tests.csproj' [info]: OmniSharp.MSBuild.ProjectManager Queue project update for 'c:\Users\Hugh.Groves\Documents\designcheck2\DesignCheck2\DesignCheck2.Definitions\DesignCheck2.Definitions.csproj' [info]: OmniSharp.Script.ScriptProjectSystem Detecting CSX files in 'c:\Users\Hugh.Groves\Documents\designcheck2\DesignCheck2'. [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.MSBuild.ProjectManager Loading project: c:\Users\Hugh.Groves\Documents\designcheck2\DesignCheck2\DesignCheck2\DesignCheck2.csproj [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.EditorConfigWorkspaceOptionsProvider, Order: 200 [info]: OmniSharp.WorkspaceInitializer Configuration finished. [info]: OmniSharp.Stdio.Host Omnisharp server running using Stdio at location 'c:\Users\Hugh.Groves\Documents\designcheck2\DesignCheck2' on host 10508. [info]: OmniSharp.MSBuild.ProjectManager Successfully loaded project file 'c:\Users\Hugh.Groves\Documents\designcheck2\DesignCheck2\DesignCheck2\DesignCheck2.csproj'. [info]: OmniSharp.MSBuild.ProjectManager Adding project 'c:\Users\Hugh.Groves\Documents\designcheck2\DesignCheck2\DesignCheck2\DesignCheck2.csproj' [info]: OmniSharp.MSBuild.ProjectManager Loading project: c:\Users\Hugh.Groves\Documents\designcheck2\DesignCheck2\DesignCheck2.Tests\DesignCheck2.Tests.csproj [info]: OmniSharp.MSBuild.ProjectManager Successfully loaded project file 'c:\Users\Hugh.Groves\Documents\designcheck2\DesignCheck2\DesignCheck2.Tests\DesignCheck2.Tests.csproj'. [info]: OmniSharp.MSBuild.ProjectManager Adding project 'c:\Users\Hugh.Groves\Documents\designcheck2\DesignCheck2\DesignCheck2.Tests\DesignCheck2.Tests.csproj' [info]: OmniSharp.MSBuild.ProjectManager Loading project: c:\Users\Hugh.Groves\Documents\designcheck2\DesignCheck2\DesignCheck2.Definitions\DesignCheck2.Definitions.csproj [info]: OmniSharp.MSBuild.ProjectManager Successfully loaded project file 'c:\Users\Hugh.Groves\Documents\designcheck2\DesignCheck2\DesignCheck2.Definitions\DesignCheck2.Definitions.csproj'. [info]: OmniSharp.MSBuild.ProjectManager Adding project 'c:\Users\Hugh.Groves\Documents\designcheck2\DesignCheck2\DesignCheck2.Definitions\DesignCheck2.Definitions.csproj' [info]: OmniSharp.MSBuild.ProjectManager Update project: DesignCheck2 [info]: OmniSharp.MSBuild.ProjectManager Update project: DesignCheck2.Tests [info]: OmniSharp.MSBuild.ProjectManager Update project: DesignCheck2.Definitions

C# log

Environment information

VSCode version: 1.37.0 C# Extension: 1.21.0

Dotnet Information .NET Core SDK (reflecting any global.json): Version: 2.2.102 Commit: 96ff75a873 Runtime Environment: OS Name: Windows OS Version: 10.0.17134 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\2.2.102\ Host (useful for support): Version: 2.2.1 Commit: 878dd11e62 .NET Core SDKs installed: 1.1.11 [C:\Program Files\dotnet\sdk] 2.2.102 [C:\Program Files\dotnet\sdk] .NET Core runtimes installed: Microsoft.AspNetCore.All 2.2.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.2.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 1.0.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 1.1.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.1 [C:\Program Files\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| |---|---|---| |csharp|ms-vscode|1.21.0| |designcheck2|designcheck|0.0.1| |git-graph|mhutchie|1.12.1| |gitlens|eamodio|9.9.3| |prettify-json|mohsen1|0.0.3| |python|ms-python|2019.8.29288| |rainbow-csv|mechatroner|1.2.0|;

d

turowicz commented 4 years ago

Same here. I get plenty of problems reported in autogenerated files in obj folder.

turowicz commented 4 years ago

cc @rchande @DustinCampbell

turowicz commented 4 years ago
{
    "fileOptions": {
        "systemExcludeSearchPatterns": [
            "**/node_modules/**/*",
            "**/obj/**/*",
            "**/bin/**/*"
        ],
        "userExcludeSearchPatterns": [
            "**/node_modules/**/*",
            "**/obj/**/*",
            "**/bin/**/*"]
    }
}

both in user home folder or the workspace - no effect

filipw commented 4 years ago

The exclude patterns won't help because they only apply to solution/project discovery not to individual .cs files.

turowicz commented 4 years ago

@filipw any ideas how to stop getting code issues in autogenerated files that are clearly marked?

turowicz commented 4 years ago

This issue doesn't exist in ms-vscode.csharp@1.20.0 therefore it must be a regression.

tbolon commented 4 years ago

Certainly related: #3249 and #3082.