Code Analysis

share link

by ganesh dot icon Updated: Jan 4, 2023

technology logo
technology logo

Guide Kit Guide Kit  

The automatic review of source code to find potential problems or flaws is known as code analysis. Code analysis is the process of automatically reviewing source code to identify potential issues or defects. It can be applied to make your code more accurate, dependable, and compliant with industry standards and best practices. In C#, code analysis can be done in various ways. One choice is to utilize a static code analysis tool that examines your code without running it. These tools can spot problems, including syntax and semantic mistakes and potential vulnerabilities. 


Utilizing runtime analysis, which involves running your code and observing its behavior to spot problems, is an additional choice. Techniques like debugging, testing, and exception handling can be used for this. The software development process can benefit from code analysis since it can help you find and fix problems early on, saving you time and effort in the long run. Additionally, it is a practical technique to ensure that your code follows best practices and coding standards, making it simpler to maintain and develop over time. 


For C#, several code analysis libraries are available. The most well-known ones include Roslyn, Microsoft's open-source code analysis framework; SonarQube, an open-source platform for continuous code inspection; Caliburn.micro, Code-cracker, and so on. It contains a collection of APIs that enable you to create code analysis tools for C# and Visual Basic. These are only a few illustrations of the C# code analysis libraries that are readily available. There are a lot more options available. 


Check out the below list to find the best C# Code Analysis libraries for your application: 

roslynby dotnet

C# doticonstar image 17489 doticonVersion:v4.2.0-4.22266.5doticon
License: Permissive (MIT)

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.

Support
    Quality
      Security
        License
          Reuse

            roslynby dotnet

            C# doticon star image 17489 doticonVersion:v4.2.0-4.22266.5doticon License: Permissive (MIT)

            The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
            Support
              Quality
                Security
                  License
                    Reuse

                      Caliburn.Microby Caliburn-Micro

                      C# doticonstar image 2657 doticonVersion:4.0.222+a53dd1fa1bdoticon
                      License: Permissive (MIT)

                      A small, yet powerful framework, designed for building applications across all XAML platforms. Its strong support for MV* patterns will enable you to build your solution quickly, without the need to sacrifice code quality or testability.

                      Support
                        Quality
                          Security
                            License
                              Reuse

                                Caliburn.Microby Caliburn-Micro

                                C# doticon star image 2657 doticonVersion:4.0.222+a53dd1fa1bdoticon License: Permissive (MIT)

                                A small, yet powerful framework, designed for building applications across all XAML platforms. Its strong support for MV* patterns will enable you to build your solution quickly, without the need to sacrifice code quality or testability.
                                Support
                                  Quality
                                    Security
                                      License
                                        Reuse

                                          code-crackerby code-cracker

                                          C# doticonstar image 1104 doticonVersion:v1.1.0doticon
                                          License: Permissive (Apache-2.0)

                                          An analyzer library for C# and VB that uses Roslyn to produce refactorings, code analysis, and other niceties.

                                          Support
                                            Quality
                                              Security
                                                License
                                                  Reuse

                                                    code-crackerby code-cracker

                                                    C# doticon star image 1104 doticonVersion:v1.1.0doticon License: Permissive (Apache-2.0)

                                                    An analyzer library for C# and VB that uses Roslyn to produce refactorings, code analysis, and other niceties.
                                                    Support
                                                      Quality
                                                        Security
                                                          License
                                                            Reuse

                                                              security-code-scanby security-code-scan

                                                              C# doticonstar image 849 doticonVersion:5.6.7doticon
                                                              License: Weak Copyleft (LGPL-3.0)

                                                              Vulnerability Patterns Detector for C# and VB.NET

                                                              Support
                                                                Quality
                                                                  Security
                                                                    License
                                                                      Reuse

                                                                        security-code-scanby security-code-scan

                                                                        C# doticon star image 849 doticonVersion:5.6.7doticon License: Weak Copyleft (LGPL-3.0)

                                                                        Vulnerability Patterns Detector for C# and VB.NET
                                                                        Support
                                                                          Quality
                                                                            Security
                                                                              License
                                                                                Reuse

                                                                                  sonar-dotnetby SonarSource

                                                                                  C# doticonstar image 643 doticonVersion:9.3.0.71466doticon
                                                                                  License: Weak Copyleft (LGPL-3.0)

                                                                                  Code analyzer for C# and VB.NET projects https://redirect.sonarsource.com/plugins/vbnet.html

                                                                                  Support
                                                                                    Quality
                                                                                      Security
                                                                                        License
                                                                                          Reuse

                                                                                            sonar-dotnetby SonarSource

                                                                                            C# doticon star image 643 doticonVersion:9.3.0.71466doticon License: Weak Copyleft (LGPL-3.0)

                                                                                            Code analyzer for C# and VB.NET projects https://redirect.sonarsource.com/plugins/vbnet.html
                                                                                            Support
                                                                                              Quality
                                                                                                Security
                                                                                                  License
                                                                                                    Reuse

                                                                                                      puma-scanby pumasecurity

                                                                                                      C# doticonstar image 422 doticonVersion:2.4.11doticon
                                                                                                      License: Weak Copyleft (MPL-2.0)

                                                                                                      Puma Scan is a software security Visual Studio extension that provides real time, continuous source code analysis as development teams write code. Vulnerabilities are immediately displayed in the development environment as spell check and compiler warnings, preventing security bugs from entering your applications.

                                                                                                      Support
                                                                                                        Quality
                                                                                                          Security
                                                                                                            License
                                                                                                              Reuse

                                                                                                                puma-scanby pumasecurity

                                                                                                                C# doticon star image 422 doticonVersion:2.4.11doticon License: Weak Copyleft (MPL-2.0)

                                                                                                                Puma Scan is a software security Visual Studio extension that provides real time, continuous source code analysis as development teams write code. Vulnerabilities are immediately displayed in the development environment as spell check and compiler warnings, preventing security bugs from entering your applications.
                                                                                                                Support
                                                                                                                  Quality
                                                                                                                    Security
                                                                                                                      License
                                                                                                                        Reuse

                                                                                                                          Sharpenby sharpenrocks

                                                                                                                          C# doticonstar image 362 doticonVersion:v0.10.1doticon
                                                                                                                          License: Permissive (MIT)

                                                                                                                          Visual Studio extension that intelligently introduces new C# features into your existing codebase

                                                                                                                          Support
                                                                                                                            Quality
                                                                                                                              Security
                                                                                                                                License
                                                                                                                                  Reuse

                                                                                                                                    Sharpenby sharpenrocks

                                                                                                                                    C# doticon star image 362 doticonVersion:v0.10.1doticon License: Permissive (MIT)

                                                                                                                                    Visual Studio extension that intelligently introduces new C# features into your existing codebase
                                                                                                                                    Support
                                                                                                                                      Quality
                                                                                                                                        Security
                                                                                                                                          License
                                                                                                                                            Reuse

                                                                                                                                              roslyn-security-guardby dotnet-security-guard

                                                                                                                                              C# doticonstar image 214 doticonVersion:Currentdoticon
                                                                                                                                              License: Weak Copyleft (LGPL-3.0)

                                                                                                                                              Roslyn analyzers that aim to help security audit on .NET applications.

                                                                                                                                              Support
                                                                                                                                                Quality
                                                                                                                                                  Security
                                                                                                                                                    License
                                                                                                                                                      Reuse

                                                                                                                                                        roslyn-security-guardby dotnet-security-guard

                                                                                                                                                        C# doticon star image 214 doticonVersion:Currentdoticon License: Weak Copyleft (LGPL-3.0)

                                                                                                                                                        Roslyn analyzers that aim to help security audit on .NET applications.
                                                                                                                                                        Support
                                                                                                                                                          Quality
                                                                                                                                                            Security
                                                                                                                                                              License
                                                                                                                                                                Reuse

                                                                                                                                                                  NsDepCopby realvizu

                                                                                                                                                                  C# doticonstar image 146 doticonVersion:v2.0.0doticon
                                                                                                                                                                  License: Strong Copyleft (GPL-2.0)

                                                                                                                                                                  NsDepCop is a static code analysis tool that helps to enforce namespace dependency rules in C# projects. No more unplanned or unnoticed dependencies in your system.

                                                                                                                                                                  Support
                                                                                                                                                                    Quality
                                                                                                                                                                      Security
                                                                                                                                                                        License
                                                                                                                                                                          Reuse

                                                                                                                                                                            NsDepCopby realvizu

                                                                                                                                                                            C# doticon star image 146 doticonVersion:v2.0.0doticon License: Strong Copyleft (GPL-2.0)

                                                                                                                                                                            NsDepCop is a static code analysis tool that helps to enforce namespace dependency rules in C# projects. No more unplanned or unnoticed dependencies in your system.
                                                                                                                                                                            Support
                                                                                                                                                                              Quality
                                                                                                                                                                                Security
                                                                                                                                                                                  License
                                                                                                                                                                                    Reuse
                                                                                                                                                                                      C# doticonstar image 117 doticonVersion:v3.26.0doticon
                                                                                                                                                                                      License: Permissive (MIT)

                                                                                                                                                                                      F# analyzer that provides embedded SQL syntax analysis, type-checking for parameters and result sets and nullable column detection when writing queries using Npgsql.FSharp.

                                                                                                                                                                                      Support
                                                                                                                                                                                        Quality
                                                                                                                                                                                          Security
                                                                                                                                                                                            License
                                                                                                                                                                                              Reuse

                                                                                                                                                                                                Npgsql.FSharp.Analyzerby Zaid-Ajaj

                                                                                                                                                                                                C# doticon star image 117 doticonVersion:v3.26.0doticon License: Permissive (MIT)

                                                                                                                                                                                                F# analyzer that provides embedded SQL syntax analysis, type-checking for parameters and result sets and nullable column detection when writing queries using Npgsql.FSharp.
                                                                                                                                                                                                Support
                                                                                                                                                                                                  Quality
                                                                                                                                                                                                    Security
                                                                                                                                                                                                      License
                                                                                                                                                                                                        Reuse

                                                                                                                                                                                                          Echoby Washi1337

                                                                                                                                                                                                          C# doticonstar image 135 doticonVersion:Currentdoticon
                                                                                                                                                                                                          License: Others (Non-SPDX)

                                                                                                                                                                                                          Generic static analysis framework.

                                                                                                                                                                                                          Support
                                                                                                                                                                                                            Quality
                                                                                                                                                                                                              Security
                                                                                                                                                                                                                License
                                                                                                                                                                                                                  Reuse

                                                                                                                                                                                                                    Echoby Washi1337

                                                                                                                                                                                                                    C# doticon star image 135 doticonVersion:Currentdoticon License: Others (Non-SPDX)

                                                                                                                                                                                                                    Generic static analysis framework.
                                                                                                                                                                                                                    Support
                                                                                                                                                                                                                      Quality
                                                                                                                                                                                                                        Security
                                                                                                                                                                                                                          License
                                                                                                                                                                                                                            Reuse
                                                                                                                                                                                                                              C# doticonstar image 70 doticonVersion:0.0.0.1doticon
                                                                                                                                                                                                                              License: Permissive (MIT)

                                                                                                                                                                                                                              A set of code analyzers & code fix providers to help developers use the proper .NET Collection & API in their algorithms

                                                                                                                                                                                                                              Support
                                                                                                                                                                                                                                Quality
                                                                                                                                                                                                                                  Security
                                                                                                                                                                                                                                    License
                                                                                                                                                                                                                                      Reuse

                                                                                                                                                                                                                                        DotNet.SystemCollections.Analyzersby hypertherm

                                                                                                                                                                                                                                        C# doticon star image 70 doticonVersion:0.0.0.1doticon License: Permissive (MIT)

                                                                                                                                                                                                                                        A set of code analyzers & code fix providers to help developers use the proper .NET Collection & API in their algorithms
                                                                                                                                                                                                                                        Support
                                                                                                                                                                                                                                          Quality
                                                                                                                                                                                                                                            Security
                                                                                                                                                                                                                                              License
                                                                                                                                                                                                                                                Reuse