Discount for my course: High Performance Coding with .NET Core and C#

Gergely Kalapos


Build 2017 Day 1

Posted on May 10, 2017



The first day of Build 2017 just finished and I thought it would make sense to create a short summary post about it.

There were many announcements on different topics, this post is not a full cover on all of them, this is rather a summary about things I found interesting.

.NET Standard 2.0 - .NET Core 2.0

2.0 is all about bringing over EVERY .NET API to Core. The number of APIs defined in .NET Standard 2.0 is much higher than in 1.x. The reason for this is that in 1.x it was very hard to port an existing app to Core and it was even impossible to reuse a let's say .NET classic 2.0 NuGet library. .NET Core 2.0 implements .NET Standard 2.0, which has many more APIs and a Compatibility Shim, so if you have an existing .NET Classic library with very high probability you will be able to reuse it on .NET Core 2.0 (WebForms, WinForms, WCF and stuff like that won't work, ~everything else will work..) .NET Core 2.0 is currently preview and can be downloaded here

ASP.NET Core 2.0

ASP.NET Core 2.0 also takes advantage of .NET Standard 2.0, so everything about "old" full framework code applies here. There are some perf. improvements and now there is one single meta-package, which you can reference and you will have everything needed to run a web application (no more errors because of different Microsoft.AspNetCore and Microsoft.AspNetCore.Mvc versions and stuff like that). Since this is just a metapackage you can still reference the packages directly, so this is just a nice thing but not mandatory (the default is the meta-package). There are also some other nice improvements, like Live Unit testing (which did not work for asp.net core 1.x). The official announcement summarizes everything here.

Another cool thing coming later is Razor pages: if you need a small website you can do it now in a single file. All this is within ASP.NET Core... you still have your middlewares and everything, so you can very easily extend your app later, but if you need a very simple web app you can do it in a single file without creating a view+viewmodel+model. Here are some samples

Azure

There is now an integrated terminal in the Azure portal. There is also an Azure iOS app, which also includes this terminal. As Scott Hanselman said: ~"you can now SSH into a production machine during every family event from your mobile phone."


A globally-distributed, multi-model database named Cosmos DB was introduced.

You can now also have PostgreSQL and MySQL databases in Azure.

Here is a summary on this.

Visual Studio

Visual Studio for Mac became GA. This product was announced 1 year ago, and back than it was a rebranding of Xamarin Studio. Today thanks to the architecture there is more code sharing between VS, VS Code, and VS for mac, so for example the debugging stuff and Roslyn is shared across all IDEs. It also supports backend development very well (...so asp.net core) and you can even debug within Visual Studio for mac a complete client-server architecture (let's say Xamarin iOS frontend calling an ASP.NET Core 2.0 Web API). It also supports Docker.

Diagnostics

This can be separated into two parts: Application Insights and Visual studio snapshot debugging

Visual Studio Snapshot debugging

Now this was the highlight for me! Imo this is incredible: you can take a production server, create a 'snapshot', without causing any delay or stop in the application (this is all safe!) and then open this snapshot in Visual Studio and then you can use it like when you debug the application on your machine. You have all your variables, you can look into your objects, you can use the Locals window. Similar to conditional breakpoints you can also set 'conditional snapshots', which will be only created for defined scenarios (let's say only when a string has a specific value). This way you can basically safely debug in production environment.

What you see on the picture is not a simple local debugging session! It is a snapshot from production.

Application Insights

Application insights has two levels of diagnostics: the first one is the one which delivers the application map with all the dependency and error tracking and then the other one is the Profiler, which you can additionally enable. The profiler helps you see what your code is doing over time. It captures 2minute/hours samples (for all requests) and what you get is similar to a CPU sample, which shows you where the CPU spends time on your code and with this information you can optimize your code. From today this is GA for .NET Framework 4.6 and .NET Core on Windows and is Preview for VMs, Service Fabric, and Cloud Services.


;