Omnisharp-vscode: Spurious dupes/ambiguity errors when multitargeting due to `obj/**.cs` being included without a framework filter

Created on 27 Aug 2019  路  2Comments  路  Source: OmniSharp/omnisharp-vscode

Environment data

dotnet --info output:
```$ dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 2.2.301
Commit: 70d6be0814

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

Host (useful for support):
Version: 2.2.6
Commit: 7dac9b1b51

.NET Core SDKs installed:
1.0.0-rc4-004771 [/usr/share/dotnet/sdk]
1.0.4 [/usr/share/dotnet/sdk]
2.0.2 [/usr/share/dotnet/sdk]
2.1.4 [/usr/share/dotnet/sdk]
2.1.701 [/usr/share/dotnet/sdk]
2.2.301 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.12 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.6 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.12 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.6 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 1.0.3 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 1.0.5 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 1.1.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 1.1.2 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.5 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.12 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.6 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

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

VS Code version:

Version: 1.37.1
Commit: f06011ac164ae4dc8e753a3fe7f9549844d15e35
Date: 2019-08-15T16:17:25.463Z
Electron: 4.2.7
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Linux x64 4.15.0-43-generic
```

C# Extension version:
1.21.1

Steps to reproduce

  1. Create classlib with dotnet new classlib
  2. Edit .csproj and replace <TargetFramework>netstandard2.0</TargetFramework> with <TargetFrameworks>netstandard2.0;netcoreapp2.2</TargetFrameworks>
  3. Add generated build command to .vscode/tasks.json
  4. Edit .vscode/tasks.json to add a clean command following the build command's pattern
  5. Run the build tasks: build, clean, build
  6. Click around in the different output windows or simply wait, eventually problems will be reported

I have provided a repro repository that gets you directly to step 5 here: https://github.com/anttirt/omnisharp-vscode-fw-dup-bug

Expected behavior

No problems are reported

Actual behavior

The problems window reports seven problems due to duplicate assembly info

It appears that Omnisharp does not truly understand the TargetFrameworks (plural) element, and includes generated source files from all obj/{Configuration}/{TargetFramework} directories, causing the erroneous duplicate definition problems.

This problem is not limited to AssemblyInfo.cs but also affects any other files generated under obj/{Configuration}/{TargetFramework} during the build.

You can see a screen capture of the issue here: https://raw.githubusercontent.com/anttirt/omnisharp-vscode-fw-dup-bug/master/Kazam_screencast_00003.webm

Resolved-Fixed Triaged

Most helpful comment

It's not just a misunderstanding of target frameworks.
Satellite assemblies with localized resources are also not interpreted correctly.

i.e. obj/{Configuration}/{TargetFramework}/{Culture}

This is profoundly annoying, as there is no way to get Omnisharp to ignore these non-problems and it continually lights up every project that has localized resource files like a damn christmas tree.

All 2 comments

It's not just a misunderstanding of target frameworks.
Satellite assemblies with localized resources are also not interpreted correctly.

i.e. obj/{Configuration}/{TargetFramework}/{Culture}

This is profoundly annoying, as there is no way to get Omnisharp to ignore these non-problems and it continually lights up every project that has localized resource files like a damn christmas tree.

Hey @anttirt - this doesn't reproduce with the latest .NET Core SDK and VSCode and C# plugin, including with your repro project. We'll close this out, but let us know if you still see it with updated tools. Thanks!

Was this page helpful?
0 / 5 - 0 ratings