C#.NET

Visual Studio 2017–Version 15.9.0 released

November 13, 2018 .NET, .NET 4.8, .NET Core, .NET Core 2.0, .NET Core 2.1, .NET Core 2.2, .NET Core 3.0, .NET Framework, ASP.NET, ASP.NET Core 2.1, C#.NET, JavaScript, Microsoft, Razor, SignalR, TypeScript No comments

Microsoft has today released Visual Studio 2017 – Update 15.9.0 with lots of bug fixed and improvements to the IDE for stability and performance.

image

Release Notes: Visual Studio 2017 version 15.9 Minor Release

Download the latest update from: visualstudio.com/downloads

Latest News: There is a new service update released on November 15, 2018 — Visual Studio 2017 version 15.9.1 Servicing Update

Useful Reads: 

Azure Cosmos DB – Change feed support(PREVIEW)–available

July 26, 2018 .NET, .NET Core, .NET Framework, Azure, Azure Cosmos DB, C#.NET, CosmosDB, Microsoft No comments

Today Microsoft announced the preview of Change feed Support for Azure Cosmos DB, which allows you to build scalable solutions. By default change feed will be enabled in all the accounts.

Change feed provides an output of sorted list of documents that has been changed in the order in which they are modified by client operations. These changes are persisted, can be processed asynchronously and incrementally, they enables developers to write alternative logic to operate upon these change for generation reports, or invoke another operation such as sending email or audit logs etc.

ChangeFeedProcessor

Start using :

Source:

Introduction to NDepend : Static Code Analysis Tool

June 16, 2018 .NET, .NET Core, .NET Framework, ASP.NET, Best Practices, C#.NET, Code Analysis, Code Quality, Dynamic Analysis, Emerging Technologies, Help Articles, Microsoft, Static Analysis, Tech-Trends, Tools, Tools, Visual Studio 2017, VisualStudio, Windows No comments , , , , , ,

As a developer, you always have to take the pain of getting adapted to the best practices and coding guidelines to be followed as per the organizational or industrial standards.  Easy way to ensure your coding style follows certain standard is to manually analyze your code or use a static code analyzer like FxCop, StyleCop etc. Earlier days I have been a fan of FxCop as it was free and it provides me all necessary general guidelines in terms  of improving my solution.

In this modern world of programming everything needs to be automated, as it saves time and money in terms of automating repetitive tasks and improves efficiency. This is where static code analysers coming effective.

What is Static Code Analysis?

Static program analysis is the analysis of computer software that is performed without actually executing programs, on some version of the program source code, and in the other cases, some form of the object code or intermediate compiled code .

Sophistication of static program analysis increases is based on how deep they analyze in terms of behavior of individual statements and declarations, to analyzing the entire source code.

PS: Analysis performed on executing programs is known as dynamic analysis.

In this article I will give you an overview of one such premier static code analysis tool that can be used for your daily development routine plus use it for CI integration for DevOps efficiency.

NDepend:

NDepend is a static analysis tool for .NET, specifically for managed code:  NDepdend supports a large number of code metrics, allowing to visualize dependencies using directed graphs and dependency matrix. It also performs code base snapshots comparisons, and validation of architectural and quality rules.

The important capabilities of NDepend are:

  • Dependency Visualization through dependency matrix and graphs.
  • Analyse and generate software quality metrics – as per the documentation it supports 82 quality metrices.
  • Declarative rule support through LINQ queries, and it is called CQLinq and comes with a large number of predefined CQLinq rules.
  • Integration support for Cruise Control.Net, SonarCube, am City. Code rules can be configured to be checked automatically in Visual Studio or during continuous integration(CI).

License: NDepend is a commercial tool with licensing options as below:

  1. Developer seats – $477 approx. / per seat.
  2. Build Machine seats  – $955 approx. / per seat.

** You could get volume discount if you bulk procure your licenses.

Installation: 

Once you obtained license you will able to download NDepend_2018.1.1.9041.zip, is latest version available while I write this article. Extract the zip file into your local folder, you could see the different packages/executables within the package.

image

1.) NDepend.Console    – Command line program to execute NDepend analysis.  You would be mostly using this component on CI Build server Help

2.) NDepend.PowerTools –  Helps write your own static analyzer based on NDepend.API, or tweak existing open-source Power Tools. Help

image

3.) NDepend.VisualStudioExtension.Installer – To install NDepend extension as part of Visual studio

image

4.) VisualNDepend – Independent visual environment for managing your NDepend tasks.

image

Visual Tool gives you different options to choose from:

  • You can analyse a Visual Studio Solution or project.
  • Analyse .NET assemblies in a folder.

image

image

image

For the demo purpose our analysis target would be one of the starter project from github –  ContosoUniversity by @alimon808.

image

image

Demo: Summary Report

image

Demo: Application Metrics

image

Demo: Dependency Dashboard:

image

Demo: Interactive Graph

image

Demo: Code Matrix View

image

Demo: Quality Gates Summary

image

Demo: Rules Summary

image

Conclusion:

NDepend is one of the best enterprise grade commercial static analyser seen so far.  There are Visual Studio Code Analysis, FxCop and Stylecop Analyzer tools available but they do not provide extensive level of analysis reports NDepend provides. Being a commercial tool it gives value for money for customers by what they need.  In terms of a day to day developer  or devops lifecycle, you can integrate NDepend in your build process, which could be simple as executing the NDepend Console and reviewing the output. With NDepend’s API it is easy to develop your own custom analysis tools based on CQLinq and NDepend.PowerTools(which is open source). You could find all the detailed help in NDepend documentation.

References:

Blazer – The new experimental web framework from Microsoft

May 2, 2018 .NET, .NET Core, .NET Core 2.0, C#.NET, Emerging Technologies, Microsoft, Razor No comments

In this world of multiple Web frameworks Microsoft would not want to stop experimenting with new frameworks for Web development. Innovation is a key to Microsoft, doesn’t matter the start later than the React(Facebook) and Angular(Google) , but Microsoft has proven most of the times they are good in developing cutting edge frameworks.  That’s how Blazer has born.

Blazer = Browser + Razer

As a ASP.net MVC developer I always loved Razer syntax that was shipped with ASP.NET MVC 3.0. Since then Microsoft has improved the Razor framework with async/await patterns and fluent syntaxes etc.

Concept is simple, use .NET for building browser based apps. Your familiar C# and Razor syntax can add lots of improvements in the way you build browser apps as a modern day web developer.

Why use .NET?

To simplify this question, quoting an excerpt  from Microsoft ASP.NET team blog:  “Web development has improved in many ways over the years but building modern web applications still poses challenges. Using .NET in the browser offers many advantages that can help make web development easier and more productive:

  • Stable and consistent: .NET offers standard APIs, tools, and build infrastructure across all .NET platforms that are stable, feature rich, and easy to use.
  • Modern innovative languages: .NET languages like C# and F# make programming a joy and keep getting better with innovative new language features.
  • Industry leading tools: The Visual Studio product family provides a great .NET development experience on Windows, Linux, and macOS.
  • Fast and scalable: .NET has a long history of performance, reliability, and security for web development on the server. Using .NET as a full-stack solution makes it easier to build fast, reliable and secure applications.

Blazor will have all the features of a modern web framework including:

  • A component model for building composable UI
  • Routing
  • Layouts
  • Forms and validation
  • Dependency injection
  • JavaScript interop
  • Live reloading in the browser during development
  • Server-side rendering
  • Full .NET debugging both in browsers and in the IDE
  • Rich IntelliSense and tooling
  • Ability to run on older (non-WebAssembly) browsers via asm.js
  • Publishing and app size trimming

Now the usual question arises? How is that possible? Running .NET in a Browser?

It is all started with WebAssembly, a new web standard for a “portable, size- and load-time-efficient format suitable for compilation to the web.

  • WebAssembly enables fundamentally new ways to write web apps. Code compiled to WebAssembly can run in any browser at native speeds.
  • WebAssembly is the foundational framework needed to build a .NET runtime that can run in the browser.
  • No plugins or extensions required.

Getting Started with Blazer:

Latest version of blazer framework available is 0.3.0 released on 02/05/2018.

Steps to setup Blazor 0.3.0:

  1. Install the .NET Core 2.1 SDK (2.1.300-preview2-008533 or later).
  2. Install Visual Studio 2017 (15.7 Preview 5 or later) with the ASP.NET and web development workload selected.
  3. Install the latest Blazor Language Services extension from the Visual Studio Marketplace.

Install the Blazor templates using command-line:

dotnet new -i Microsoft.AspNetCore.Blazor.Templates

Additional References:

Getting Started with Azure Functions App

June 25, 2017 .NET, .NET Framework, App Service, Azure, C#.NET, Emerging Technologies, Functions App, JavaScript, Microsoft, Windows Azure Development, Windowz Azure No comments

In my previous article I gave you an overview of Azure Functions and discussed about the benefits of the Azure Functions. With this session I will cover you with necessary steps to create an initial basic functions app.

Getting Started:

Login to Azure Portal, you will see Function Apps section in the left menu. This is where all your Function Apps will be listed, once you login.

imageimage

Let us start by creating a new Function app. Type Functions

image

Select Function App from Web + Mobile category, and Click on Create Button.

Fill In details:

  1. App Name,
  2. Select Subscription
  3. Select Resource Group (new if you want to create new resource group) or select existing
  4. Select Hosting Plan
  5. Specify Storage
  6. Click on Create

imageimage

You will see deployment in progress message.

imageimage

image

Once you explore further selecting the Function App instance you will be able view the URL and left side  menu you will see the options to configure:

  1. Functions
  2. Proxies (Preview Feature)
  3. Slots (Preview Feature)

image

Getting Started – create first Function App

Now since we have new instance ready. Let us create our first Function.

We have to choose by :

1.)  Choose a scenario:

  1. Webhook + API
  2. Time
  3. Data Processing

2.)  Choose a language:

  1. JavaScript
  2. CSharp
  3. FSharp
  4. For PowerShell, Python and Batch processing, you create your own custom function

image

For the demo sake I am creating a Timer Scenario and selected CSharp as the language.

image

I created a simple trigger code  and Click on Save and Run

image

Job has completed within speculated delay we put through on the Thread.Sleep:

image

Code Sample:

 
using System;
using System.Threading;

public static void Run(TimerInfo myTimer, TraceWriter log)
{
    log.Info($"C# Timer trigger function executing at: {DateTime.Now}");

    RunTest(log);

    log.Info($"C# Timer trigger function completed at: {DateTime.Now}");
}


public static void RunTest(TraceWriter log)
{
    for(int i=0; i< 100; i++)
    {
       log.Info($"C# Timer trigger function executing at thread: {i}"); 
       
        Thread.Sleep(1000);

        log.Info($"C# Timer trigger function completed at thread: {i}"); 
    }
}

Using the Functions –> Integrate section we can configure Input, Output parameters and Schedule Timers, to make it available as a WebAPI methods. You can call this functional logic from another application to invoke as a web API call by passing necessary inputs, to start another functional process.

One example for this scenario would be to invoke a Database record archival  call after completion of an order. This is will be applicable in case we choose the scenario WebHook + API during the creation of your functional logic.

image

That’s all for now for this topic.  I will cover more details about WebHook + API in next series.

Please share your comments and rate this article to help me understand areas of improvement.

Additional Refs:

.NET Framework 4.7–Released for All versions of Windows

May 3, 2017 .NET, .NET 4.7, .NET Framework, .NET Framework 4.7, ASP.NET, ASP.NET MVC, C#.NET, Caching, Cryptography, Extensions, Microsoft, Performance, Security, Visual Studio 2013, Visual Studio 2015, Visual Studio 2017, VisualStudio, VS2012, VS2013, VS2015, WCF, Web API, Web API v2.0, Windows, Windows 10, Windows 7, Windows 8, Windows 8.1, WinForms, WPF No comments

Microsoft has released next version of .NET Framework (do not get confused with .NET Core) .  Though the .NET Framework 4.7 was released as part of Windows 10 Creators Update a month ago. You can now install the .NET Framework 4.7 on other versions of Windows

Download the: .NET Framework 4.7  – Web installer  |  Offline Installer

.NET Framework 4.7 Developer Pack  In order to add support for .NET Framework 4.7 in Visual Studio 2012 or later we need to install Developer Pack.

Windows Versions and Support:

The .NET Framework 4.7 is supported on the following Windows versions:

  • Windows 10 Creators Update (included in-box)
  • Windows 10 Anniversary Update
  • Windows 8.1
  • Windows 7 SP1

The .NET Framework 4.7 is supported on the following Windows Server versions:

  • Windows Server 2016
  • Windows Server 2012 R2
  • Windows Server 2012
  • Windows Server 2008 R2 SP1

New Features in .NET Framework 4.7:

On a high-level below are the set of new features introduced in following areas:

Core

Networking  Default operating system support for TLS protocols*

ASP.NET

  • Object Cache Extensibility  (plug in new implementations of an object cache for an ASP.NET application by using the new ICacheStoreProvider interface. )
  • Memory monitoring (Developers can now write their own memory monitors to replace the default by using the ApplicationMonitors.MemoryMonitor property.)
  • Memory Limit Reactions. (Developers can now replace or supplement the default behavior by subscribing IObserver implementations to the application’s memory monitor.

Windows Communication Foundation (WCF) 

  • Ability to configure the default message security settings to TLS 1.1 or TLS 1.2
  • Improved reliability of WCF applications and WCF serialization

Windows FormsHigh DPI support

Windows Presentation Foundation (WPF)

  • Support for a touch/stylus stack based on Windows WM_POINTER messages
  • New implementation for WPF printing APIs

Also improvements in :

  • High DPI support for Windows Forms applications on Windows 10
  • Touch support for WPF applications on Windows 10
  • Enhanced cryptography support
  • Support for C# 7 and VB 15, including ValueTuple
  • Support for .NET Standard 1.6
  • Performance and reliability improvements

 

Additional References: