Sunday, August 11, 2019

.NET Roslyn


Roslyn, the .NET compiler platform, helps you catch bugs even before you run your code. One example is Roslyn’s spellcheck analyzer that is built into Visual Studio.

Let’s say you are creating a static method and misspelled the word static as statc. You will be able to see this spelling error before you run your code because Roslyn can produce warnings in your code as you type even before you’ve finished the line. In other words, you don’t have to build your code to find out that you made a mistake.

Roslyn analyzers can also surface an automatic code fix through the Visual Studio light bulb icon that allows you to fix your code immediately.

The icons next to each diagnostic in Solution Explorer correspond to the icons you see in the rule set when you open it in the editor:
  • “i” in a circle indicates a severity of Info
  • “!” in a triangle indicates a severity of Warning
  • “x” in a circle indicates a severity of Error
  • “i” in a circle on a light-colored background indicates a severity of Hidden
  • “↓” in a circle indicates a suppressed diagnostic

More details are available at https://github.com/dotnet/roslyn-analyzers

No comments:

Post a Comment