[00:00:01] [music] [00:00:06] >> So today we're going to talk about [00:00:07] runtime, async, and memory safety. So [00:00:10] these are two features that the runtime [00:00:13] and C# compiler team have worked on this [00:00:16] release. [00:00:17] And you know, Andy and I, we [00:00:20] we sit in the same team room. [00:00:22] And so we kind of thought like we want [00:00:24] to bring you into our team room and kind [00:00:26] of just show you what we find [00:00:28] interesting about these features and [00:00:30] kind of share that sort of insight. So [00:00:32] I'm Rich Lander. [00:00:33] >> I'm Andy Gocke. [00:00:34] >> Okay. [00:00:36] So let's start with runtime async. So [00:00:39] like the whole purpose of this feature [00:00:41] is you know, how could we make async [00:00:44] code cheaper? So async code started like [00:00:46] 15 years ago or something like that. And [00:00:50] it's like super pervasive, so making it [00:00:52] cheaper is probably a good idea. [00:00:55] And we didn't change anything about the [00:00:57] syntax. So everything about your source [00:00:59] code as is is totally fine. [00:01:02] This feature is new in .NET 11 but it's [00:01:05] opt in. [00:01:06] This is this feature is MS build [00:01:08] property is how you turn it on. And we [00:01:10] expect it to be the default [00:01:13] in .NET 12. [00:01:15] And it's important to note that we [00:01:17] actually compiled much of the framework [00:01:20] libraries with this feature enabled. So [00:01:23] no matter what you're going to be [00:01:24] getting [00:01:25] some benefit from this feature when you [00:01:27] install and start using .NET 11. [00:01:30] So Andy, how about you tell us what how [00:01:31] this thing actually works? [00:01:33] >> Yeah, happy to. [00:01:34] So [00:01:35] to start with, we built [00:01:38] async, as Rich said, a while ago [00:01:40] primarily to help developers write fast, [00:01:44] clean async code that looked like [00:01:47] synchronous code but was non blocking. [00:01:49] It was a great way to write your non [00:01:51] blocking IO. [00:01:53] But over the years, we've noticed that [00:01:55] there are some costs in there. [00:01:57] Namely the the way we implemented was [00:02:00] through Roslyn state machines, which is [00:02:02] a really effective way to do [00:02:04] non-blocking IO. [00:02:05] But it does introduce some costs over [00:02:08] synchronous code. And in particular like [00:02:10] if you write a a line of code that's [00:02:13] purely sync and then you write the same [00:02:16] line in async, there's a little bit of [00:02:18] overhead in the async path. [00:02:21] And if you have to choose, let's say [00:02:23] you're using a network stream versus a [00:02:26] memory stream, [00:02:27] the network stream you care about [00:02:29] non-blocking IO because you're probably [00:02:32] going to be doing IO. But the memory [00:02:33] stream you're not really doing IO. And [00:02:36] so there's a synchronous code path that [00:02:38] you could actually end up paying a [00:02:40] little bit extra for by having async. [00:02:43] And this introduces all these questions [00:02:45] that we don't want people to think about [00:02:46] like should I choose async or sync in [00:02:49] this code path? We want just everything [00:02:51] to be fast and we want it to all just [00:02:53] work for you. [00:02:54] Um so we started to rethink how we do [00:02:57] async and how we implemented async. Um [00:03:00] and we went back and we said what if we [00:03:02] gave this deep runtime integration [00:03:04] rather than doing this at the compiler [00:03:06] level and then letting the runtime kind [00:03:08] of sort it out later? Uh what if we [00:03:10] built this into the runtime? But we did [00:03:13] it in such a way that you don't have to [00:03:15] think about it at all. Your code just [00:03:17] gets faster. So the result being like no [00:03:20] IO state machines get generated by [00:03:22] Roslyn, [00:03:23] but also you don't have to do anything. [00:03:25] You don't have to build in Value Task or [00:03:27] any of the other performance features [00:03:28] we've introduced over the years. You [00:03:30] just get synchronous performance even in [00:03:33] the cases where let's say you're using [00:03:35] that network stream and you actually [00:03:38] have most of the stuff in a buffer [00:03:40] already, [00:03:41] that's also synchronous performance. So [00:03:42] even in the cases where you get network [00:03:44] improvements where you're going over the [00:03:46] network, you can still see improvements [00:03:49] from [clears throat] that synchronous [00:03:49] performance increase. [00:03:51] >> Awesome. [00:03:52] So um here's a demo program that I [00:03:55] wrote. Um this is basically the most [00:03:58] simple program you could have that has [00:04:00] an async call in it. And I think a a [00:04:02] good demo for this. [00:04:04] [snorts] So, how about uh Andy, you [00:04:06] explain to us what's actually happening [00:04:08] underneath the hood? [00:04:10] >> Yeah, so this is like the simplest async [00:04:13] program that you could possibly think [00:04:15] of. It's like one await uh with a task. [00:04:17] delay, and yet um look at the code. It's [00:04:20] uh it's huge. It We had to split it [00:04:21] across two columns. Um we had to shrink [00:04:25] down the font size, and it's still [00:04:26] barely fits on the slide. [00:04:28] >> how does it get so big? [00:04:29] >> Yeah, and this is because the entire [00:04:31] implementation of async is basically [00:04:33] inside the C# compiler, [00:04:35] and it turns into this big, complicated [00:04:38] state machine with all this plumbing at [00:04:40] runtime or rather at compile time. Um [00:04:42] and all of this IL needs to be handed [00:04:45] off to the actual runtime to process and [00:04:48] run and optimize later. Uh and it turns [00:04:51] out there's actually some fairly heavy [00:04:54] uh constructs in there that make it [00:04:56] difficult to optimize this code. [00:04:58] Um so with runtime async, we decided, [00:05:00] okay, like let's go back and try and [00:05:03] figure out what the most optimal form of [00:05:05] this is. So this is the code in runtime [00:05:07] async. This is the generate with This is [00:05:09] what the generated code basically looks [00:05:11] like. [00:05:11] And you'll see that there are only two [00:05:13] things that are really different about [00:05:15] it. The first is this method impl [00:05:17] options. async, and the second is async [00:05:20] helpers. await. [00:05:21] The method impl options. async is [00:05:23] actually this new calling convention, [00:05:26] this low-level thing at the function [00:05:28] level at the emitted uh assembly level, [00:05:30] machine assembly level. Um we are [00:05:33] introducing a new calling convention for [00:05:36] async code that the runtime is going to [00:05:38] implement so that each method can be [00:05:40] optimized and do like interprocedural [00:05:43] optimization um to get the whole chain [00:05:46] to behave as one. Uh and then you'll see [00:05:48] how that benefits later. And then the [00:05:50] other part is this async helpers. await. [00:05:53] And that's actually uh a JIT intrinsic, [00:05:55] and that is the key that we don't do any [00:05:58] of this state machine transformation in [00:06:00] C# compile time. We actually optimize it [00:06:03] using the JIT, and we generate all of [00:06:06] the same semantics, but we do it through [00:06:09] an intrinsic that the JIT knows about [00:06:11] and can just transform kind of [00:06:13] magically. [00:06:14] >> Right, an intrinsic it just means like [00:06:16] the implementation [00:06:18] isn't in the BCL. It just means this is [00:06:20] kind of like a fake method handshake [00:06:22] thing with the JIT. [00:06:23] >> yeah. This is a fake method. It doesn't [00:06:25] actually do anything. It's all [00:06:26] implemented in the the compile the [00:06:29] underlying JIT compiler. Um and yeah, [00:06:32] and it implements all of the same stuff, [00:06:34] but in a way that we can actually [00:06:36] understand inside the JIT the [00:06:39] optimization paths that we want to do [00:06:41] rather than the ones that we were kind [00:06:43] of trying to see through with the [00:06:45] previous compiler generated code. [00:06:48] >> Okay, so [clears throat] one of the [00:06:50] things that you know developers are [00:06:51] super familiar with is call stacks. And [00:06:54] I think the thing you were telling us um [00:06:56] you know with those two slides that you [00:06:57] showed us is that you know there's [00:07:00] uh a bunch of extra machinery with the [00:07:03] compiler async, you know those these are [00:07:05] these state machines that we've talked [00:07:06] about. And so those are contractual in [00:07:09] the sense that they very much have to be [00:07:12] executed, you know typically in a [00:07:13] particular order. [00:07:15] And so those are observable. So this is [00:07:16] environment that stack trace and you can [00:07:19] see that you know much of this the the [00:07:21] the methods that are in gray are are [00:07:24] methods that I really don't care about [00:07:26] and frankly don't really want to see. [00:07:29] The ones in teal are kind of like quote [00:07:31] unquote my code. These are the ones that [00:07:33] I actually care about. So if I like you [00:07:35] know listen to what you're saying and [00:07:36] use my intuition, I'm guessing that with [00:07:40] um runtime async uh we're just going to [00:07:43] see the green the green ones. And lo and [00:07:45] behold you know such a surprise. Um [00:07:49] this is what we see. And so like I said [00:07:51] this is environment.stacktrace and you [00:07:53] know that's typically used in um [00:07:55] diagnostic scenarios. So then you know [00:07:58] if your app crashes in production for [00:08:00] some reason, this is all you're going to [00:08:02] see and you can kind of like um [00:08:04] immediately reason about that. But I'm [00:08:06] guessing that it's not just for [00:08:08] diagnostic scenarios that we're going to [00:08:10] see a benefit, but that we'll actually [00:08:12] see performance benefit as well. [00:08:14] >> Yeah, exactly. So um here's one example. [00:08:18] Um this is an example based off of uh a [00:08:20] benchmark where we're going to walk a [00:08:23] lot of files on disk. The idea is like a [00:08:25] backup program. Um maybe you're going to [00:08:27] upload a bunch of different files to the [00:08:29] to the cloud. Um but maybe [00:08:32] in most of the cases the files are [00:08:34] already uploaded. So all you really need [00:08:35] to do is check a timestamp. Uh in most [00:08:38] operating systems that's actually a [00:08:39] synchronous operation. You don't really [00:08:41] need to block the thread for that and [00:08:42] it's often very fast. Um so [00:08:45] if you look at the implementation with [00:08:48] compiler async versus the compiler [00:08:50] versus the implementation with runtime [00:08:52] async, [00:08:53] you'll see that this is actually a [00:08:54] synchronous completion scenario and [00:08:56] you'll also see that you can very [00:08:59] clearly notice the overhead for the [00:09:01] state machines, the compiler async [00:09:03] version. Um and you'll notice that this [00:09:06] this uh chart grows um from left to [00:09:09] right. It goes from three frames, five [00:09:11] frames, seven frames. That's how deep [00:09:13] the call chain is. So basically you have [00:09:15] async methods calling each other. Um and [00:09:18] as you grow farther and farther down the [00:09:20] call chain, the overhead from the state [00:09:23] machines increases uh proportionally. So [00:09:26] you get more overhead versus the runtime [00:09:29] async where the overhead uh the time [00:09:31] actually stays relatively uh [00:09:33] small and and much smaller than the [00:09:35] compiler async uh because we don't have [00:09:38] this overhead. [00:09:41] Then if you look at the next slide, you [00:09:44] can also see the allocation effect. [00:09:47] Allocations are another byproduct of the [00:09:50] compiler async chain. So every compiler [00:09:53] async method generally returns a a task [00:09:56] of T and that task actually needs to be [00:09:59] allocated. Even in the case where the [00:10:02] actual async chain doesn't actually need [00:10:05] to suspend, you still need to allocate [00:10:07] the task because the entire chain needs [00:10:10] to work through. [00:10:11] So you can see that once again as you [00:10:13] increase the number of frames, the [00:10:15] actual allocations increase [00:10:17] proportionally. Versus runtime async, [00:10:20] remember I said we do interprocedural [00:10:21] optimization? This is where we notice [00:10:24] that the entire chain is completing [00:10:27] synchronously and we optimize the entire [00:10:29] chain together. And that means we remove [00:10:31] all of the allocations in the entire [00:10:33] path. So even if you go down to 32 [00:10:35] frames, it doesn't matter. It's all zero [00:10:37] byte allocation all the way through. And [00:10:40] for these synchronous [00:10:41] performance situations, that can really [00:10:43] matter. [00:10:44] >> Yeah, I I kind of see this as like [00:10:45] forest versus trees. [00:10:47] >> Yeah. [00:10:47] >> You know, the the runtime async sees the [00:10:49] whole forest and in the compiler async [00:10:51] one it's like one tree at a time. [00:10:53] >> Yeah, there compiler async it's very [00:10:55] much each method by itself is the only [00:10:58] thing that the the compiler can see, the [00:11:00] optimizer can see, runtime can see. And [00:11:02] so that increases the the cost. [00:11:04] >> [snorts] [00:11:05] >> Um and then the last thing here is [00:11:06] exception handling. Um so this might be [00:11:09] something that you encounter if you run [00:11:11] a service and you maybe see an outage [00:11:15] from one of your providers or something [00:11:16] and that causes an error and then that [00:11:18] causes exceptions and then you get a lot [00:11:20] of exceptions. Stuff starts failing and [00:11:22] just the exceptions start piling up. And [00:11:25] this can be a problem. Um and in async [00:11:27] code it can hurt even more because the [00:11:30] async cost um really flows through to [00:11:33] exceptions. Exceptions are much more [00:11:35] expensive in async code than they are in [00:11:38] synchronous code. Um well, they were. Uh [00:11:41] with runtime async the actual cost of [00:11:44] runtime async code goes way down with [00:11:46] exception handling and starts to [00:11:47] approach quite quickly the actual [00:11:49] compiler async uh [00:11:51] code. And this holds actually for [00:11:53] suspension and non-suspension. And for [00:11:56] suspension, it turns out that the cost [00:12:00] of running the runtime async uh [00:12:02] exception handling code is so fast that [00:12:05] it actually gets cheaper than sync when [00:12:08] we get down to 32 frames. So runtime [00:12:10] async is actually outperforming fully [00:12:13] synchronous code in exception handling [00:12:15] down to 32 frames. [00:12:18] And the same story is true for [00:12:20] allocations. In fact, it's actually more [00:12:21] true. The allocation [00:12:23] burden increases significantly more [00:12:27] with exception handling in compiler [00:12:29] async due to that method hopping that I [00:12:32] mentioned before. Kind of each method [00:12:34] needs to do its own exception handling [00:12:37] individually. So you end up doing [00:12:39] redoing the exception handling over and [00:12:41] over again and rethrowing the same [00:12:42] exception [00:12:44] over and over again and causing the [00:12:45] allocations. [00:12:47] With runtime async, almost all of that [00:12:49] allocation is reduced or eliminated and [00:12:52] you get down to the actual compiler [00:12:56] or sorry, the synchronous level [00:12:58] operations very quickly. [00:13:00] >> Right. So if you're a person who likes [00:13:01] to use [00:13:03] the term P99 in like every third [00:13:05] sentence, then basically this this is [00:13:07] exactly what you want. [00:13:09] >> Yeah. If you have any seen any problems [00:13:11] with [00:13:12] exceptions in particular causing [00:13:14] problems in your application, especially [00:13:16] in the async code [clears throat] paths, [00:13:18] this should definitely be something you [00:13:20] should be looking at. And it also [00:13:23] ideally will increase your [00:13:26] capacity. You'll have to have lower load [00:13:28] through your exception storms even if [00:13:30] they didn't take your service down. [00:13:32] >> Okay. Let's switch gears. So now we're [00:13:35] going to talk about the second feature, [00:13:37] memory safety. So this feature is in [00:13:39] preview [00:13:41] in .NET 11. [00:13:43] You know, its its whole purpose in life [00:13:44] is about making your code safer, more [00:13:47] secure. [00:13:49] And we expect it to be, you know, fully [00:13:50] GA prod [00:13:52] in .NET 12. [00:13:54] I just want to call attention to allow [00:13:55] unsafe blocks. So this is an existing [00:13:59] existing property. [00:14:01] It has been false, [00:14:04] you know, disallow [00:14:07] up until now and we're leaving it that [00:14:09] way. [00:14:10] So C# has the kind of like [00:14:12] characteristic of no unsafe code by [00:14:15] default. [00:14:16] So you want to be in like super safe [00:14:18] mode, what you will do is set memory [00:14:21] safety rules version two um and then [00:14:24] you'll set allow unsafe blocks as false. [00:14:27] And that means if you know you're [00:14:28] writing code or AI agents are writing [00:14:30] code for you um no unsafe code will be [00:14:33] allowed, which is awesome. Um if you [00:14:36] need to write unsafe code or you need to [00:14:37] write P invokes, then you'll set this to [00:14:39] true and you will [00:14:41] you will opt in. [00:14:43] So security is the top priority on our [00:14:45] team. Uh it has been and continues to be [00:14:49] uh and memory safety like fits like [00:14:51] perfectly into this and I'll explain [00:14:54] why. [00:14:55] Uh so Microsoft made this statement a [00:14:57] few years ago [00:14:59] that 70% of vulnerabilities are caused [00:15:01] by memory safety issues. Google actually [00:15:04] made um did a similar announcement uh at [00:15:07] around the same time and gave basically [00:15:09] the same number. And so this is sort of [00:15:12] like what motivated us to to go do this [00:15:15] work um just because it's like so [00:15:18] important um [00:15:20] uh yeah to keeping products secure. [00:15:23] This is the definition of memory safety [00:15:25] on Wikipedia. And one of the things [00:15:27] you'll find is if you read like any [00:15:29] after the fact report um by on for [00:15:33] basically any product um that has had [00:15:36] memory safety sorry that has had yeah [00:15:38] memory safety oriented vulnerabilities, [00:15:41] you'll see a bunch of these same words [00:15:43] show up here. And you know we want to [00:15:44] make it the case that you know [00:15:46] developers who opt into these features [00:15:48] um can basically [00:15:50] not have to worry about these uh type of [00:15:53] concerns. [00:15:54] So Andy though you know one of the [00:15:56] things I've been noticing is is like [00:15:58] I thought you told me like C Sharp uh [00:16:01] already was a memory safe programming [00:16:03] [snorts] language. So you know what's up [00:16:05] with this feature? [00:16:06] >> Yeah. Uh it's a great question. So C [00:16:09] Sharp is and always has been a memory [00:16:11] safe programming language. Um ever since [00:16:13] C Sharp 1.0 we've had protections [00:16:16] against pretty much all of the things [00:16:17] that we think as memory safety, like [00:16:19] memory out-of-bounds rights. [00:16:20] Um, so, every variable is definitely [00:16:23] assigned and it's always uh written [00:16:25] before it's read. Uh, all of the [00:16:28] dynamically allocated memory is zeroed, [00:16:31] so you can't read uninitialized memory. [00:16:33] Um, we have [00:16:35] bounds checks by default on all array [00:16:37] accesses and collections. Uh, and then [00:16:39] we have the GC. And so that prevents [00:16:41] use-after-free by making sure that the [00:16:43] memory isn't gone until you really have [00:16:45] no references left. [00:16:48] But, [00:16:49] we also have escape patches. Um, C Sharp [00:16:52] is a language that has always been about [00:16:56] being able to do things like use native [00:16:59] pointers when necessary for performance [00:17:02] or call into other languages for [00:17:04] interop. Um, it gives you those [00:17:06] capabilities. So, the trick is that when [00:17:10] we use those features, we have no way of [00:17:13] kind of delivering in in run in C Sharp [00:17:17] today. We have no way of delivering that [00:17:19] safety contract up to our callers. [00:17:22] And so with Unsafe V2 and with this [00:17:25] Unsafe Rules V2, we want to make that [00:17:28] contract real and we want to make sure [00:17:30] that all of those places where we [00:17:32] utilize the escape patches can propagate [00:17:35] that information up to the callers. And [00:17:38] so here you can see like a good example [00:17:40] is um there's this this method in the [00:17:43] Marshall class, which is for uh uh [00:17:45] communicating with interop. [00:17:48] Um, [00:17:48] Pointer To String Ansi uh is a method [00:17:51] that takes a memory address and a length [00:17:54] and turns it into a real string um in C [00:17:57] Sharp. [00:17:58] The problem being, of course, a memory [00:18:00] address and a length are not checked at [00:18:03] all. And so it's completely up to the [00:18:05] caller to make sure that that length is [00:18:08] it within the bounds of the memory [00:18:10] that's handed to us. [00:18:11] But at the same time, in memory safety [00:18:14] one, there was no way to say, hey, this [00:18:17] method is unsafe and if you misuse it, [00:18:19] if you pass the wrong length, you can [00:18:20] have out-of-bounds memory access. [00:18:23] Now we're including that capability so [00:18:25] that people can be sure that when they [00:18:27] do use their rare [00:18:29] uh out-of-bounds or sorry memory unsafe [00:18:32] features that they can make it clear to [00:18:35] their callers what those contracts are. [00:18:38] So uh this chart really shows exactly [00:18:41] how that contract works. The idea is [00:18:43] that there's an obligation that when you [00:18:45] declare something to be unsafe, that [00:18:47] means that there is additional rules [00:18:49] that the caller has to follow um in [00:18:51] order to make sure that that is all [00:18:54] correct um and that the call is correct. [00:18:57] Uh and at the same time it provides a [00:19:00] system of blame so that when something [00:19:02] does go wrong you can go see, hey was [00:19:05] the caller specifying all the things [00:19:07] they need to specify or was the call E [00:19:11] specifying all the things they need to [00:19:12] specify? And presumably if something [00:19:15] goes wrong one of those two things is [00:19:17] wrong and so you can narrow down where [00:19:18] the problem is quite quickly. [00:19:22] And then the end result of this is that [00:19:25] you can see how we can compose this [00:19:28] whole contract together. So this method [00:19:31] decode ANSI is a safe method with a [00:19:34] usage of the unsafe method pointer to [00:19:37] string ANSI inside it. Decode ANSI [00:19:39] doesn't take a a raw memory address. It [00:19:41] takes a read-only span which is a bounds [00:19:43] check safe C sharp construct. Um but it [00:19:47] calls pointer to string ANSI underneath [00:19:50] inside an unsafe block. That unsafe [00:19:53] block actually wraps conceptually wraps [00:19:57] the call to pointer to string ANSI and [00:20:00] it serves as a point where we can say, [00:20:02] okay the caller has satisfied all the [00:20:05] requirements. We know bytes dot length [00:20:07] is within the bounds of pointer because [00:20:08] bytes dot length came from the span and [00:20:10] it's always correct. Um and at the same [00:20:13] time we also know that we don't have to [00:20:16] tell the caller anything about this [00:20:18] because it's always a safe contract. [00:20:21] >> Awesome. [00:20:23] Yeah, I kind of think of it as unsafe on [00:20:25] a method means dragons may lie here. [00:20:29] And then the compiler support basically [00:20:32] says whether or not you indicated [00:20:34] whether you realized that dragons were [00:20:36] there. So that inner unsafe block is [00:20:38] basically saying yes, yes, I understand [00:20:41] now the onus is on me. [00:20:42] >> Yep, yep. And that's that's where you [00:20:45] say okay, I have to check this myself [00:20:48] but as long as I do it should be worked [00:20:50] it should work out. [00:20:51] >> Okay. So I just want [clears throat] to [00:20:53] show [00:20:54] a couple variants of this. So one of the [00:20:57] things we added which we haven't shown [00:20:58] yet is that [00:21:01] if you have an unsafe method you should [00:21:03] have unsafe documentation. So we have [00:21:06] triple slash comments since C# 1.0 and [00:21:09] so we're adding the safety concept and [00:21:11] so the obligation is on the [00:21:15] unsafe you know member owner. Oh, by the [00:21:17] way, we never said that [00:21:19] fields can be [00:21:22] Fields can have unsafe contracts too. [00:21:23] >> yeah, I forgot I [00:21:24] wanted to say that. [00:21:27] >> Yeah, so the the unsafe member owner [00:21:30] needs to put on this documentation and [00:21:32] this is where they describe [00:21:35] their obligation and it needs to be [00:21:37] clear such that callers can do the right [00:21:39] thing. [00:21:42] Right. And then the thing with this this [00:21:44] is another this is basically exactly the [00:21:46] same thing that [00:21:48] Andy showed earlier. The difference here [00:21:50] is that we have a new [00:21:53] bit of syntax. So we have unsafe [00:21:56] expressions now. In the past, the only [00:21:58] thing that we offered was these unsafe [00:22:00] blocks. [00:22:02] We wanted to make it so that this [00:22:04] feature was quite ergonomic to use and [00:22:06] developers didn't find this to be like a [00:22:08] tax. [00:22:09] And so for one liners [00:22:12] you have the unsafe expression and this [00:22:13] makes the code much prettier. [00:22:18] Yeah, and so this was just like an [00:22:19] obvious thing to to go add. [00:22:23] We can also like zoom out for sec. Um, [00:22:26] in the context of, you know, all [00:22:28] programming languages, um, you know, [00:22:31] we're not the ones that are kind of like [00:22:33] inventing this whole space. Um, [00:22:36] so Rust is kind of like the, um, gold [00:22:40] standard for like how to do memory [00:22:42] safety. Um, Swift had a released last [00:22:45] year. Uh, yeah, yeah, 2025, um, where [00:22:48] they more or less implemented, um, the [00:22:51] Rust memory safety programming model. [00:22:54] That's basically the same thing we're [00:22:55] doing with C Sharp. We're taking all of [00:22:58] those same concepts and, um, yeah, and [00:23:01] implementing them in C Sharp. [00:23:03] Okay, so this is the safe the safe side. [00:23:06] So like the the, you know, this exactly [00:23:09] uh aligns with the examples that Andy [00:23:11] showed us before. These are all three [00:23:13] safe safe facades that are more or less [00:23:15] doing exactly the same thing. And you'll [00:23:18] see that they have some form of either [00:23:21] runtime guard, um, or [00:23:24] um, type system kind of affordance that [00:23:28] um provides the safety. And then you [00:23:30] have some, um, like I think these all [00:23:33] use unsafe expressions. Uh, I guess the [00:23:35] Rust one doesn't actually. The Swift one [00:23:37] does. They either have unsafe [00:23:39] expressions or unsafe blocks that say [00:23:41] I'm doing the unsafe thing here. [00:23:43] Otherwise, the compiler would not [00:23:44] compile any of these three examples. [00:23:47] And then we have the unsafe APIs, um, [00:23:50] and these all have the unsafe keyword. [00:23:54] Uh, we don't have the implementations [00:23:55] here, but you can see like if you look [00:23:57] it's like okay, unsafe, unsafe, [snorts] [00:23:59] unsafe. And they look exactly the same. [00:24:02] Um, yeah. And so C Sharp fits exactly [00:24:04] into this kind of like [00:24:06] lineage or, um, whatever. This [00:24:10] they all do the same thing. [00:24:13] Okay. Well, um, thanks for listening to [00:24:16] the talk. We, uh, hope that you, you [00:24:19] know, enjoy adopting these features on [00:24:21] the next couple of years and that you [00:24:23] get all the benefits that we intended [00:24:25] you to have.