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

SA1649 and SA1201 failure for records #3396

Closed
RKopczynski opened this issue Oct 23, 2021 · 1 comment
Closed

SA1649 and SA1201 failure for records #3396

RKopczynski opened this issue Oct 23, 2021 · 1 comment

Comments

@RKopczynski
Copy link

Hi, I have found issue. Seems like StyleCop fails for record types.

Minimal working example of code

I created simple repository which generates some issues with StyleCop. Don't mind my awful code, I didn't refactor it yet :)

https://github.com/RKopczynski/StyleCopAnalyzers-issue

Test env and logs

Below are logs from build command and dotnet info on my machine.

dotnet build log output:

Microsoft (R) Build Engine version 16.11.0+0538acc04 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  All projects are up-to-date for restore.
C:\Users\rafal\source\repos\TestAnalyzers\IPacketParser.cs(1,1): warning SA1633: The file header is missing or not located at the top of the file. [C:\Users\rafal\source\repos\TestAnalyzers\TestAnalyzers.csproj]
C:\Users\rafal\source\repos\TestAnalyzers\IPacketParser.cs(40,64): warning SA1009: Closing parenthesis should not be followed by a space. [C:\Users\rafal\source\repos\TestAnalyzers\TestAnalyzers.csproj]
C:\Users\rafal\source\repos\TestAnalyzers\IPacketParser.cs(42,59): warning SA1009: Closing parenthesis should not be followed by a space. [C:\Users\rafal\source\repos\TestAnalyzers\TestAnalyzers.csproj]
CSC : warning SA0001: XML comment analysis is disabled due to project configuration [C:\Users\rafal\source\repos\TestAnalyzers\TestAnalyzers.csproj]
CSC : warning AD0001: Analyzer 'StyleCop.Analyzers.DocumentationRules.SA1649FileNameMustMatchTypeName' threw an exception of type 'System.ArgumentException' with message 'Unhandled declaration kind: RecordDeclaration'. [C:\Users\rafal\source\repos\TestAnalyzers\TestAnalyzers.csproj]
CSC : warning AD0001: Analyzer 'StyleCop.Analyzers.OrderingRules.SA1201ElementsMustAppearInTheCorrectOrder' threw an exception of type 'System.Collections.Generic.KeyNotFoundException' with message 'The given key 'RecordDeclaration' was not present in the dictionary.'. [C:\Users\rafal\source\repos\TestAnalyzers\TestAnalyzers.csproj]
  TestAnalyzers -> C:\Users\rafal\source\repos\TestAnalyzers\bin\Debug\net5.0\TestAnalyzers.dll

Build succeeded.

C:\Users\rafal\source\repos\TestAnalyzers\IPacketParser.cs(1,1): warning SA1633: The file header is missing or not located at the top of the file. [C:\Users\rafal\source\repos\TestAnalyzers\TestAnalyzers.csproj]
C:\Users\rafal\source\repos\TestAnalyzers\IPacketParser.cs(40,64): warning SA1009: Closing parenthesis should not be followed by a space. [C:\Users\rafal\source\repos\TestAnalyzers\TestAnalyzers.csproj]
C:\Users\rafal\source\repos\TestAnalyzers\IPacketParser.cs(42,59): warning SA1009: Closing parenthesis should not be followed by a space. [C:\Users\rafal\source\repos\TestAnalyzers\TestAnalyzers.csproj]
CSC : warning SA0001: XML comment analysis is disabled due to project configuration [C:\Users\rafal\source\repos\TestAnalyzers\TestAnalyzers.csproj]
CSC : warning AD0001: Analyzer 'StyleCop.Analyzers.DocumentationRules.SA1649FileNameMustMatchTypeName' threw an exception of type 'System.ArgumentException' with message 'Unhandled declaration kind: RecordDeclaration'. [C:\Users\rafal\source\repos\TestAnalyzers\TestAnalyzers.csproj]
CSC : warning AD0001: Analyzer 'StyleCop.Analyzers.OrderingRules.SA1201ElementsMustAppearInTheCorrectOrder' threw an exception of type 'System.Collections.Generic.KeyNotFoundException' with message 'The given key 'RecordDeclaration' was not present in the dictionary.'. [C:\Users\rafal\source\repos\TestAnalyzers\TestAnalyzers.csproj]
    6 Warning(s)
    0 Error(s)

Time Elapsed 00:00:00.71

dotnet --info log output:

.NET SDK (reflecting any global.json):
 Version:   5.0.401
 Commit:    4bef5f3dbf

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19042
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\5.0.401\

Host (useful for support):
  Version: 5.0.10
  Commit:  e1825b4928

.NET SDKs installed:
  5.0.401 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 3.1.19 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.19 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.19 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download
@sharwell
Copy link
Member

Duplicate of #3213

@sharwell sharwell marked this as a duplicate of #3213 Oct 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants