I'm not sure if I simply managed to mess up my local set up but I don't think so - I can repro it on both Windows and macOS.
VS Code version: 1.17.2
C# Extension version: 1.13.0-beta4
Give the following code, in a .NET Core 1.1 project (project type is irrelevant, I can repro the same error i.e. with CSX)
namespace Sonova.Nephele.Shared.Web.AspNetCore
{
public class ErrorData
{
public string Message { get; set; }
}
}dddd
Hover over dddd. Then hover again, and again.
Diagnostic is de-duped.
We make 2 calls to /codecheck:
As soon as the second one completes, the 2 diagnostic entry shows up next to the original one.
The diagnostic is not deduped:

It also shows up twice in the Problems panel.

Note that the project is not multi-targeted for 2 frameworks. As mentioned, same behavior can be observed for i.e. CSX.
Definitely seeing this. AFAIK I am running a pretty plain dotnetcore project
Also seeing this.
Seeing this on multiple computers and project types and also in colleagues setups. All errors are reported twice. AFAIK this is happening under any scenario, I have not actually seen a setup wherein errors are only reported once. Any idea on what is happening?
This is a long standing issue. I saw it as far as half a year back, when I started using Code for my local C# projects.
@rchande : This is getting hit a lot. I think you even filed a dupe at one point. Could we raise the priority on this one? It'd be great to get it fixed for 1.14.
@TheRealPiotrP : I'm seeing a lot of these. It would be great if we could get this assigned out and fixed.
Self-assigning.
@DustinCampbell @mholo65 @david-driscoll
The C# extension makes 2 diagnostics calls: one with a filename, and one with no filename which is supposed to get all the diagnostics for a "project". (This actually means all the diagnostics in the O# Workspace's CurrentSolution). When we make a request with a filename, we get back the correct diagnostics. When we make a request with no filename, Omnisharp returns every diagnostic twice. The C# extension faithfully adds each diagnostic to the error list twice.
It looks like Omnisharp regressed this when we added cake support. Cake added another CodeCheckRequest handler that also uses the C# CodeCheckService. The cake code check handler properly reports that it support "cake" files and there is code in EndPointHandler.cs that sniffs the filepath to figure out what the extension is. However, if there's no file name, like in the "project" case, the C# and Cake code check handlers both get invoked, and both produce the same diagnostics, leading to duplicates.
I'm not sure what the best fix is there. I don't think adding a "language" field to the code check request would be the right thing--when we request diagnostics for all projects we probably want to include cake projects. Should we have the cake handler only provide diagnostics in cake files?
@rchande that's sounds good to me.
Just override Handle method here and check if the CodeCheck request contains filename or not. In case no filename is required, just return.
I can make the PR if you like.
@rchande : Good analysis!
@mholo65 Working on it--almost ready.
Most helpful comment
@DustinCampbell @mholo65 @david-driscoll
The C# extension makes 2 diagnostics calls: one with a filename, and one with no filename which is supposed to get all the diagnostics for a "project". (This actually means all the diagnostics in the O# Workspace's CurrentSolution). When we make a request with a filename, we get back the correct diagnostics. When we make a request with no filename, Omnisharp returns every diagnostic twice. The C# extension faithfully adds each diagnostic to the error list twice.
It looks like Omnisharp regressed this when we added cake support. Cake added another CodeCheckRequest handler that also uses the C# CodeCheckService. The cake code check handler properly reports that it support "cake" files and there is code in
EndPointHandler.csthat sniffs the filepath to figure out what the extension is. However, if there's no file name, like in the "project" case, the C# and Cake code check handlers both get invoked, and both produce the same diagnostics, leading to duplicates.I'm not sure what the best fix is there. I don't think adding a "language" field to the code check request would be the right thing--when we request diagnostics for all projects we probably want to include cake projects. Should we have the cake handler only provide diagnostics in cake files?