Creating Roslyn API-based static analyzer for C#

%3CLINGO-SUB%20id%3D%22lingo-sub-2923455%22%20slang%3D%22en-US%22%3ECreating%20Roslyn%20API-based%20static%20analyzer%20for%20C%23%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2923455%22%20slang%3D%22en-US%22%3E%3CP%3EAfter%20you%20read%20this%20article%2C%20you'll%20have%20the%20knowledge%20to%20create%20your%20own%20static%20analyzer%20for%20C%23.%20With%20the%20help%20of%20the%20analyzer%2C%20you%20can%20find%20potential%20errors%20and%20vulnerabilities%20in%20the%20source%20code%20of%20your%20own%20and%20other%20projects.%20Are%20you%20intrigued%3F%20%3CA%20title%3D%22Creating%20Roslyn%20API-based%20static%20analyzer%20for%20C%23%22%20href%3D%22https%3A%2F%2Fpvs-studio.com%2Fen%2Fblog%2Fposts%2Fcsharp%2F0867%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3EWell%2C%20let's%20get%20started%3C%2FA%3E.%3C%2FP%3E%3CDIV%20class%3D%22%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image1.png%22%20style%3D%22width%3A%20580px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F324028i2ED86BC2C4BD949E%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22image1.png%22%20alt%3D%22image1.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FDIV%3E%3CP%3EFirst%2C%20we%20will%20make%20your%20own%20static%20analyzer%20from%20the%20Visual%20Studio%20templates%2C%20without%20going%20deeper%20into%20the%20Roslyn%20API.%20This%20allows%20you%20to%20quickly%20get%20a%20working%20application%20and%20at%20least%20roughly%20see%20what%20analyzers%20can%20do.%3C%2FP%3E%3CP%3EAnd%20after%20that%2C%20we'll%20take%20a%20closer%20look%20at%20Roslyn%20API%2C%20as%20well%20as%20various%20tools%20that%20allow%20you%20to%20perform%20deeper%20and%20more%20complex%20analysis.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2923455%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EConsole%20Apps%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Frequent Visitor

After you read this article, you'll have the knowledge to create your own static analyzer for C#. With the help of the analyzer, you can find potential errors and vulnerabilities in the source code of your own and other projects. Are you intrigued? Well, let's get started.

image1.png

First, we will make your own static analyzer from the Visual Studio templates, without going deeper into the Roslyn API. This allows you to quickly get a working application and at least roughly see what analyzers can do.

And after that, we'll take a closer look at Roslyn API, as well as various tools that allow you to perform deeper and more complex analysis.

0 Replies