Comments (4)
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?
from roslynator.
I got the warning with the code you provided above.
from roslynator.
@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.
from roslynator.
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:
CSC : warning AD0001: Analyzer 'Roslynator.Formatting.CSharp.FixFormattingOfCallChainAnalyzer' threw an exception of type 'System.NullReferenceException' with message 'Object reference not set to an instance of an object.'. [/home/eduardo/rcs0054test/rcs0054test.csproj]
1 Warning(s)
0 Error(s)
So now the analyzer itself is having problems running.
This project consists only of a Roslynator.Formatting.Analyzers.analyzerconfig
file with this inside:
is_global = true
# [RCS0054] Fix formatting of a call chain.
# http://pihrt.net/roslynator/analyzer?id=RCS0054
dotnet_diagnostic.RCS0054.severity = warning
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.
from roslynator.
Related Issues (20)
- RCS1261: "Resource can be disposed asynchronously" does not take lock statement into account
- About new packages HOT 4
- Consider disabling `RCS1223` for attributes HOT 2
- RCS1159 should not be reported for WPF routed events HOT 2
- Declare as nullable code fix for CS8600 breaks when casts are involved HOT 1
- Simplify numeric comparison HOT 7
- Consider disabling `RCS0012` for fields HOT 1
- `RCS1019` does not work for `file static` HOT 1
- Collection expressions are not considered "obvious" typing
- `RCS1250` fixer cannot handle collection expressions
- `RCS1250` Applies collection-expression fixer when properties are set.
- RCS1060 doesn't work with file-scoped namespaces HOT 2
- CS8032: An instance of analyzer Roslynator.CSharp.Analysis.UnnecessaryRawStringLiteralAnalyzer cannot be created HOT 2
- RCS1267 - propose wrong fix
- Some analyzers don't work in Rider with severity being set to "suggestion" HOT 1
- RCS1169 not being diffused by roslynator_unity_code_analysis.enabled = true HOT 4
- RCS1077 Crashes with NullReference Exception HOT 2
- Typo in new option key
- Missing documentation HOT 7
- Add performance refactoring for IList Last, First or ElementAt HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from roslynator.