How to run SonarQube locally for .Net solutions

The article describes how to analyze C# code quality using the SonarQube command line.

Photo by Jefferson Santos on Unsplash


  1. Download the SonarQube free Community Edition
  2. SonarQube scanners require version 8/11 of the JVM, and the SonarQube requires version 11
  3. Install PostgreSQL for demonstration, but it also supports MSSQL and Oracle databases.
  4. For the .Net Core 2+ version, download SonarQube Scanner.
  5. For the .Net Framework version, download SonarQube Scanner.

Getting Started

Following steps to configure & run C# code analysis using SonarQube for .Net Core applications.

Unzip folders(prerequisites in points 1 and 4) into a directory.

Follow the below commands to configure a database & user in the…


Use of TryParse method for a safer type conversion

Photo by Lukas from Pexels

Learning Objectives

The article demonstrates

  • TryParse() Method for safe conversion.
  • Protect against the loss of data while casting.


  • Experience with data types like string, int, decimal, float, and so on.
  • Install latest visual studio community edition.

Getting Started

When working with data, you’ll likely need to convert string data into a numeric data type. The string data type can handle a non-numeric value, and it’s possible that performing a conversion from a string into a numeric data type will prompt a runtime error.

In this scenario, a wrong value that cannot be converted into an int, given intentionally.

string name = “Bob”;


Create code cleanup profiles and run on the build-in Visual Studio.

Photo by Blake Connally on Unsplash
  • To create code cleanup profiles in the Visual Studio solution explorer.
  • Run code cleanup profile manually or automatically on the build.
  • How some of the Visual Studio 2019 code analysis features can improve the quality of our C# code and save us a lot of time cleaning up and organizing code.

Getting Started

Open any .Net Framework or .Net project in the Visual Studio.

Right-click on solution or project and go to “Analyze and Code Cleanup” and click “Configure Code Cleanup.”

Image by Arek Socha from Pixabay

For best practices, software should have the least amount of privileges. However, some tools like performance monitoring require elevated admin permissions.

The article describes the scenario for programming such software or applications in .Net Core.

Install tool Globally

The following instructions guide the way to run, install, or uninstall .Net Core tools that need to be executed with elevated permissions.

If a folder already exists in %ProgramFiles%\dotnet-tools the path, then checks whether the user group has the permission to write or modify the directory.

To install, run the below command in a command prompt session with Administration mode. It will generate the Dotnet-tools folder during the installation.

dotnet tool install PACKAGEID --tool-path "%ProgramFiles%\dotnet-tools".

The global tool package should be installed in a protected location…

Photo by Moose Photos from Pexels

Over the years, we have listened to our parents and elders why writing is so beneficial.

We have often realized how strong the need for teacher-led writing is for children that reinforces the basics. Countless times parents reported that whenever they try to give feedback on their child writing, they often ran in the following problems:

  • Children tend to take criticism of their writing assignments very personally.
  • Parents also not aware of how to give constructive feedback.
  • Parents do not know how to point out errors without making the child feel incompetent as a writer.

Who can provide the feedback?

Writing is a very personal endeavor. Students or children are often reluctant to hear criticism or feedback on their writing skills…

Image by Alltechbuzz from Pixabay

There are numerous occasions where JavaScript behaves strangely.

I love the frameworks written on top of javascript but do not prefer to write code in javascript.

Please find below cases where javascript behave differently:

As shown below, see addition and subtraction.

11+1     //12'11'+1   //11111-1     //10'11'-1   //10 //What is hell? right?

JavaScript is very loosely concerning data types.

let name="Sukhpinder";
console.log(name); //Sukhpinder

.NET Core

It is a reverse proxy toolkit for developing secure proxy servers in .NET.

Image by Mudassar Iqbal from Pixabay

YARP stands for “YARP: A Reverse Proxy” is a project to create a reverse proxy server.

YARP fills into the ASP.NET pipeline for managing incoming requests and then has its sub-pipeline for implementing the steps to proxy the requests to backend servers.

For the specific need of different deployment scenarios, YARP can be easily customized and tweaked.

Getting started with YARP

YARP library provides the core proxy functionality that you can then customize by adding or replacing modules.

For a current preview, the NuGet manager supplies the YARP package. …


The Startup class is a single place to configure services and the app's request pipeline.

Image by 200 Degrees from Pixabay
  • It contains an optional Configure Services method to configure app services. A service is a reusable module that provides functionality.
  • Need to register services in the Configure Services method and consumed throughout the application via dependency injection.
  • Includes a Configure method to build the app’s request processing pipeline.

ConfigureServices and Configure are called by the .NET Core runtime when the app begins executing:

Specify the Startup class in the app’s host built. The Startup class is typically defined by calling the WebHostBuilderExtensions.UseStartup<TStartup> method on the host builder inside the Program.cs file as shown below.

The host provides services…


Configuration in .NET is achievable with various configuration providers.

There are different types of providers that rely on many configuration sources. The article details each of the configuration provider's variants and their corresponding sources.

  • File configuration provider
  • Environment variable configuration provider
  • Command-line configuration provider
  • Key-per-file configuration provider
  • Memory configuration provider

Configuration in .NET is the capability to bind values to instances of .NET objects.

For example, the JSON provider can be utilized to map appsettings.json files to .NET objects with dependency injection. It enables the options pattern, i.e. classes to provide strongly typed access to collections of similar settings.

File configuration provider

FileConfigurationProvider is the base class for packing configuration from the…

A doctor vaccinating a small girl, other girls with loosened blouses wait their turn apprehensively by Lance Calkin

Today, vaccine producers can pack vials at the frequency of millions a day and pass them to nearly any country within hours. Still, when the smallpox vaccine entered in India in the early 1800s, the process of distributing was prolonged.

It was the first vaccine made by people, not factories. Dr Edward Jenner introduced the word vaccination into the scientific literature in the late 1700s.

Directly applied to your arm and after approximately a week, a boil appeared at the spot. Then a doctor drew the pus, which was the vaccine and treated others with it. …

Sukhpinder Singh

Programmer by heart | C# | Python | .Net Core | Xamarin | Angular | AWS | Remember to 👏👏👏👏 | Linkedin 👉 https://www.linkedin.com/in/sukhpinder-singh/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store