roslyn: Unexpected message level diagnostics in error list

Version Used: Version 16.8.0 Preview 1.0 [30313.6.master]

Steps to Reproduce:

  1. Open a solution
  2. Enable the “Messages” tab on the error list

Expected Behavior: A relatively clean error list, even with Messages enabled (at least, for people that care about code style).

Actual Behavior: A bunch of message level diagnostics in the Error List for things that I wouldn’t expect to see there. For example:

Severity	Code	Description	Project	File	Line	Suppression State
Message	IDE0058	Expression value is never used		C:\Code\YouHaveIssues\YouHaveIssues\Data\AreaStatsByWeek.cs	60	
Message	IDE0046	'if' statement can be simplified		C:\Code\YouHaveIssues\YouHaveIssues\AzureAuthenticationService.cs	57	
Message	IDE0058	Expression value is never used		C:\Code\YouHaveIssues\YouHaveIssues\AzureAuthenticationService.cs	85	
Message	IDE0058	Expression value is never used		C:\Code\YouHaveIssues\YouHaveIssues\Data\AreaStatsByWeek.cs	61	
Message	IDE0058	Expression value is never used		C:\Code\YouHaveIssues\YouHaveIssues\Data\AreaStatsByWeek.cs	96	
Message	IDE0058	Expression value is never used		C:\Code\YouHaveIssues\YouHaveIssues\Data\AreaStatsByWeek.cs	97	
Message	IDE0058	Expression value is never used		C:\Code\YouHaveIssues\YouHaveIssues\KustoContext.cs	67	
Message	IDE0005_gen	Using directive is unnecessary.		C:\Code\YouHaveIssues\YouHaveIssues\obj\Debug\netcoreapp3.1\.NETCoreApp,Version=v3.1.AssemblyAttributes.cs	2	
Message	RemoveUnnecessaryImportsFixable			C:\Code\YouHaveIssues\YouHaveIssues\obj\Debug\netcoreapp3.1\.NETCoreApp,Version=v3.1.AssemblyAttributes.cs	2	
Message	IDE0005_gen	Using directive is unnecessary.		C:\Code\YouHaveIssues\YouHaveIssues\obj\Debug\netcoreapp3.1\YouHaveIssues.AssemblyInfo.cs	11	
Message	RemoveUnnecessaryImportsFixable			C:\Code\YouHaveIssues\YouHaveIssues\obj\Debug\netcoreapp3.1\YouHaveIssues.AssemblyInfo.cs	11	
Message	IDE0005_gen	Using directive is unnecessary.		C:\Code\YouHaveIssues\YouHaveIssues\obj\Debug\netcoreapp3.1\YouHaveIssues.RazorAssemblyInfo.cs	11	
Message	RemoveUnnecessaryImportsFixable			C:\Code\YouHaveIssues\YouHaveIssues\obj\Debug\netcoreapp3.1\YouHaveIssues.RazorAssemblyInfo.cs	11	
Message	IDE0058	Expression value is never used		C:\Code\YouHaveIssues\YouHaveIssues\Program.cs	33	
Message	IDE0058	Expression value is never used		C:\Code\YouHaveIssues\YouHaveIssues\RepositoryConfig.cs	11	
Message	IDE0058	Expression value is never used		C:\Code\YouHaveIssues\YouHaveIssues\Startup.cs	28	
Message	IDE0058	Expression value is never used		C:\Code\YouHaveIssues\YouHaveIssues\Startup.cs	31	
Message	IDE0058	Expression value is never used		C:\Code\YouHaveIssues\YouHaveIssues\Startup.cs	39	
Message	IDE0058	Expression value is never used		C:\Code\YouHaveIssues\YouHaveIssues\Startup.cs	40	
Message	IDE0058	Expression value is never used		C:\Code\YouHaveIssues\YouHaveIssues\Startup.cs	42	
Message	IDE0058	Expression value is never used		C:\Code\YouHaveIssues\YouHaveIssues\Startup.cs	43	
Message	IDE0058	Expression value is never used		C:\Code\YouHaveIssues\YouHaveIssues\Startup.cs	46	
Message	IDE0058	Expression value is never used		C:\Code\YouHaveIssues\YouHaveIssues\Startup.cs	57	
Message	IDE0058	Expression value is never used		C:\Code\YouHaveIssues\YouHaveIssues\Startup.cs	59	
Message	IDE0058	Expression value is never used		C:\Code\YouHaveIssues\YouHaveIssues\Startup.cs	60	
Message	IDE0058	Expression value is never used		C:\Code\YouHaveIssues\YouHaveIssues\Startup.cs	61	
Message	IDE0058	Expression value is never used		C:\Code\YouHaveIssues\YouHaveIssues\Startup.cs	69	
Message	IDE0058	Expression value is never used		C:\Code\YouHaveIssues\YouHaveIssues\Startup.cs	73	
Message	IDE0058	Expression value is never used		C:\Code\YouHaveIssues\YouHaveIssues\Startup.cs	75	
Message	IDE0058	Expression value is never used		C:\Code\YouHaveIssues\YouHaveIssues\Startup.cs	78	
Message	IDE0058	Expression value is never used		C:\Code\YouHaveIssues\YouHaveIssues\Startup.cs	79	
Message	IDE0058	Expression value is never used		C:\Code\YouHaveIssues\YouHaveIssues\Startup.cs	81	
Message	IDE0058	Expression value is never used		C:\Code\YouHaveIssues\YouHaveIssues\Startup.cs	83	
Message	IDE0058	Expression value is never used		C:\Code\YouHaveIssues\YouHaveIssues\Startup.cs	84	
Message	IDE0058	Expression value is never used		C:\Code\YouHaveIssues\YouHaveIssues\Startup.cs	86	
Message	IDE0058	Expression value is never used		C:\Code\YouHaveIssues\YouHaveIssues\Startup.cs	88	
Message	IDE0058	Expression value is never used		C:\Code\YouHaveIssues\YouHaveIssues\Startup.cs	89	
Message	IDE0058	Expression value is never used		C:\Code\YouHaveIssues\YouHaveIssues\Startup.cs	90	

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (14 by maintainers)

Most upvoted comments

Thanks @ryanbrandenburg @Pilchie - I confirmed this only happens when Razor LSP Preview experience enabled in Tools\Options\Environment\Preview Features.

I investigated it and this seems to be an issue specific to LSP - tagging @dibarbet @allisonchou, more specifically the fact that LSP does not have concept of hidden diagnostics and treats them equivalent to info/message diagnostics: https://github.com/dotnet/roslyn/blob/f14fd53433507d9d5664cb1d0836ec8fcb5606b9/src/Features/LanguageServer/Protocol/Extensions/ProtocolConversions.cs#L197-L200