<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Alexandre Malavasi</title>
    <description>The latest articles on DEV Community by Alexandre Malavasi (@alemalavasi).</description>
    <link>https://dev.to/alemalavasi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F309255%2Fd9c7bf30-ea13-4a0c-b3b9-ddfc7cd845f2.jpg</url>
      <title>DEV Community: Alexandre Malavasi</title>
      <link>https://dev.to/alemalavasi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/alemalavasi"/>
    <language>en</language>
    <item>
      <title>Defining Code Rules for .NET Core projects with NDepend
</title>
      <dc:creator>Alexandre Malavasi</dc:creator>
      <pubDate>Sat, 11 Jan 2020 04:08:40 +0000</pubDate>
      <link>https://dev.to/alemalavasi/defining-code-rules-for-net-core-projects-with-ndepend-38pf</link>
      <guid>https://dev.to/alemalavasi/defining-code-rules-for-net-core-projects-with-ndepend-38pf</guid>
      <description>&lt;p&gt;This is the second post related to the NDepend tool and Code Quality for .NET Core application I’m writing. I’m sure it will be many of them, because of how important is this subject, but let’s start with something.&lt;/p&gt;

&lt;p&gt;If you want to know more about how to install the NDepend tool in Visual Studio, I recommend you to take a look at my first post about it clicking right:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://medium.com/@alexandre.malavasi/code-quality-with-ndepend-tool-net-core-854ec070b47d"&gt;https://medium.com/@alexandre.malavasi/code-quality-with-ndepend-tool-net-core-854ec070b47d&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;One of the hardest parts of quality for software projects is to define the code rules for the team, that everyone agrees based on their own experience and based on what the project needs. It does not matter if it is a junior or senior developer, everyone has an opinion, but there is a general agreement on the market about the majority of recommendation we could apply in our projects. Therefore, this post doesn’t have the purpose to define what code rules are recommendable, but the scope for this article is to demonstrate how we can set up the code rules decided by the team on the NDepend tool.&lt;/p&gt;

&lt;p&gt;Once you have it installed, the code rules explorer can be found on Extensions &amp;gt;&amp;gt; NDepend &amp;gt;&amp;gt; Code Rules Explorer:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QIZDgcw0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/vxtd8go1kcfv4h8wbnz3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QIZDgcw0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/vxtd8go1kcfv4h8wbnz3.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It will be opened a list of all the Rules already set, by category and individually as the image below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--k1kqlgLI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/u3gw583j03mlqk3xxnac.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--k1kqlgLI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/u3gw583j03mlqk3xxnac.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It shows if our project already contains points to review (warnings) by category(e.g Security, Dead Code, etc) and if you click at an individual rule, it is possible to change the configuration or create a new query. Everything here is based on LINQ Queries that you are probably already familiar with.&lt;/p&gt;

&lt;p&gt;For this article, I’ll change the rule related to the recommendable maximum number of lines for methods. To do that, just click in an individual rule in the Rule Explorer and it’ll show the LINQ query associated to the rule, as follows:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PuCTSJ4s--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/3ojfi0h2wtndok478tpt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PuCTSJ4s--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/3ojfi0h2wtndok478tpt.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In my case, I want to put the maximum of lines to 50 (It is not so strict). So, I changed in the LINQ Query the criteria to show the warning related to the rule:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Tc4ytpZh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/tvd32ji8jcper6b16g9l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Tc4ytpZh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/tvd32ji8jcper6b16g9l.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The NDepend tool generates an object (JustMyCode) with useful properties related to our base code information.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DS8vBfz4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/b10pcx20ort27h0fwg09.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DS8vBfz4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/b10pcx20ort27h0fwg09.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can set patterns for namespace, types, names, properties of the classes, Assemblies and much more. It is really that easy to set up.&lt;/p&gt;

&lt;p&gt;The query below is given by the tool as an example in how we can set a rule to avoid to call directly the Db Layer in the View / FrontEnd Layer:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xQ8J-5FL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/oy0i441dx03kgh31plnr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xQ8J-5FL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/oy0i441dx03kgh31plnr.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can check if certain assembly as Entity Framework is being used in a specific layer that we don’t want that someone uses it. Within big teams, it is really important to have this kind of automatic custom verification.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
I found the tool really impressive and easy to use, install and setup. Considering the huge amount of useful features this tool has, I think that deserves a series of posts about it, explaining details on how we can get better code quality results easily with this tool help. It is only the second article for a while.&lt;/p&gt;

&lt;p&gt;So, I’m really enjoying “playing” with this tool. I hope that will be helpful for you.&lt;/p&gt;

&lt;p&gt;Thank you for reading this article till the end. &lt;/p&gt;

</description>
      <category>aspnet</category>
      <category>dotnet</category>
      <category>ndepend</category>
    </item>
    <item>
      <title>Migration from Asp.Net Core 2.2 to 3.1 — Real project
</title>
      <dc:creator>Alexandre Malavasi</dc:creator>
      <pubDate>Thu, 09 Jan 2020 23:33:46 +0000</pubDate>
      <link>https://dev.to/alemalavasi/migration-from-asp-net-core-2-2-to-3-1-real-project-54hm</link>
      <guid>https://dev.to/alemalavasi/migration-from-asp-net-core-2-2-to-3-1-real-project-54hm</guid>
      <description>&lt;p&gt;The purpose of this article is to share my personal experience of migrating a medium complexity real project from Asp.Net Core 2.2 and Asp.Net 3.1.&lt;/p&gt;

&lt;p&gt;The project uses the following stack:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Asp.Net Core Web API&lt;/li&gt;
&lt;li&gt;Vue JS front-end without any Razor Pages used in the project. The entire front-end is a Vue JS application&lt;/li&gt;
&lt;li&gt;Entity Framework Core (Code First approach)&lt;/li&gt;
&lt;li&gt;SQL Server Database&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At the beginning of my career, almost all the time I decided to postpone the upgrade of .NET projects under my responsibility to the newest version of the underlying technology. There are many factors that should be considered before migrating a system: costs, effort, complexity, business value, etc. Therefore, depends on the scenario, many projects aren’t migrated to a newer version.&lt;/p&gt;

&lt;p&gt;I changed my mind in the last years, manly after the launch of the first version of .NET Core. The first migrations from .NET Framework to .NET Core might be problematic for complex projects, but the migrations between .NET Core version, usually, are not that hard.&lt;/p&gt;

&lt;p&gt;In the rest of the article, I’m going to demonstrate all the steps I made to migrate a real project, all the problems and, of course, the solutions I’ve found and applied.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Framework version change&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The first thing is to change to .NET Core version:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jGeku-EU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/5m847njzs4sgsfio6aab.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jGeku-EU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/5m847njzs4sgsfio6aab.jpeg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0OUSwzB_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/xum50yazs831pvzvxvzb.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0OUSwzB_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/xum50yazs831pvzvxvzb.jpeg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After that, I ran the project just to see the number of errors the Solution would have after this change. And that is the result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VKQ11zyJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/76mvxnb3netjx14r9f8w.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VKQ11zyJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/76mvxnb3netjx14r9f8w.jpeg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That is saying it got more than 900 errors! The project is not so big and a good amount of the problems are related to the Nuget packages version.&lt;/p&gt;

&lt;p&gt;But, my biggest curiosity was the Entity Framework incompatibility issues. So, let's see what I found.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Entity Framework Core&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The first thing I did was update all the packages associated with EF Core to avoid the need for too many useless incompatibility issues. I upgraded the packages to the 3.1 version.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uc_i_iot--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/f5t2p8fk3o0m0cyunbm1.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uc_i_iot--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/f5t2p8fk3o0m0cyunbm1.jpeg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once that was done, I got a problem with the SQL Server library to Entity Framework. The issue was solved by installing the package for SQL Server in separate (Microsoft.EntityFramework.SqlServer):&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sEr3lGna--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/pao8yx8an3xwe8ev880y.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sEr3lGna--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/pao8yx8an3xwe8ev880y.jpeg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I built the project again and it sill getting many errors, as follows:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CDy0XHz3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/d9ujr5xcfb18ku2vgptp.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CDy0XHz3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/d9ujr5xcfb18ku2vgptp.jpeg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;PS: Many of them can be solved just by cleaning the Solution and building it again. I updated again all the packages to the newest version, in case of it exists.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Project file (.csproj)&lt;/strong&gt;&lt;br&gt;
The next step was to verify the compile errors and warnings reference to project file configuration (.csproj). In my case, after analyzing the compile error messages, I removed the following lines from the file:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6uLXv8JF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/03e54wwj4wruri5f8628.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6uLXv8JF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/03e54wwj4wruri5f8628.jpeg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;According to the official documentation, these entries are useless in .NET Core 3.1.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Nuget package updates&lt;/strong&gt;&lt;br&gt;
Logically, the next step was to upgrade the rest of the packages used by the application to the newest possible version. In that context, I was using just third party libraries for Vue JS Middleware and native libraries of .NET Core. But, it might be different in your scenario. So, it is really important to analyze it before your own migration.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Startup.cs&lt;/strong&gt;&lt;br&gt;
The most relevant changes were on the Startup file, because of since version 3.0 of Asp.Net Core, the route configuration changed completely. Now there are more options for specific situations. For instance, you don’t need anymore configure an application to use the entire MVC engine if your application is just a Web API and, therefore, does not use View or Razor Pages. You can add configuration just for Controllers in that case. It is much better I think.&lt;/p&gt;

&lt;p&gt;So, the first thing I did in the file was removing the references to Microsoft.AspNetCore.Mvc to use Microsoft.Extensions.Hosting:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--E0rJQIHA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/cta00fnu9yol7e14uf1r.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--E0rJQIHA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/cta00fnu9yol7e14uf1r.jpeg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--x-uK3ir0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/u6jkdb58rkc1tdb1ehdk.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--x-uK3ir0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/u6jkdb58rkc1tdb1ehdk.jpeg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Also, instead of use “AddMvc” to set the route configuration, I used “UseEndPoints”, which one is available since the first version of .NET Core 3.0. Using that, I mapped the Controllers, because the backend of my project is a Web API:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Cudx-itZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/zr10ie275ehwv55mdj73.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Cudx-itZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/zr10ie275ehwv55mdj73.jpeg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The interface IHostEnvironment was replaced by IWebHostEnvironment, as follows:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4OEGbGtL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/kqo4w4m0ahhxo1gwcliz.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4OEGbGtL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/kqo4w4m0ahhxo1gwcliz.jpeg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--k4Xom8nL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/dadwt9klrr7u0ipk35es.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--k4Xom8nL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/dadwt9klrr7u0ipk35es.jpeg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Extra problems&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;After finally being able to run the project without errors in compile-time, I quickly get an error in runtime, when it tried to initialize:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uXOl3clK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/p2wdnentdpkrdwfuf12o.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uXOl3clK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/p2wdnentdpkrdwfuf12o.jpeg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I searched in some Github forums and figured out the error was caused by the non-installation of this package:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dUGhgJHm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/9n6iu7aopcw6egk5f95c.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dUGhgJHm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/9n6iu7aopcw6egk5f95c.jpeg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As I was using a Middleware for Vue JS and running the application as SPA (Single Page Application), the installation of this package was missing. If you use the middleware for Angular or React, possibly you’ll get the same error and that is the solution.&lt;/p&gt;

&lt;p&gt;Finally, I was able to run the project, without any extra issues and it worked perfectly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In my opinion, it is much better to migrate to the 3.1 .NET Core version if the application is already in 2.x version. It is quite stable at this point and one day you’ll have to migrate to it, so why not? I believe it does not contain many break changes. But, surely, I would say that It is always better to check it in your own scenario, that might be different from mine.&lt;/p&gt;

&lt;p&gt;I hope this article has helped and encouraged you in case you are thinking to migrate your project to .NET Core 3.1. Thank you for reading this article to the end&lt;/p&gt;

</description>
      <category>aspnet</category>
      <category>dotnet</category>
      <category>dotnetcore</category>
    </item>
    <item>
      <title>How to create project templates and extension for Visual Studio 2019
</title>
      <dc:creator>Alexandre Malavasi</dc:creator>
      <pubDate>Wed, 08 Jan 2020 21:54:06 +0000</pubDate>
      <link>https://dev.to/alemalavasi/how-to-create-project-templates-and-extension-for-visual-studio-2019-fc7</link>
      <guid>https://dev.to/alemalavasi/how-to-create-project-templates-and-extension-for-visual-studio-2019-fc7</guid>
      <description>&lt;p&gt;Hi!&lt;/p&gt;

&lt;p&gt;Recently, I created two project templates for Vue JS + Asp.Net Core, both of them as Visual Studio 2019 extensions. They were shared on Visual Studio marketplace, as you can see at the link below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://medium.com/@alexandre.malavasi/update-template-vue-js-asp-net-core-3-1-visual-studio-2019-caf13caab34b"&gt;https://medium.com/@alexandre.malavasi/update-template-vue-js-asp-net-core-3-1-visual-studio-2019-caf13caab34b&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Would you like to know how to create your own extension and publish your own template? If yes, the rest of the article is a step by step process on how to do that.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Project creation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The first thing you have to do is to create a project that you want to share as a template. In this article, I’ll demonstrate step by step using the Vue JS + Asp.Net Core project I already published.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jrpvha2G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/9ux7pcb4zh20b0vnomgo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jrpvha2G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/9ux7pcb4zh20b0vnomgo.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Project export&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Once the project is created, on Visual Studio 2019 go to Project menu option and choose the option “Export Template”:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fKC__vy2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/laiq6pziic39xtp2c7hv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fKC__vy2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/laiq6pziic39xtp2c7hv.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There are two types of templates: Project template and Item template. As in our case we are creating a project template, I selected the underlying option:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qrto1y4r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/lroo99k02ul2jyu7q3d0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qrto1y4r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/lroo99k02ul2jyu7q3d0.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The next step is to configure the name, description, icon that will be shown to users and the image preview. It is really important to set this information properly, as much as high quality you can, because it will appear to final users who will download and install your template/extension.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--EHICOXH5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/78g0tu0br5urrrnmyad7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--EHICOXH5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/78g0tu0br5urrrnmyad7.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And uncheck the option “Automatically import to Visual Studio”. In that way, you’ll be able to install the extension that you are creating.&lt;br&gt;
Finally, the process will generate a compact folder which contains the template itself, but it is not the end of the creation:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ic5GeGnM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/fq485iylvb1ybxnnopkw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ic5GeGnM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/fq485iylvb1ybxnnopkw.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tags definition&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When we create a new project on Visual Studio 2019, the templates appear together with some specific tags, that help us to filter the templates:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rKDpiioD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/wxbpzbgxz297y8z2rf5s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rKDpiioD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/wxbpzbgxz297y8z2rf5s.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Since the latest version of Visual Studio 2019, these tags are mandatory for those who want to publish an extension. Without those, the extension will be installed, but the template will never be shown in the list, even if the user searches that.&lt;/p&gt;

&lt;p&gt;To create these tags, open the compact folder that was generated with the template in the last step and open the .vstemplate file using a Text Editor:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--FyxLoJ_P--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/llhrijgluq0vsc5dga87.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FyxLoJ_P--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/llhrijgluq0vsc5dga87.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the section “Template Data”, add after the tag “ProvideDefaultName” the tag list reference to your template, such as platform, project type, language, etc. In my case, I specified as follows:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Q6iDNRDB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/aiccv9ts5v80ns2iqn39.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Q6iDNRDB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/aiccv9ts5v80ns2iqn39.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The full available tag list can be found at the link below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.microsoft.com/en-us/visualstudio/ide/template-tags?view=vs-2019#built-in-tags"&gt;https://docs.microsoft.com/en-us/visualstudio/ide/template-tags?view=vs-2019#built-in-tags&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Creation of the Extension&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;With the template already created and the tags set, now it is time to create the install file for the extension.&lt;/p&gt;

&lt;p&gt;For that, just create a project of the type VSIX Project:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--EupLCwkB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/oyxcjatlhnfke029jtn1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--EupLCwkB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/oyxcjatlhnfke029jtn1.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is the basic structure of the project:&lt;br&gt;
&lt;strong&gt;PS:&lt;/strong&gt; however I created the project name using certain special characters as “+”, just for teaching purposes, please avoid to do that in real scenarios. It is better to create without any empty spaces or special characters, like that: &lt;strong&gt;TemplateVueJSAspNetCoreArtigoMedium&lt;/strong&gt;, instead of the name I put. It will prevent build issues, because of the VS will generate automatically namespaces and classes using that name.&lt;/p&gt;

&lt;p&gt;Include in the root the compact folder reference to your template. It is important that the compact folder would contain the .vstemplate file changes with the tags I mentioned before. Don’t forget that.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--u0VTg7sP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/0i68b44hqzyxheravqu2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--u0VTg7sP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/0i68b44hqzyxheravqu2.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This project has a manifest file, that will contain the information on the extension e installation instructions.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--s_0axRpA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/klhq0vkxwymh1883h8am.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--s_0axRpA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/klhq0vkxwymh1883h8am.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you double click in that file, it will be open like a form, which one you can fill in field by field.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zgUSWQXj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/vdxhr2m542tetv7ynihz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zgUSWQXj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/vdxhr2m542tetv7ynihz.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Change carefully all the necessary info with quality, because it will appear to final user in the installation and marketplace as well. Also, it is necessary to specify the field “Author” properly, because it is normally has the LAPTOP name.&lt;/p&gt;

&lt;p&gt;After that, click at “Assets”:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--i0Cx92Xy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/tfwbwtepd8m1fzsdhfku.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--i0Cx92Xy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/tfwbwtepd8m1fzsdhfku.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Remove the existent assets, in case of there are, and click in “New”:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fcQjd57v--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/izhyx37bz52ixe0gb4wd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fcQjd57v--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/izhyx37bz52ixe0gb4wd.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Choose the options that I put and in the path specify the compact folder that you have added to the project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Generation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To create the installation file, it is just building the project in release mode. It will generate the .exe file used to install the extension on VS.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--m_6Iv4w1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/s8bcgzmr496sqvbyw5sy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--m_6Iv4w1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/s8bcgzmr496sqvbyw5sy.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Done! Our extension was created. You can test it now, before you publish on the Visual Studio marketplace, to see if everything is working fine.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Visual Studio Market Publish&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In case you want to publish your extension to the public, you can do that on Visual Studio Marketplace.&lt;/p&gt;

&lt;p&gt;To do that go to marketplace.visualstudio.com and, after log in with your Microsoft account, go to the options below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yP8e5mVU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/3cr9iejzp2w9rsrcz6cq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yP8e5mVU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/3cr9iejzp2w9rsrcz6cq.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Upload the .exe of your extension:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ww4LSx98--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/wc4j33w2acqcku60n2ai.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ww4LSx98--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/wc4j33w2acqcku60n2ai.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Fill in the form with the template and extension info. As that information will be public, pay attention in detail.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gnnn1Qwx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/he5hsn633cbxtawf4qht.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gnnn1Qwx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/he5hsn633cbxtawf4qht.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once the process is finished, just save and wait for the approval process. That could take a few minutes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oTZr0B7L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/9wvmnmf8yzbji0dgalvm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oTZr0B7L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/9wvmnmf8yzbji0dgalvm.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I hope this article helped you. Thank you for reading it.&lt;/p&gt;

</description>
      <category>dotnet</category>
      <category>aspnet</category>
      <category>visualstudio</category>
    </item>
    <item>
      <title>[Quick Tip] SignalR — AutoReconnect — Asp.Net Core 3.x
</title>
      <dc:creator>Alexandre Malavasi</dc:creator>
      <pubDate>Sun, 05 Jan 2020 21:54:08 +0000</pubDate>
      <link>https://dev.to/alemalavasi/quick-tip-signalr-autoreconnect-asp-net-core-3-x-3302</link>
      <guid>https://dev.to/alemalavasi/quick-tip-signalr-autoreconnect-asp-net-core-3-x-3302</guid>
      <description>&lt;p&gt;SignalR is one of the most important technologies for creating realtime applications or Web functionalities, such as chats, multi-user application interactions or even online games. The purpose of this article is not to demonstrate fully its use or give so many details but talk a little a bit about one big issue SignalR has (or did have): the connection loss.&lt;br&gt;
To exemplify it, I created a simple Asp.Net Core application, which one is a basic chat using SignalR. That is enough to demonstrate it:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MOs-V1yK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/n8vqbnld41khq9yhyr4d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MOs-V1yK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/n8vqbnld41khq9yhyr4d.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--EANbiyLU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/9x1p30pan629kv1y7fp4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--EANbiyLU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/9x1p30pan629kv1y7fp4.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you probably already know, the SignalR keeps an open connection via Websocket between the client and server, as the following image shows:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GDhLtjQi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/iu9jbh4cmipjdmi1wwzw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GDhLtjQi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/iu9jbh4cmipjdmi1wwzw.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At this point, it’s being simulated a chat between two users and what happens if the connection is gone? Exactly like that:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IuGjn-Oo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/s6cc3r2q3zto2dbp3dtd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IuGjn-Oo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/s6cc3r2q3zto2dbp3dtd.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;One of the most obvious thing in this kink of application is that we have to be aware that issues could (and will) happen, as connection lost and because of that it is pretty recommendable to create mechanisms for handling this in the frontend, providing minimum information to users on what is going on wrong. But, beyond concerns related to user experience, there are a few involved technical questions and concerns.&lt;br&gt;
Everyone who uses regularly SignalR in many projects knows that make reconnection in SignalR without making “tricks” in the code is something not so easy to do depends on the scenario and complexity.&lt;br&gt;
Thinking on that, together with many improvements on .NET Core 3.0, in general, the big update contains new implementations for SignalR as well, since its 6th Preview.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8-AbSeD4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/w4b0ewsv64ili0lxgqor.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8-AbSeD4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/w4b0ewsv64ili0lxgqor.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In my opinion, one of the most relevant of that is a method to manage the reconnection between the client and server in case of server issues, instability, unavailability, etc.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7n2dlZkv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/gm1rboveqoxrfchrg4nt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7n2dlZkv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/gm1rboveqoxrfchrg4nt.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see in the image above, there is now an extension method called “WithAutomaticReconnect”, which allows you to configure the intervals that the client will try to reconnect with the server. The default unit is in milliseconds and in the example, I’ve set it to attempt the reconnection after 1 second, 5 seconds, etc. In case you want to stop the attempts, just specify a null value, like I did, indicating to the method that it should finish.&lt;br&gt;
To simulate the connection issue on local, I stopped the application on the local server and, automatically, I started to receive connection error messages. But, after about three seconds I reactivated the server and the connection was established again, successfully.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iQ3YP6Un--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/vaf7du6vnwhnj46cuoos.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iQ3YP6Un--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/vaf7du6vnwhnj46cuoos.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I hope this quick and simple article had helped a little a bit. Thank you for reading it.&lt;/p&gt;

</description>
      <category>dotnet</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
