Keynote by Scott Hunter at C# Corner .NET Conference 2022
24K views
Nov 6, 2023
Keynote by Scott Hunter at C# Corner .NET Conference 2022
View Video Transcript
0:00
I'm kind of here to talk about what's new in .NET 6
0:02
You know, we just shipped .NET 6 the first week of November, so just a little over, you know, a month and a half ago or so
0:10
And as everybody said, I'm Scott Hunter. I'm the VP Director of PM at Microsoft in the developer division
0:17
You can follow me at CoolCSH on Twitter. But let's jump right on in
0:22
You know, one of my goals when I started working on .NET years ago was we wanted to unify the platform
0:27
And, you know, over the years, there have been many flavors of .NET, whether there was .NET Framework
0:32
We introduced something called .NET Core that I was a big part of. We acquired Xamarin, which brought in the mobile capabilities
0:41
And we've really been trying to unify the platform back to a single platform again
0:46
We're there again with .NET 6. With a single .NET 6, you can build cloud, web, desktop, mobile games with Unity, IoT, and AI, all on .NET 6, all using the same base class libraries, all using the same set of tools
1:04
You can look over there. We've got Visual Studio, Visual Studio for Mac, Visual Studio Code
1:09
We have full support from CLI. We have a huge ecosystem with NuGet packages, GitHub, and component vendors
1:18
And so we're back to having a full .NET again with .NET 6
1:24
People always ask, we've been around for a long time, and how is .NET doing
1:31
And we're doing great. We have over 5.4 million developers using .NET inside the Visual Studio family of tools
1:41
We've been growing crazily over the years. We've been the number one most loved framework on the Stack Overflow Developer Survey for 2019, 2020, and 2021
1:52
And think about that. This is .NET's, the 20th anniversary of .NET's going to happen on February 14th
1:57
So we're just a little, you know, under a month from being 20 years old
2:01
And we're most loved again. And I'm super excited about the Cloud Native Computing Foundation has a chart they build that shows the highest velocity OSS projects
2:15
And .NET is consistently actually more than just in the top 30
2:18
We're actually normally in the top five. We were number one for a bit during .NET 6 development
2:24
But as we kind of finished, things kind of slowed down. And so we fell a few spots
2:28
And that means that the open source thing is working for us. .NET 6, over 6.9,000 community contributors with over 21,000 contributions
2:42
And so, you know, I have to thank the open source world for helping us. It's an amazing journey to think that we were not even open sourced until 2014
2:51
And since then, the results have been spectacular. You know, if I go and look at this slide, this is the Tech Empower benchmark
2:58
This is the open source benchmark that looks at different languages and the performance of them
3:05
And you can see compared to Java at 2.1 million, we're doing 7 million requests a second
3:11
Node.js is doing 0.66 million requests per second. A lot of the contributions that make this benchmark possible came from the community
3:21
.NET 6 took a huge performance improvement in NDD Framework Core. That's our database stack built in the tech. And you can see it's almost doubled from 161,000 requests per second to 311,000 requests per second
3:35
So, you know, huge performance improvements on the data side in .NET 6
3:41
And so, you know, pretty much every time you rev to a new .NET, you're going to see some huge performance improvements
3:47
What was our primary goals in .NET 6? One was unified base class libraries and SDK
3:54
What I mean by that is for the first time since .NET Framework, any application that you build in .NET 6 uses the same BCL
4:03
It used to be that the mobile applications used the mono BCL. At one point, Blazor applications did as well, but now everything is using the exact same BCL
4:12
That means consistency across all the projects, and we have a single SDK. If you're building mobile apps, you use the exact same SDK
4:19
I just showed you on the previous slide industry-leading performance. We have amazing performance in .NET
4:24
That's our mantra. Come to .NET and your app's going to run faster than better and better than ever could before
4:30
You know, we have some of the best developer tools. And with .NET 6, we've made .NET 6 way more approachable
4:36
And you're going to see that with the C Sharp 10 and F Sharp 6 releases that are part of .NET 6
4:41
We added support for Apple M1 in this release as well. And you're going to see later this year, we have a new release of Visual Studio for Mac that is actually built on top of .NET 6
4:52
We're building the IDE on top of .NET 6, which means it'll have native support for Apple Silicon as well
4:58
And this is a long-term support release, so you've got three years of support here. Obviously, the same time we released .NET 6, we also released a revised Visual Studio 2022
5:10
And it brought some pretty cool things as well. It's built 64-bit now, so you can load huge projects
5:17
It's faster than it's ever been before. and the most exciting parts for me is Hot Reload
5:23
which I'm going to show in a little bit, is built all the way through Visual Studio 2022
5:28
And this is going to let you be more productive with your applications
5:34
We also released something we call the .NET Upgrade Assistant. So, you know, maybe if you've been watching
5:40
the .NET Core over the years, which became .NET 5 and .NET 6
5:44
and you've got some older projects and you want to actually move them to the newer tech
5:48
This is a tool you can actually download and run, and it will help you port your application to .NET 6
5:54
It will convert the project file to the newer style project file
5:58
It'll go take all your NuGet references, or actually all your references to .NET and change them automatically for you as well
6:05
It'll go fix some common NuGet packages for you as well. It'll add some NuGet packages to make compatibility easier
6:12
It supports multiple projects, C-sharp and VB, built around .NET 6. And so it primarily is focused on if you have a WinForm app, a WPF app, an MVC, a Web API application, or a console application or a library, this tool will help you move those applications forward
6:33
And simplified development. This is a big deal for us. You know, while .NET and any compiled language, whether it's C-sharp, whether it's C++, whether it's Java, you know, most compiled languages are going to be faster than interpreted languages
6:49
And so they're faster at runtime, but they're slower for a developer. You know, your typical, we call this interloop in Microsoft
6:56
You have some code on the screen. You run it. You don't like the results
7:00
You go back to the editor and you go change something and you run it again with .NET 6
7:06
and VS 2022, we have hot reload. This means you can make a change in your code
7:12
and you don't have to restart the running application. And I'll demo this quite a bit today
7:16
And it actually even works, it goes back all the way even to .NET Framework 4.6
7:21
and above as well. But you're gonna see us optimize, continue to optimize this moving forward on 7 8 and so on We done a lot of work in C Sharp to make C Sharp a lot better You know you probably if you a long customer
7:36
you're used to seeing at the front of every file, there's at least a using system
7:41
Like, why? If it's everywhere, don't make it everywhere. So we have now support for global usings
7:46
where you can take all the usings you don't want to copy into all your apps
7:50
and put them into a file, and we can use those. We have FileScope namespaces
7:56
Normally a C Sharp file, the first thing you do is have a namespace at the top and all your code's indented to the side
8:01
You don't have to do that anymore. We introduced something called Records in C Sharp 9, which lets you actually build a full class without all the getters and setters in a single line of code
8:11
We now support structs with that as well. And I can't undermine, I don't have a great demo of how complicated this was before
8:18
But down here, you can see that var parse string, this Lambda here
8:25
Normally, you would have to wrap that Lambda in a typecast of func string in it
8:30
And we made the compiler smart enough that that's all taken care of for you now
8:34
And it makes some of the API work we've done in .NET 6 much easier
8:39
And this is an example of an API in .NET 6. If you're used to a web API project, it has controller folders
8:47
It's got a program.cs, startup.cs. You can see now you can write an API in .NET and literally three lines of code
8:56
We came this direction because we actually went and interviewed a bunch of Python developers and Node developers and asked them to think about, you know, how does .NET compare
9:05
And they're like, wow, it takes so much code to get .NET going. And so we thought about this a lot and did a lot of work in .NET 6 to make .NET way more approachable
9:13
You'll notice here there's no main. There's no usings. There's nothing. These three lines of code actually can run and run an API for you
9:25
Okay. So I've got a bunch of demos I'm going to do here
9:30
And so let's get this kicked off. So let's go into VS
9:35
And first off, I'll start from the CLI. So I said simplified development
9:41
And so if I even do a .NET new, you're going to notice how much this is
9:47
There's only a few things here now. There's ASP.NET app, a Blazor app, a class library, a console app, a WinForms project, a WPF project
9:56
Once again, this is meant to make .NET more approachable for everybody. Of course, I can always go and say, show me everything
10:03
But you can imagine if you're new to .NET, that's too complicated
10:06
This is not too complicated. This is a thing we've done throughout the entire product
10:12
So let's go and launch Visual Studio. And I'm going to build a new project and I'm going to show hot reload
10:20
It's one of my favorite features. So let's build a console application
10:25
And sure, console app three sounds good to me. Name doesn't matter
10:31
We'll do .NET 6. And the first thing that you're going to see here is when the project opens, there's a lot less code than you ever have seen before
10:41
Look at this. There's nothing but console, right line, hello world. There is no main. There are no usings. There's nothing. You don't need anything anymore
10:52
You can just start writing code. We want you to get going as fast as possible in .NET
10:56
Now, let's talk about hot reload. and let me build a simple let's do this public class tills and i'm going to write a method
11:08
inside of utils we'll do a public static void we'll call this output pid what i'm going to do
11:20
is i'm going to output the process id for this running process we'll do a right line and what
11:27
What I'll do here is I'll put a dollar sign here because I'm gonna use a new C-sharp feature that we've had added a while ago
11:32
It lets me put variables right in the middle of the, hello folks
11:39
And what I wanna do here is I wanna actually show you the process ID so I can show when I'm doing this
11:48
that nothing is restarting. That's kind of fancy. Full completion there to the end
11:58
That looks good. Let's just test this real quick. I'll go up here and I will write utils.pid
12:09
There we go. Let's just run this. If it does what I want
12:15
it'll put a process ID 21828, perfect. Now, what I wanna do now is I'm gonna wrap that
12:22
in a while true. We got the code, stick the code in there
12:32
This is where C-sharp 10 and .NET 6 gets really exciting. So what this is going to do, and you know what I should do is I should probably come
12:39
down here, make this not go too fast. There we go. What this app's going to do is it's going to sit in a loop and write output out to the
12:51
screen with the process ID. Run it. Kind of boring. Let's put that over there. Put VS over here
13:09
And I'll hide this. And all I'm going to do here is I'm going to go and change the code
13:13
So let's go and change this code from hello folks to hello conference
13:18
I'm going to save the file. Notice over here on the screen, the app just updated. The process
13:28
ID stayed exactly the same and the app just updated. So whether it's a WinForm, WPF
13:36
ASP.NET, Blazor, Console, you can now just go in here and And again, it updates instantaneously
13:48
And so we think this is going to save you tons and tons and tons of time as a developer
13:53
because it's that easy. So let's talk about another type of simplified application that we have as well
14:01
So I'm going to do a new project again. And let's do a web API this time
14:09
And sure, name doesn't matter. And there's a new option here. Use controllers, uncheck to use minimal APIs
14:22
So we've always had the notion of being able to use controllers, but now I can uncheck this
14:30
I'll create the application. And now we're gonna see how that console application
14:34
was so simple. Now we're gonna see a web API that is just as simple
14:41
Here you go. You can see that I've got a, I create a builder. I set up the API
14:47
Explorer. This is so I can actually use one of our tools to actually use the API. I
14:54
want Swagger I going to set up my Swagger UI And the whole API fits in literally a 43 file
15:06
There's a map get. This defines the URL to call, weather forecast
15:11
It runs a loop of code and returns the API. And so now you can build these APIs in single files if you wish to
15:17
And I know that if you're building a ton of APIs, yeah, you should be using controllers
15:21
But in many cases, you're building microservices. you have an API here or there. This is a much cleaner, much simpler way of doing that
15:29
Now let's go off and show a real world application. I've got a real world app here
15:35
Let's go and bring up this. This is a podcast application. And let's bring the Solution Explorer up over here
15:53
Okay. Here's the podcast server. And so I want to show a few things here is once again, this is a pretty simplified API using the same stuff you just saw before
16:09
It's got the create builder. I do have some controllers and stuff as well
16:14
So I added controllers. This is showing you can mix and match the new style and the old styles
16:18
actually I even opened the wrong file. Go back and try this again
16:28
This is what I want to load. But still that this that file does show you that you can actually do the model
16:38
where you have both the newer and the older style at the same time, which is one of our goals
16:43
Okay, here's what I wanted. Here's the podcast API. So I'm gonna, we have a podcast app
16:47
blazer-based application and i'll show you where you can find the source code for all of this stuff
16:52
um after we're done today and here is my app again and i did make one mistake here and let me let me fix my one mistake
17:11
got ahead of myself here oops I did not put the demo all the way back to its initial self
17:31
There we go. There we go. Let's make sure everything builds and we're good. Okay
17:42
So this is an API and as I mentioned before, you can see it's got my builder just like
17:47
I need database. So I went and grabbed my dependency injection for my SQL database
17:53
I've got a connection to an API here. It's got my swagger
17:59
But the API itself is all written right here. Map get, v1 categories, map get
18:07
Each map get gives kind of the URL that you would expect. Now, as I said, this is a real API
18:10
All the things you would expect in a regular ASP.NET web API are going to work here
18:17
here in this project. Come on, don't be a pain in my butt
18:38
That's all correct. Well, that's going to be grumpy with me today
18:54
That's fine. We can work around grumpiness. So while we're looking here, if I'd launched that, what would have happened is you would
19:01
have seen the typical swagger definition. You would have seen a page where I could have tested and run my API right there in the IDE
19:10
which is fine. But I want to show a bunch of other cool things here as well
19:16
So first thing I want to do, let's say I want to add an API
19:21
In this world, adding an API is as simple as doing something like app.mapget
19:28
And in my case, I want to add a way of getting all the episodes
19:34
So I say episodes. That is what I want to call here
19:39
Now I want this to be async. So I'll say async. Very, very simple
19:43
and then I'm going to need my episodes all live inside of the database
19:49
And so I need to get my entity framework core DB context
19:54
So I'll grab my DB context. We'll call that DB. And now I've got that
20:00
I'm going to call my Lambda right there. And I would just say await
20:09
I can do DB dot episodes. dot to list async
20:21
Once again, we're async. And as simple as that, I've added a new API
20:30
Take that out of there. It added a new API to this
20:34
Now, I did mention typecasting. So let's go take this first thing here
20:40
I want to show you the cool work we're doing in C-sharp 10 to make this much, much easier
20:46
So I'm going to say var lambda. And in this case, I'm going to grab the lambda right here
20:53
And I'm going to stick it here. This lets me actually show you some of the IntelliSense a little better
20:57
I'll put a semicolon down here. And for fun, I can do that
21:33
Oh, it's complaining I don't have a semicolon. There we go. And really, I did this because I wanted to highlight this
21:44
Notice that when I look at this, you can see the magic the compiler is actually doing here
21:50
Notice it says, funk of podcast DB context, task of list, category DTO
21:58
You normally would have had to type all of that stuff out. You would have typed the full funk and all this kind of stuff
22:03
But in C-sharp 10, I can literally just write the lambda and we do all the typecasting and stuff for you automatically
22:11
If I look at the map get down here, you see it takes a string and a delegate
22:15
That's it. I don't have to do all that typecasting. I can put the string and my code and not have a ton of overloads for this
22:23
So now let show some of the other features that we really made to make these apps much much cleaner Notice here at the top of the file it got all those typical usings that you would you would see in a regular dotnet project We have a new feature called global usings which
22:40
lets you take all of these usings and say if I'm going to put all these in all my files
22:45
well I could just I wanted to be able to define some place that I don't want to do that so I can
22:49
take all these let's grab them. The name of the file is irrelevant I have mine called global usings
22:55
but you can call it whatever you want. So I'm gonna put all those over here
22:59
And then what I'm gonna do is I'm gonna put the word global in front of each of these
23:04
And so anywhere in a project, you can go and create your own list of global usings
23:19
Now I can go back to my program.cs and I can just wipe all this stuff out
23:25
I save everywhere. And the application will continue to build and run just like it did before
23:33
Now I don't have to put those usings in all my files. And so we think this is a huge feature that's going to help you a ton as you move forward
23:41
You take the stuff that you put in all your files, put it into a single file, you're done
23:46
Now we took this to another level as well. You might have noticed here that I'm doing ASP.NET here
23:51
And if I look at this web application, notice that that is in the Microsoft.asp.net core namespace
23:59
And you might ask, well, where's the using for that? Well, I don't need those anymore
24:04
If I come over here and I open the CSproj file up, you're going to see this line of code right here that says implicit usings
24:14
And what implicit usings does is we have gone and said for a WinForm project, a WPF project, an ASP.NET project, we're going to automatically put in some of those global usings for you for the framework
24:27
Now, you might not, maybe you like it the old way. I don't. I could always come here and turn this off if I wanted to
24:36
I could disable. And we put this in the final because we wanted to make sure older projects were not broken
24:42
and so if you create a new project this will be on by default but older projects will not have it
24:46
if i turn that and disable that and i go back to program.cs now you're going to see web application
24:52
has a um a squiggle under it and you know if i had done uh an alt enter it suggests i put that
25:01
that using back in the project to make it work um but you know i'm going to say yeah i don't
25:07
don't need to do that we'll just go back and put this back to enable and in a
25:13
second this will update yep there it goes and everything is very very happy
25:18
again I want to do one more of these to show one more cool feature that we have
25:23
in C-sharp 10 and what I can do is I can go find what do I want to find
25:37
Let's go look at something like this
25:51
And these are my objects. These are the objects that play here
25:58
And I kind of screwed this demo up as well a little bit, but I will show you
26:01
Notice something different about this file. namespace podcast.infrastructure.data.models, semi-colon. Normally what you would expect in one of these files
26:12
is something more like this. Most C-sharp files by default
26:23
would be right today have a namespace that automatically moves all your code over to the right
26:28
every single time. Well, as I just showed in .NET 6, You don't have to do that anymore
26:36
You can actually put a semicolon at the end of a namespace and all of your code snaps right to the side like this
26:45
Super, super clean. Super cool. Okay. So that is showing you how to build a minimal API and showing a ton of the C Sharp features that we have in .NET 6
26:59
So let's jump in here. and let's talk about cloud development. Let me do one more
27:08
Let me do Blazor first. Let's do a couple more announcements real quick
27:22
There's these classic applications, you know, in-tier. This is what we've been building forever
27:26
Front-end, back-end, data. and the way you scale these is you just throw more hardware at them
27:33
We're moving this new world with containers and microservices where you can see I can run multiples of all these things
27:39
and I can scale each of the areas independently of each other. And it's important for us to make sure that .NET is awesome for building microservices
27:47
So a lot of the things you see in .NET 6 and our tooling is built around that
27:53
We run .NET at scale at Microsoft. If you're on the Azure Active Directory gateway
28:00
this is what runs AAD inside of Azure and for many Microsoft customers
28:04
That's running on .NET 6. The app service, in front of app service
28:08
there's a gateway, which I'll talk about in a second. It runs on .NET. Bing runs on .NET
28:13
The Dynamics 365 gateway runs on .NET. A lot more runs on .NET and Microsoft
28:18
but this is an example of things that run at mega scale, like the Azure Active Directory gateway
28:21
takes like a billion requests per second running on .NET 6. I mentioned gateways before
28:28
So we have an open source project called YARP. This is a reverse proxy built on .NET 6
28:34
which gives you cloud scale performance. You can see here over 100 billion requests per month
28:39
7.5 petabytes transferred a month. This is from Dynamics. And what you can see here is we're basically giving cloud scale performance
28:47
It's highly extensible and customizable. It's built on .NET Core 3.1 and 5 and 6, open source
28:52
and we're using it for Azure App Service, Dynamics 365. So if you're looking for a reverse proxy
28:58
we built this as a way of making .NET faster. It gives us a great way to work on the product
29:05
.NET 6, one of our big goals, shipping .NET 6 in November was to have it available
29:09
in all the places in Azure day zero. And so you can see we have App Service
29:14
we have Azure Static Web Apps, Azure Functions, all support .NET 6
29:19
Today, they were both on Windows and Linux. It was there day zero, super important and critical to us
29:27
New thing, Azure Container Apps. This is a new way of building and hosting your apps
29:34
Maybe you want to build containerized applications. You want to run them on Kubernetes, but you're not a Kubernetes expert
29:39
Well, with Azure Container Apps, you can just build your .NET applications just like you do today
29:45
You can right-click on them, turn them into containers, publish them to Azure
29:48
they're actually running on kubernetes but you don't have to see all the all the all the nuts
29:52
and bolts of that um and so super excited about it it's built on a bunch of open source tech
29:57
um and so uh uh Awesome feature. And we added in VS
30:05
If you're on the current preview release of VS 2022, we have support for publishing APIs and web applications to container apps
30:15
So let's talk about skip this because I actually put this into the actual Blazor app
30:22
We're going to jump and talk about clients. I know there's a whole bunch of Blazor being talked about this week at this conference
30:27
but let's do Blazor real, real quick. We have two forms of Blazor
30:32
We have Blazor server, and this gives you access to the full .NET
30:37
You basically, this is where the application is still running on the server, but the app is still a SPA application
30:43
It's a modern SPA application, does not require Angular, React, or Vue
30:48
but every time you make a request, it actually goes to the server
30:52
The server recomputes what the screen looks like, sends the Delta back to the client. Cool thing about Blazor server is you can use all of .NET because it's running on the server
31:00
You have access to everything. It's really, really fast. It has a very small amount of code that runs on the client
31:06
So it's very, very lightweight. And it's my preferred Blazor in some cases
31:13
We have Blazor WebAssembly. This is a version of Blazor where we run the entire application in the browser
31:20
So you might be going, what? Yeah, we actually take the .NET code, compile it into what we call WebAssembly
31:27
That's a form of code that can run inside of any browser. And so your website ends up being a static website
31:35
All the code runs in the browser. Because of that, it means the app can be disconnected, can run fully offline because there doesn't have to be a server there
31:44
It's a little bit larger on the download because we have to bring the .NET runtime and your code down to it
31:51
And you might have a little slower performance, even though we have some new features in .NET 6 that make the perf go up quite a bit
31:59
As you can see here, with .NET 6, we have a new feature called WebAssembly Ahead-of-Time Compile
32:03
We can compile the app ahead of time to native WebAssembly. This means your compile is going to be longer, but it means the app is going to run a lot faster
32:12
We've shrunk the size of a Blazor application that runs WebAssembly down quite a bit
32:18
We can now optimize the runtime to only have the bits that you actually need
32:23
And we've added Blazor state performance during pre-rendering. Pre-rendering is a way, you know, all of a sudden these spawn applications
32:31
and they frustrate me when you see a spinning circle or something because it's loading
32:36
With Blazor, we can actually build the first version of the code statically
32:40
so you get a regular web download. This page loads instantaneously, and then the dynamic part takes over
32:46
And we can now persist that state when that comes down, which means the app doesn't have to recompute that
32:52
It makes it even faster. So it just means Blazor WebAssembly apps are faster and smaller than they've ever been before
32:58
We added a new library called Blazor Fluent UI. Fluent UI is some controls that the Office team has built, and it's a way of making applications look and feel like a Windows 11 style application
33:14
We've wrapped all of those components in Blazor, so there's 40 plus Blazor components here
33:19
And you can use those to build your applications today in Blazor
33:24
And then, of course, there is .NET MAUI. This is our multi-platform app UI
33:29
This is what I'm super excited about. You can build a single .NET application
33:33
And notice it can run on Win UI. It can run on Mac. It can run on iOS. It can run on Android
33:37
Single project. Single code base. All those multiple devices. And we planned it, you know, it shipped in preview in .NET 6
33:46
It's going to GA in a month or two, probably at the build conference. We took it even a step further
33:53
You can go even further and actually have a Blazor application that runs inside of a Maui application
33:59
So you're actually, hey, I want to build a web app, but I want my web app to be able to take advantage of native platform
34:06
And so we wrap your Blazor app in a Maui app, and then it has access to all the hardware and libraries available on each of the platforms
34:17
So you can build an iOS app with Blazor. And so we're trying to cover you in all the ways there
34:24
And I'll skip this stuff because I'm a little ahead of myself. and so we have a Maui preview out right now
34:32
with windowless, app SDK, a bunch of perf stuff for Android but let's get to it and let's do a quick Blazor demo
34:40
so go back to my Visual Studio let's switch projects and I'm going to want to run that podcast application
34:57
Go back to my solution Explorer I pin it here and I run this in a second here Okay
35:23
Now first off, let's run this application. And this is a snazzy app
35:36
This is actually showing a cool thing here. This is actually a Blazor WebAssembly style project, but it's got a static page here
35:43
So you get this login page that does all the cool stuff
35:48
If I goof around here, it's all fancy, resizes correctly. If I sign in, here I am in the podcast application
36:02
I can discover podcasts. Do all this kind of cool stuff. I can subscribe to these things
36:12
Click the little plus buttons. It's a fully, crazily awesome application here
36:18
But if I go to subscriptions, wow, nothing shows up here. so let's go over here switch back to VS and what I'm going to do is I'm going to go to the
36:31
subscription page I'll hide a bunch of stuff here and what I'm going to do is I've got it to do here
36:38
that I should show some subscriptions I'm going to cheat because I think I'm time gapped a little
36:43
bit here and what I would normally do is I would go write some code that looks a lot like this
36:49
I'm sorry the screen's a little constrained because I want to show the browser right next to here
37:00
Normally what I would do is come in here and go write some code very similar to this. I'm going to do a UL
37:04
I'll do a for each and write out each of these items. Make sure I didn't screw that
37:12
Oh, good. Good not. And I'm just going to press save. and notice when I press save
37:20
that just showed up right in the browser. This is showing that hot reload capability
37:25
I can basically save the code. Stuff shows up right in the browser and that's better
37:31
but I don't have all those capabilities I had before. I don't have the ability to click the plus button or stuff
37:37
to decide I don't want to have this and I didn't even talk about in some ways
37:43
how some of that worked. But I'll get there in a second
37:56
Notice there is a hot reload button kind of snuck here. I have mine set on hot reload on file save
38:02
I could turn that off and then I would have had to actually come over here and clicked hot reload to make that that reload happen
38:08
But I prefer having it on file save so I can just come over in my editor
38:12
make my changes and i'm good to go so let's let's go and make a fancier version of this
38:18
um i'll go back to my notepad file here and instead of actually doing all that stuff inside of the uh
38:27
this manual markup here i could have done something much more like show me a card i could have a blazer component get the browser back over here i could have had
38:39
laser component here uh that does the work for me now and now you can see with that with that i now
38:45
have the plus i can now i got the check box there to do all that um but it still doesn't the screen
38:52
doesn't look great and so i could go a step further and come over here and put a full grid in here
39:04
And this is kind of cool when I show you this. So I'm going to press save
39:11
Notice this. Something just happened. The IDE is determined that I tried to make a change that is too big
39:20
This doesn't actually work for us. And by not work for us, what I mean is hot reload is a work in progress for us
39:29
And there'll be times you'll make a code change, and it's a code change that's too big
39:34
for us to deal with. And in that case, I can decide, yeah
39:38
I want to rebuild and apply the changes. It'll rebuild the application
39:43
Now, the cool thing is here, even though it rebuilt the application, notice the browser's still updated
39:48
I still didn't have to go change the browser. We rebuilt, but we still reloaded the app in the page
39:53
for me automatically, which is pretty nifty. And I can click that
39:58
Now I don't have any subscriptions, which kind of looks yucky, yucky, yucky
40:03
but notice the grid has support for empty results i can go back to my notepad file I could go grab this
40:15
And I could paste this. Let's get the browser back up again. And there, press save
40:25
And now you see the browser refreshes again. And I get this nice option to tell me
40:30
hey, go subscribe. If you haven't subscribed to any channels yet, go do that
40:37
And so that is pretty nifty. And this is kind of showing some of the cool features that we have with Hot Reload, Blazer, in .NET 6
40:48
I do want to show, I'll go back to the browser, make the browser full screen here, and go back to the home page here
40:56
And this is using that pre-rendering technology. And so if I go and right-click and I look at the page source, you're going to see we emitted all the markup, all the divs for all the markup were emitted there
41:10
And that's why it loads instantaneously. We built the first version of this on the server. And then I mentioned before state
41:16
And notice there's this comment down here. And this contains all the browser state required so the SPI application can take advantage of all this stuff right away
41:27
I don't have time. uh to show it but i i do want to say that there is a um another cool aspect of the project
41:37
would be if i go to my application and right click i can do a publish and as part of publish
41:49
we have the ability to link down the runtime and make your blazer application even smaller so if
41:54
So if I'd actually go and show the Visual Studio installer
42:04
this is something we plan to make default in the future. I'm going to go to modify
42:12
And I'm going to click ASP.NET. You want to go and go check .NET WebAssembly build tools
42:19
If you do, it's going to give you that right-click publish feature that will make your application even smaller by linking out the parts of the application
42:27
that you don't use. So with that, I will switch from this application to a
42:34
switch to a Maui application. Okay
42:44
So now I'm in an Aoi application. This is a native UI style application
42:54
And so I'm going to run it. So this application is going to be using the Windows app SDK
43:02
So it's going to be using WinUI 3. And so let's just start the app for fun
43:09
Start without debugging. there is a bug in these tools today where basically when you're building a multi-target
43:20
application and I'll show what this is in a second we spend a little bit too much time we
43:24
compile all the projects not just the one you're building but here I am this is now a native
43:29
application this is not a web there's no web here at all built on .NET MAUI it's going to look very
43:38
similar to the one you saw before. But as I said, this is now using native controls
43:44
to do the same kind of thing. I can do a subscribe there. Go to subscriptions, it just shows up
43:50
But what's cool about this project, I'm going to close that out, go back to Visual Studio
43:56
This application, if I go look at the menu up here, notice I can select Android, iOS, Mac, or Windows
44:05
So this is an application, a single application and it supports all those different models
44:09
And you can see that if I scroll up the top of the file here
44:12
you can see my target frameworks are Android, iOS, Mac. They're all there
44:18
So this is a modern Xamarin project, but it's now called Maui
44:23
You can see that we have a bunch of things that are shared common stats like the name
44:27
app identifier, the version. I go down here, you can see, I can identify my application icon
44:33
my splash screen, my images, my fonts, And normally these would be a side project if you're used to building Maui applications
44:42
or Xamarin applications. But now if I come over here, you can see I've got my platforms
44:45
I can write Android code, iOS code, Mac code, Windows code. I've got my shared fonts, images, strings, styles that go across all the projects
44:55
And then all the things that you would expect to work here will work here just the same
45:00
And I'll show that. I go to like the discover page and I run the application in the debugger Um show off a couple of cool features we have And I sorry David I going to go probably to nine nine top of the top of the hour if that okay
45:31
And so I will get the same look. So I'll get some of the same cool features that you would expect
45:36
Notice here, I want to hot reload this app, but the app uses a lot of the screen
45:42
Notice that I have something called a XAML live preview running over here
45:49
And so right here in the app, inside of VS, I can actually see a copy of the app
45:55
And that's actually really cool because I can come over here and say background color
46:02
And I could decide to set this to something like hot pink. And notice right over here that updated instantaneously
46:14
And so I can reload live in Visual Studio, see the application live in Visual Studio
46:20
all here. Let me do one more thing as part of the app
46:24
First of all, let's put the app back. It goes back right away in the code there
46:31
I'll stop debugging. Yeah, yeah. And I'll do one more thing here
46:42
So, yes, there you go
46:52
Okay. I want to show one final thing. And we, there's a new feature in Windows 11, and it lets you run Android applications
47:04
It's the Windows subsystem for Android. It lets you build Android applications live inside of a Windows device
47:12
And so with WSL, you can run Linux on top of Windows. With the Windows subsystem for Android, you can run Android live on top of Windows
47:24
And so while that's booting up, I'm going to do this. I'm not going to break anything
47:31
So what I'm doing is I'm actually launching the subsystem for Linux, and we'll give it a chance to finish here
47:42
There we go. And so I just launched the Amazon store. I went to launch the emulator, but what I really want to do is I want to do this
47:54
I'm going to go to settings. Let me show you. We're going to hook this up automatically in the future
47:58
I need to have it running for me real quick. And I want to grab this IP address
48:05
And I'm going to go up to tools. Android, I'm going to launch this
48:18
ABB connect. This is something we'll automate for you, but I'm showing the future
48:24
And what it does, I just connected the Android debugger tools to that running instance of Android on my application
48:33
And because of that, I can now come over here, set the framework to Android, and you're
48:38
going to notice that the subsystem for Android shows up here. And so right in Visual Studio on a Windows machine
48:45
I can now start the debugger. And what's going to happen is we're
48:50
going to run the Android version of this MAUI application on the Android emulator on Windows
48:58
And so having it built into Windows is pretty cool. It means your developer experience
49:04
is gonna be faster than it was before. You don't have to really run the emulator, you're gonna run this, here's the podcast application
49:11
It's now an Android app, so stuff shows up across the bottom versus the top
49:15
It's gonna look a little bit different, but it's the same code base as I showed before
49:20
And then the same features actually all should work over here. I should be able to do
49:25
Try this. Notice the app changed, and so you still get those hot reloads, all those same things happen
49:35
no matter where I run this. With that, let me go jump back to my slides
49:44
And my next steps are, you know, go grab .NET 6 today
49:51
Go grab Visual Studio 2022 today. Grab the Upgrade Assistance. Try out Maui. We really love your feedback
49:59
You know, I know there's a whole bunch of, you know, 30 plus sessions of this conference over the next little bit
50:07
Enjoy the conference. Enjoy.net. Please give us feedback. Please follow me on Twitter
50:12
Ask me any questions you want. I want to thank David and Simon for having me. Have a great conference
#Machine Learning & Artificial Intelligence
#Open Source
#Windows & .NET