Dependency Injection in .NET Core 2.0

Not easy! But it was not impossible! Yes, I am talking about my first book as co-author titled Dependency Injection in .NET Core 2.0.

The Start

First page was not easy. I am taking about my first book’s first chapter’s first page. I was not able to find ideas on how to start writing. In fact, I cried for sometime. But as usual, I motivated myself and accepted the challenge. I am not that kind of person who is scared of failures.

The Strategy

No doubt that I had experience in writing and I like that a lot, but writing articles, blogs is totally different than writing a book. That is what I learned after completing the book. After a lot of confusion, I started to design a well defined strategy to deal with the situation.

The steps were:

  1. Make a note of outline of first chapter.
  2. Now, forget about the book.
  3. Search for articles, blogs and videos on the topics related to first chapter based on the outlines.
  4. Make important points and draw diagrams to understand the concepts.
  5. Now start writing on the topics with the information gathered.

Interesting, isn’t it.

I started to enjoy this process and gradually completed the first chapter. Likewise, followed the same steps for other chapters as well.

The Outcome

Hard work always pays off. I was not the only one who was working hard. There were many techies and editors involved in the background along with my co-author.

Mr. Gaurav Arora, who is my mentor and guide, challenged me with this project. My editors Mr. Lawrence Veigas and Miss. Tiksha Sarang, who are very talented and friendly, did an amazing job in rectifying the mistakes and suggested improvements time to time.

The outcome was beautiful and the cover looked like below:

Tadit Dash Dependency Injection in .NET Core 2.0

About the Book

.NET Core provides more control than ever over web application architectures. A key point of this software architecture is that it’s based on the use of Dependency Injection as a way to properly implement the Dependency Inversion principle proposed in the SOLID principles established by Robert C. Martin.

With the advent of .NET Core, things have become much simpler with Dependency Injection built into the system. This book aims to give you a profound insight into writing loosely-coupled code using the latest features available in .NET Core. It talks about constructors, parameter, setters, and interface injection, explaining in detail, with the help of examples, which type of injection to use in which situation. It will show you how to implement a class that creates other classes with associated dependencies, also called IoC containers, and then create dependencies for each MVC component of ASP.NET Core. You’ll learn to distinguish between IoC containers, the use of Inversion of Control, and DI itself, since DI is just a way of implementing IoC via these containers. You’ll also learn how to build dependencies for other frontend tool such as Angular. You will get to use the in-built services offered by .NET Core to create your own custom dependencies.

Towards the end, we’ll talk about some patterns and anti-patterns for Dependency Injection along with some techniques to refactor legacy applications and inject dependencies.

What You Will Learn

  • Understand the concept of DI and its implications in modern software construction
  • Learn how DI is already implemented in today’s frameworks.
  • Analyze how DI can be used with current software to improve maintainability and scalability.
  • Learn the use of DI in .NET Core
  • Get used to the possibilities that DI offers the ASP.NET Core developer in different scenarios.
  • Learn about good practices and refactoring legacy code.

How to get the Book?

Book is available on Amazon with two formats Kindle and Paperback. Also available on Publisher’s (Packt’s) site with Ebook and Paperback formats. Links are given below.





Techies are loving the book as I am getting reviews from different sources. Moreover, I am getting reviews in mail and social media.

I would be grateful to you if you feed in your comments about the book on Don’t hesitate to ask me questions by adding comments below. Share with your friends and colleagues.

Thanks for reading the blog. Have a nice day ahead. 🙂






Stellar Phoenix Outlook PST Repair

Stellar Data Recovery provides as excellent and easy-to-use tool for PST repair.


I was very impressed by the look and feel as it has the same kind of theme like Outlook so that it feels very homely for existing Outlook users.

Stellar PST Repair UI


The ease by which you move step by step till end feels effortless.

PST File Selection

There is one option to directly select the file. If you don’t know the direct location, you can provide a “Look in” location, where the software would help you to find all the PST files inside the folder and it’s sub folders.

Check how it shows you all the available PST files as soon as you click “Start”.

Searched PST File List

Now it’s just a matter of selecting the file to see the magic.

Scan Now with PST Repair

Hit “Scan Now” to start the repair process. The recovered mails appear in the center. The tree structure with all the folders and mails appear on the left side, where you can easily navigate and review each one.

Recovered Mails by PST Repair

What are you waiting for? Let’s save all the recovered mails.

Guess what!!! You have many options/format to save.

Save Recovered Mails

Finally, we got our repaired mails stored in the desired location with desired format.

Files Saved


I would strongly recommend this product as it perfectly repairs your damaged mails and provides different format to save that for future reference.


To download the software for free, click here.

SourceTree Issue: This is not a Valid Working Copy Path


We will discuss a quick tip to resolve the SourceTree issue mentioned in the title.


My system got upgraded to Windows 8.1 and I had to install all required software for the development work. I use SourceTree as a tool for Git commands for the projects. So, I installed that again after the format.


Unfortunately, when I started adding the projects as working copy, it complained me that “This is not a valid working copy path“. The error is not so much self explanatory, which triggered research work.


Before I landed upon the solution, I had visited all available menu options in SourceTree to find out the problem. Finally, something engrossed me. I was on Git Tab.

Tools -> Options -> Git

I found some buttons saying “Use Embedded Git“, “Use System Git” at the bottom. So, I suspected that Git is not yet enabled for SourceTree. Therefore, it is not able to identify my commands. I enabled it, that’s why it is shown as disabled below.

SourceTree Git Settings

SourceTree Git Settings

Voila!!! Everything started working as expected.

Help Someone

Share in your circle. Hit the social icons below. Keep coding folks. 🙂

Thanks for reading, have a great day ahead.

Visual Studio Error

Unable to Start Debugging on the Web Server. The Web Server is not Configured correctly.

Visual Studio Error

Visual Studio Build Error


This blog is regarding one issue which happened couple of days back while building a demo app.


One of the freshers in my company had this issue and I tried to resolve. The opportunity is huge, when you try to put yourself in their boot. They do crazy things and break the application. However, as my tech name is “BugTrapper“, so I started my research.


Then I found that the application is hosted in IIS with an IP in the binding.


Binding in IIS

Now, I wanted to check the Project Url in the Project Properties. This is what I saw.


Project Properties

So, it’s obvious now. The problem is the URL mismatch.


I just updated the Project Url to the IP mentioned in IIS. Voila!!! All started working at the next moment.

Have you ever Faced This?

If yes, please comment below. Let’s discuss. Like and share if you want to save someone’s time. 🙂

Uncaught IndexSizeError: Failed to execute ‘getImageData’ on ‘CanvasRenderingContext2D’: The source width is 0.


In this post, we will discuss a problem, which I recently came across while working with images in coding.


The work was to take one image from the file upload control and then compress it using canvas before uploading it to the server. I used a plugin, but let’s not go into that. We will directly come to the point where this problem can happen.


So, the line that we are talking about is like below.

var canvas = canvas.getContext('2d')
                   .getImageData(0, 0, imgWidth, imgHeight);

We are sending image width and height to getImageData. However, if you analyze the error message, it says that width is 0.


With further research on developer console while debugging, I found that the width and height are actually populated in some other properties named as naturalWidth and naturalHeight.
Therefore, we can write the code like below.

var imgWidth = image.width || image.naturalWidth;
var imgHeight = image.height || image.naturalHeight;

var canvas = canvas.getContext('2d')
                   .getImageData(0, 0, imgWidth, imgHeight);

Now your program should work as expected without errors.

More on naturalHeight and naturalWidth from MDN

HTMLImageElement.naturalHeight (Read only)
Returns a unsigned long representing the intrinsic height of the image in CSS pixels, if it is available; else, it shows 0.
HTMLImageElement.naturalWidth (Read only)
Returns a unsigned long representing the intrinsic width of the image in CSS pixels, if it is available; otherwise, it will show 0.


If you like this blog, feel free to share it in your circle and save someone’s time. Please comment below, if you have any inputs for me.

Thanks for reading. Have a nice day ahead.

SourceTree Issue: The Mercurial team strongly encourages all users to upgrade to 3.7.3 due to security vulnerability


If you see the above issue when you update the SourceTree, then follow the steps mentioned below to resolve it. Those who don’t know, it is a free Git and Mercurial client for Windows or Mac, which makes source code management easier with a GUI.


I appreciate how the SourceTree team is continuously improving the software and making it more user friendly. But today, when I updated it to the latest version and opened it again, I saw a weird issue popped up, instead of the SourceTree window.

SourceTree Error

The issue is…

The Mercurial team strongly encourages all users to upgrade to 3.7.3 due to security vulnerability

What is Mercurial?

Mercurial is a free, distributed source control management tool. It efficiently handles projects of any size and offers an easy and intuitive interface.


The version of the Mercurial on your system is old and it has some security vulnerability, which they have fixed and updated with the latest version. If we dig more into the upgrade notes, the below is what you will find.

Mercurial Security Vulnerability Fixes


Go to Mercurial Download Page. Download the latest package according to your system configuration. Now, SourceTree should work as expected.

Mercurial Downloads

Microsoft MVP April 2016

Microsoft MVP 2016

Microsoft MVP 2016

Wow!!! What a surprise on a Friday.
Awarded as ‪Microsoft‬ MVP for the “third time in a row”.

Read my Story

Here. Also by my CEO Mr. Chinmoy Panda. He narrates my story in his own words. Celebrating Awesomeness

What is Microsoft MVP?

Answer : Click here to know more.

The Microsoft Most Valuable Professional (MVP) Award is our way of saying thank you to exceptional, independent community leaders who share their passion, technical expertise, and real-world knowledge of Microsoft products with others. It is part of Microsoft’s commitment to supporting and enriching technical communities. Even before the rises of the Internet and social media, people have come together to willingly offer their ideas and best practices in technical communities.

Thanks to…

  • Biplab Paul, Gandharv Rawat for believing in me. Thanks Siddharth Rout for polishing my skills before the first award in 2014.
  • Thanks to all MVPs in my network.
  • Thanks to my friends, colleagues and leads, who always support and encourage me. Special thanks to Debasis Behera who pulled me to The Code Project ( for answering questions. That was my baby step towards tech community activities. Kshirodra Meher, Sibasis Jenaand Deepak Jena and Tapan Khatua – these geeks help me sharpen my knowledge.
  • My family has been a great inspiration, which propels me for hard work. Thanks Grandfather (Mr. Ganeswar Tripathy) for guiding me. I miss you. 😦
  • Last, but not the list, my heartiest gratitude to the members of Microsoft Dev Community, Odisha. Without them, I am nothing.

Thanks almighty, Jay Jagannath!!!