Questions tagged [roslynator]

9 questions
6
votes
1 answer

what is correct format for multiple discard variables in c# method

I have a method that is called by an external api that is expecting the method to have these specific parameters public static bool DoSomething( int x, int y ) => true; Rosyln code analysis is…
James Bradt
  • 564
  • 5
  • 11
4
votes
1 answer

How to get C# (analyzer) suggestions visible on the commandline?

What I like about the dotnet CLI is that you can run $ dotnet build --no-incremental, and you always get a list of all the warnings in your project. I use that for making sweeping changes, and such, on projects. Output of that can be piped to unix…
Ties
  • 1,205
  • 2
  • 15
  • 28
4
votes
1 answer

Built-in code analysers vs NuGet packages

Having just switched to VS2019 I’m exploring whether to use code analysis. In the project properties, “code analysis” tab, there are numerous built-in Microsoft rule sets, and I can see the editor squiggles when my code violates one of these rules.…
2
votes
1 answer

change templates for new members

when I do refactoring in visual studio (2019) and I say "generate field", it per default always adds the "private" keyword before the new field. I don't want this. How can I modify this behavior? I am not event sure if this functionality is provided…
codymanix
  • 28,510
  • 21
  • 92
  • 151
2
votes
0 answers

Does Resharper has a quick code preview like in Roslynator?

I mean something like this. I don't know what it called. Today, I tried a trial version of Resharper and I found Resharper need to click Preview Code to show code changes. I wonder if Resharper has a feature like this.
0
votes
0 answers

.NET 6 SDK on Docker container not loading full namespaces of external packages of projects that target smaller SDKs in Workspace API of Roslyn

I am using .NET 6.0 SDK to register an instance via MSBuildLocator in Roslyn. According to MSBuildLocator.IsRegistered the instance is registered and returns true. Locally everything works perfect and when I load external projects (that target .NET…
0
votes
0 answers

search analyzer and formatter for Visual studio code

I would like to find a linter to analyze the formatting of my code, and also use the linter locally to format my code. And I would want to be able to do that with Visual studio code (and ideally, also Visual studio). Right now, I am using Visual…
Zul Huky
  • 331
  • 4
  • 24
0
votes
1 answer

Roslynator - how to disable C# 8.0 hints for .Net 4.7.2

I'm getting hints like "IDE0063 'using' statement can be simplified" This is not a valid hint for a .Net 4.7.2 project. Why am I getting these? ===== Edit ======
0
votes
1 answer

C# How can i detect EvenHandler subscription in Roslyn

I'm writing a custom analyzer rule using Roslyn. I want to find a method which is a handler for some event (via subscription). Like this: public class Counter { public event EventHandler ThresholdReached; } public class TestEvent { public…