News
Blazor Steals the Show in VSLive! .NET Keynote
Microsoft's Scott Hunter was on hand at the Visual Studio Live! conference in Austin on Wednesday to detail the latest updates for .NET and Visual Studio.
While Hunter touched upon the goodies coming in the bits for .NET Core, .NET Framework, .NET Standard, ASP.NET Core and more in his keynote address, it was the cutting-edge Blazor technology that stole the show.
"Blazor is something that we're working on as an internal project at Microsoft, on thinking about next-generation .NET applications," said Hunter, Partner Director Program Management, .NET, at Microsoft. "The primary premise in Blazor is that you can build client-side UI in your browser in .NET. What it means is, you don't have to know Angular or React or Vue, you don't have to know JavaScript because you're actually going to run C# in the browser. And there are some benefits to that. Those are all great frameworks, but you're going to find in the JavaScript world these frameworks move at a very fast pace."
While JavaScript developers might have to rapidly move from an Angular 1 app to an Angular 4 app, for example, Hunter emphasized the stability of .NET and C#. He also noted that "one cool part" of the Blazor-based .NET technology is that it runs in all browsers. "It'll run on every popular browser," he said, ticking off Safari, Chrome, Edge, IE 11, Firefox and mobile browsers.
"You get native performance with Blazor, so inside of these apps you're not running an interpreter that interprets .NET. We're going to run native .NET in there at full speed."
Scott Hunter, Partner Director Program Management, .NET, Microsoft
"You get native performance, so inside of these apps you're not running an interpreter that interprets .NET. We're going to run native .NET in there at full speed, and you can actually have strong types and share, you can actually have C# classes that you share across the client and the server." Hunter emphasized that using Blazor requires no browser plug-ins or other extras. "You just run the app and it runs." Blazor uses the new-age WebAssembly, an Internet standard that all the browsers support, he said.
In a live demo, Hunter showed how easy it was to get started with Blazor in just a few minutes, constructing a fully functional ToDo app, the standard mechanism for showing off new technology in tutorials.
"We were all blown away," by Blazor in a demo a couple months ago, he recalled. "Let's just run the app, and I'll show you something pretty crazy here." That involved creating a Single Page Application (SPA) project that didn't need page refreshing, but without the need to rely upon JavaScript, while "linking away" parts of .NET that weren't needed for the app to make it smaller.
"You notice when I do a build, you see this stuff that says delete assembly? That's where we're actually linking out the parts of .NET you don't need. So the goal here is not to ship any more .NET into the app than necessary."
Examining the app in a Chrome process, he said, "I've got some weird stuff that's going to happen here. How many times, when you run an app, do you see things like MSCorLib, .NET Standard, System.dll, load in your application? We're actually running .NET inside of my Chrome process here."
While WebAssembly readily accommodates C#, it's not limited to that programming language.
"We really think that this going to be awesome and revolutionize the way that this tech works," Hunter said. ".NET is not going to be the only thing you see in WebAssembly, you're going to see a variety of other techs here as well. I think the Go guys are working on it. I think you're going to find you're going to be able to write any language you want inside the browser, but you get the benefits of easy install, no plug-ins, it's all sandboxed in the browser, so it's kind of an improvement over what we did back in the days of Silverlight and Flash and stuff like that. So that's Blazor."
Upon completing the demo, Hunter concluded: "So this is basically running JavaScript, running .NET, in the client, and in the server, at the same time. This is Blazor! Is this interesting, people?" And with that, Hunter earned the biggest applause of the presentation from the packed audience.
Before the Blazor presentation, Hunter outlined the flexibility of the .NET ecosystem that facilitates projects such as Blazor.
"We try to make .NET something you can build any application you want on it."
He noted .NET can be used to build Windows desktop apps, Web apps on Windows Linux, Unix or Mac, cloud apps, especially the Azure cloud, Xamarin iOS and Android, Mac apps and even Unity, noting that "Pokémon GO is actually a .NET game. A lot of folks don't recognize that. We don't actually tout that very often."
Microsoft, he said, is working to infuse more cutting-edge capabilities into .NET, such as the latest Internet of Things (IoT) and artificial intelligence (AI) technologies.
Noting that the company has created "a lot of .NETs," Hunter introduced .NET Standard, an effort to apply some order to using different .NET implementations, which in the past have included .NET Compact Framework, Silverlight and so on. "This mantra we've been going over the last year or two is how do we make all of the .NETs kind of consistent. In fact one of our goals is to unify more and more .NETs." Promising more info to come at next week's Build conference, Hunter said, "We introduced something called .NET Standard last year, or two years ago, and a big version of it shipped last year, and it basically brings a bunch of the APIs and makes the APIs consistent across all the .NETs. That's a big push we're trying to do. Make them consistent across all platforms."
And of course, .NET Core, the cross-platform, general-purpose approach to .NET, was a big part of Hunter's presentation.
".NET Core is dear to my heart, something I work on quite a bit," he said. The company released the first tooling for .NET Core in March of last year, so while it may have hit Release to Manufacturing earlier, he didn't think it was really RTMed until Microsoft shipped that tooling in Visual Studio.
Stats show that .NET Core has some 500,000 "multi-day engaged developers" in the first year of its usage. Actually, Hunter said, there are around 1 million developers engaged in some capacity, but half a million are "really engaged" developers, "so we're really happy about that."
With .NET Core 2.1 shipping as RTM on Monday, Hunter praised its performance enhancements, which put it above Java in benchmarking rankings, making the top five in all areas of measurement, including data, plain text, Web and JSON processing. "And when I say top five, anything that's above us is something you've never heard of, because it's just somebody writing for a benchmark," he said.
Hunter detailed a plethora of improvements to .NET Core, including span<T>, the Windows Compatibility Pack, microservices, and of, course, AI.
"AI is going to be a big push." he said, "we talk about it at Build this year. We're building AI types into .NET. We built Tensor<T>, if you've heard of TensorFlow." That provides a multi-dimensional array into .NET, he said, so all .NET AI libraries will be able to share the same types.
Span<T>, meanwhile, is used inside of Kestrel -- the cross-platform Web server for ASP.NET Core -- so it consumes less memory, making it perform faster.
The NuGet package called the Windows Compatibility Pack will be RTMed with .NET Core 2.1, said Hunter, who noted "it brings a bunch of namespaces that customers said they wanted" such as System.DirectoryServices and System.Drawing, along with a rewrite of System.Net.Sockets that provides a brand-new implementation that helped bring a 15 percent performance improvement to ASP.NET Core, all being baked into .NET Core 2.1.
Hunter also described .NET Core Global Tools, which allow developers to build .NET apps and stick them into NuGet so others can install them right from NuGet, similar to the npm install -g feature that Node has. You can read more about them in this blog
post announcing the .NET Core 2.1 preview 1.
Other features highlighted by Hunter include:
- SignalR coming to ASP.NET Core for the first time.
- A fuller HTTPS developer experience
- HTTPClient Factory, described by Hunter as "probably my favorite feature in ASP.NET Core 2.1" that really helps with writing networking code. It customizes the experience of making calls to endpoints and catching exceptions, among other things.
- A native module for running ASP.NET Core behind IIS, making performance six times faster.
- Support for areas in Razor Pages, along with putting Razor UI into a NuGet package.
- A new version of Entity Framework Core, which is starting to get support for non-relational databases. "We're going to make it where, as a .NET customer, if you want to get the performance of having a non-relational database, and a lot of things like scoreboards and stuff, where you're not doing a lot of relations in them, are actually faster and cheaper in a non-relational database, we're building direct support for that into .NET." While starting with Azure Cosmos DB and MongoDB, more options might be in the works. "Once again we try to make .NET work everywhere and be awesome everywhere," Hunter said.
- Easier debugging with Azure Application Insights Snapshot Collector, along with the Microsoft.ApplicationInsights.SnapshotCollector 1.2.1 available as a NuGet package.
- A hardware demo with a Raspberry Pi, which led Hunter to describe work the team has done with ARM 32 and ARM 64, for the company's Azure IoT team and Samsung. "If you have a Samsung TV that was built this year, a 2018 Samsung television, it runs .NET Core. Not only does it run .NET Core, but when you see the menus on the homescreen of your television set, that's actually a Xamarin.Forms app, running on .NET Core, on your Samsung TV. All the apps in the Samsung TV world are .NET Core applications. So you've actually taken this ARM version of .NET Core and put it into their products."
Hunter created a .NET core app that booted up on the Raspberry Pi, which runs Linux ARM. ".NET Core running on a Raspberry Pi!," he exclaimed. "So .NET Core runs everywhere. This works today." That generated more audience applause.
- Improvements coming to .NET Framework, which was just released in 4.7.2. One problem with new versions, Hunter said, is "it breaks peoples' apps." So customers have asked for side-by-side .NET versions or shipping .NET with an app. Hunter noted that his Raspberry Pi demo involved shipping .NET Core in the app. The company is also addressing customer concerns for more flexibility with .NET Framework. For example, "People want to have the ability to use the latest media player or browser controls in WinForms and WPF."
Hunter skipped through several other improvements, including faster test discovery in unit testing, linker tools (which weed out parts of .NET not needed) coming to .NET Framework and .NET Core, the coming ability to build native .exes for WinForms, WPF or ASP.NET Core, containing everything developers need in a single .exe, and more.
Hunter noted that .NET Core 2.1 will ship as a Release Candidate on Monday, and promised the company would reveal more new features and plans for .NET Framework, .NET Standard, Blazor and so on at next week's Build conference.
The next Visual Studio Live! events are Visual Studio Live! Boston from June 10-14 and Visual Studio Live! Redmond at Microsoft Headquarters from August 13-17.
About the Author
David Ramel is an editor and writer at Converge 360.