HTML To PDF export – ASP.NET Core

For HTML To PDF export, I have mainly used wkhtmltopdf. Rotativa is built upon it for .net and asp.net core. It works fine but I was not able to get it working with Docker using linux containers.

Finally switched to “html-pdf” node.js package which internally uses phantom.js. I was able to get sample application running in docker. Need to explore more for its feature capabilities.

ASP.NET CORE – No @HTML.Action….hello ViewComponents !!!

Child actions are removed from ASP.NET Core MVC i.e. there is no @Html.Action ….instead new feature called ViewComponents is introduced.

Concepts is very similar but implementation approach is bit different. To me, major benefit of it is “separation of concerns”.

It can be basically a combination of – HtmlHelper + Child Actions + Separation of Concern + Asynchronous + Dependency Injection

With partial views or child actions, you have dependency on controller.  ViewComponents do not need controller and are implemented separately

Here is a good article if you want to explore more:

https://www.telerik.com/blogs/why-you-should-use-view-components-not-partial-views-aspnet-core

Docker error – No activity detected on VM, aborting

Recently I upgraded docker for windows to latest version 18.06.0-ce-win72 and it started giving below error in visual studio.

No activity detected on VM, aborting
at Docker.Core.Pipe.NamedPipeClient.Send(String action, Object[] parameters) in C:\gopath\src\github.com\docker\pinata\win\src\Docker.Core\pipe\NamedPipeClient.cs:line 36
at Docker.Actions.<>c__DisplayClass24_0.<SwitchDaemon>b__0() in C:\gopath\src\github.com\docker\pinata\win\src\Docker.Windows\Actions.cs:line 272
at Docker.WPF.TaskQueue.<>c__DisplayClass19_0.<.ctor>b__1() in C:\gopath\src\github.com\docker\pinata\win\src\Docker.WPF\TaskQueue.cs:line 59

Windows Version: 10
Docker for Windows CE Version: 18.06.0-ce-win72 2018-07-26

Till time issue is fixed,  solutions are:
1. Revert back to last stable version 18.03.1
2. OR Reset to factory settings (option available under Settings menu of Docker for windows)

Code Coverage with Visual Studio 2015 Professional.

Visual Studio has in-built support for code coverage for Enterprise Editions only. For other editions – you have option to use paid/licensed tools like dotCover.

If you are looking for something free/opensource –  OpenCover is very good code coverage tool. But to work with it in Visual Studio, you can use it with some other tool e.g. ReportGenerator. See how to do it here. (VS extension is – OpenCover UI).

But there is one more tool – AxoCover which uses OpenCover and integrates nicely with visual studio for for code coverage.  Some information can be found here.

Still lot to explore, but definitely worth trying it !!