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
RCS0054 Accepting only strange formatting in this situation #1203
Comments
Hi, Yes, the first code snippet should not produce any diagnostic as it's correctly formatted. I tried to reproduce the behavior with following snippet but I'm not getting any diagnostic: top-level statement (essentially entire file) using System.Collections.Generic;
using System.Linq;
var items = new List<string>();
items
.Select(f => f)
.Select(f => f
.Select(f => f)
.Select(f => f))
.Select(f => f); Can I ask you to create working code sample that I could copy-paste to reproduce the behavior? Just to rule that out: Can you check that indentation does not contain spaces mixed with tabs? |
I got the warning with the code you provided above. |
@eduardomezencio I believe you but I need to reproduce the bug. The best would be to create a project which contains only single file containing code that causes the diagnostic and possibly include editorconfig file which may affect the behavior of the analyzer. Then zip the project and post it here (or create temporary repo if you wish). Thanks. |
Ok, thanks for looking into it. I'm trying to reproduce this here, too but I'm having problems. I tried to create an empty project enabling only this analyzer and copy your code example into it. Now when I build I get this in the build output:
So now the analyzer itself is having problems running. This project consists only of a
And this in the .csproj <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<GlobalAnalyzerConfigFiles Include="Roslynator.Formatting.Analyzers.analyzerconfig" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Roslynator.Analyzers" Version="4.5.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Roslynator.CodeAnalysis.Analyzers" Version="4.5.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Roslynator.Formatting.Analyzers" Version="4.5.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
</Project> And the Program.cs, that contains your code from above. I'll try to look deeper into it later. |
Product and Version Used: dotnet 7, Roslynator.Analyzers 4.5.0
Steps to Reproduce:
The following code, in top level statements:
Gives RCS0054 here:
Actual Behavior:
The action suggested by the Code Action keeps the code the same. I've tried multiple formattings, but the only one accepted by this rule is completely unacceptable, which is the following:
(This makes it feel in a way related to this other issue, already solved: #859)
Expected Behavior:
I expect the first code I mentioned here to be accepted as correctly formatted.
The text was updated successfully, but these errors were encountered: