Giter Site home page Giter Site logo

Comments (4)

josefpihrt avatar josefpihrt commented on June 19, 2024

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.

eduardomezencio avatar eduardomezencio commented on June 19, 2024

I got the warning with the code you provided above.

from roslynator.

josefpihrt avatar josefpihrt commented on June 19, 2024

@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.

eduardomezencio avatar eduardomezencio commented on June 19, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.