Posts

Is WebAssembly future of Web Development

Sachin Sunkle

Over the last many years, de-facto language of the Web (specifically front-end) has been Javascript (and variants like Typescript, ECMAScript versions and so on). The Web development has been revolving around HTML+CSS+Javascript trio. It all started with support for Javascript in browsers, followed by addition of XMLHTTP API, Rich DOM Manipulation Support in Javascript. To induce order and apply patterns to Javascript’s usage in browsers, numerous frameworks and libraries were introduced like React and Vue among others. To begin with, The target used to be browsers on Large Devices like Desktop & Laptops. However, soon all sorts of devices were targetted with advent of Responsive and Progressive CSS+Javascript libraries eg. Bootstrap. Offline Support soon came in ref: Electron and Progressive Web Applications.

Using Github Actions for Automated Testing and Deployment

Sachin Sunkle

Background

The source code of tracfee.com is hosted on Github Private.

At a High level, Tracfee’s Architecture involves,

So far, API testing has been automated and we were looking at ways to automate deployment of both UI and API. Steps required to deploy API are less since we are using Docker to run it on VM. However, in case of Netlify, it is required to build and then upload the output folder on Netlify.

Windows Service with Cancelable Task

Sachin Sunkle

Background

Recently, we had requirement wherein a process should,

  • Periodically (Poll) or Asynchronously (Pub-sub) listen on incoming requests/messages. The whole process is expected to be long running.
  • Should also implement clean disposal of in-flight requests and subsequent cleanup using something similar to Cancelble Context in Go

The first of the objective is somewhat dependent on mechanism (Pub/sub, Listener), protocol (TCP, HTTP etc.). For the second one, .NET framework (and .NET Core) offers CancellationToken. It is maint for co-operative cancellation between threads and Task Objects. So Armed with this, is it possible to come up with a template that allows cancellation of long running task while also being deployed as Windows Service (or using systemd in Linux) ?

Optimizing .NET Code using Benchmarks

Sachin Sunkle

Background

Oftentimes, we come across situation where code does not perform as per expectation. What is typically approch to address it,

  • Performance Testing - Visual Studio Load Tests or Third party tools like Locust, Vegeta, Gatling etc.
  • Visual Studio Diagnostics Tools Or
  • Use tools like Perfview/dotTrace/dotMemory to diagnose bottlenecks

What if it is possible to Benchmark code for,

  • Set of varying parameter(s)
  • Different runtimes (.NET Framework versions, .NET core, Mono etc.) with option to Benchmark it
  • Observe Memory Allocations for diagnostics
  • Get Detailed report on execution timeline
  • Have it as part of test suite so that it can be easily executed with every iteration involving optimized code to get immediate feedback

Enter BenchmarkDotNet, a Powerful .NET library for benchmarking. It is used by DotNET Team, Roslyn, ASP.NET Core and many other projects.

ASP.NET Core - Mind the SameSite HTTP Cookie settings

Sachin Sunkle

Background

A Web Application, developed in ASP.NET Core (Runtime Version 3.1.100) using Razor Pages and Web API, is expected to be launched from within third-party Web Application in iframe, with complete HTML being rendered.

During the Development, a mock HTML Page was developed to simulate launching of ASP.NET core based Web Application in iframe. Note that this page as well as Application was hosted on same IIS Server and it worked fine. Subsequently, Web Application was deployed on Test Server and URL was shared for integration with third party Application and then it happened Boom…. i.e. Application when launched in iframe rendered HTML but none of the post request would work (returning HTTP Error 400). Careful inspection showed that,