Microsoft .NET 2.0

Microsoft today announced the release of the open-source .NET Core 2.0, with improved performance, 20,000 more APIs from the .NET Framework world, better cloud debugging and live unit testing.

.NET Core is one of the platforms Microsoft developers can use to create cross-platform applications; Core is best-suited for microservices and container architectures, according to Scott Hunter, Microsoft’s .NET director of program management.

Hunter explained that .NET Core, Xamarin, UWP and the .NET Framework platforms all have different subsets of APIs, which has made sharing code between applications on those platforms difficult. “If you’re a .NET Framework customer and you’re using file APIs and then you move to Universal Windows applications, those APIs didn’t exist. We need to make all our dot-nets come together under a common umbrella.”

So today, Microsoft announced the official release of .NET Standard 2.0, which Hunter described as “a spec like HTML5” that is a set of all the APIs that can run on all the different platforms. It contains all the intrinsics, Hunter said, adding that .NET Framework, .NET Core, UWP  and Xamarin all must implement .NET Standard 2.0. “This makes it easy to share code between a .NET Core app and a Xamarin app,” Hunter said. “The ability to do code reuse became much easier.”

Among the platforms .NET Standard 2.0 and its 40,000 APIs support are .NET Framework 4.6.1, .NET Core 2.0, and Xamarin for iOS, Mac and Android. Support for UWP is in the works and is expected to ship later this year, Microsoft’s Immo Landwerth, program manager on the .NET team, wrote in a blog post Wednesday announcing that .NET Standard 2.0 was final.

.NET Core 2.0 is required to build NuGet packages; Visual Studio 2017 15.3 is required to author .NET Standard 2.0 libraries. Also, the latest version of Visual Studio for Mac, 7.1, supports building .NET Standard libraries, Landwerth wrote.

In web benchmarks, .NET Core 2.0 is 20 percent faster than the previous version, Hunter said, crediting the open-source community for contributing many of the performance fixes.

In .the NET Core 2.0 wave, cloud debugging has been improved, according to Hunter. Today, developers use a logging framework to log errors. “The problem with that logging frameworks is that if it’s not aware of Azure, when you post your app up to Azure, Azure’s portal won’t be able to show you the logs.

“We changed .NET Core 2 where it can be aware of where it’s running at, let’s say the cloud, and the cloud can be aware of it,” he continued. “When you publish your .NET Core 2 application up to Azure, things like diagnostic logs, they just go to the right places automatically. All the diagnostic stuff just works without writing code as you Azure-fy your application.”

When your application is published to Azure, he said, a bar in the portal enables enhanced diagnostics. “We inject a profiler and better crash analytics into the app,” he explained. The profiler watches the app. If it crashes on the same method 100 times, for example, the app is frozen and a ‘cloud snapshot’ is taken that can be downloaded from the portal to Visual Studio running in a local machine, so you can debug the application without breaking it from running in the cloud, he said.

In March, the capability to do live unit testing was added to Visual Studio for .NET Framework customers. Today, the feature is supported in .NET Core 2.0. This capability tells developers which code has unit tests written for it, and which code doesn’t. Live unit testing can tell if the code is covered, and what’s passing and failing live in the IDE while typing code. Further, it can identify how changes to source code impact tests. “Let’s say I’ve got 8,000 tests. You don’t want to run all 8,000 tests when you change one line of source code. It actually identifies only the tests that are impacted by the code you change. And we can do that live. Maybe the one line of code you change affects only three tests. We rerun those test only.”

Finally, first-class support has been added in .NET Core 2.0 for Angular JS and React, Hunter said. “.NET Core has reinvigorated the developer community,” he said. “We’ve seen a revival of .NET since the open-sourcing of Core.”