1
0
mirror of synced 2025-12-19 09:50:46 -05:00
Files
James Montemagno 780b48a043 .NET 10 Preview 4 (#9828)
* Add .NET 10 Preview 4

* adding release notes for ef core

* updated cosmos section of ef docs and added missing small improvements

* fixed headings

* fix linter error in ef docs

* Update 10.0 Preview 4 Release notes (#9867)

* Update winforms.md

First draft with copilit

* Review feedback

latest updates

* Update winforms.md

* Update release-notes/10.0/preview/preview4/winforms.md

Co-authored-by: Tanya Solyanik <tanyaso@microsoft.com>

* Update release-notes/10.0/preview/preview4/winforms.md

Co-authored-by: Tanya Solyanik <tanyaso@microsoft.com>

* Update release-notes/10.0/preview/preview4/winforms.md

Co-authored-by: Tanya Solyanik <tanyaso@microsoft.com>

* Update release-notes/10.0/preview/preview4/winforms.md

Co-authored-by: Tanya Solyanik <tanyaso@microsoft.com>

* Update release-notes/10.0/preview/preview4/winforms.md

Co-authored-by: Tanya Solyanik <tanyaso@microsoft.com>

---------

Co-authored-by: Tanya Solyanik <tanyaso@microsoft.com>

* cleanup

* update C# 14

* .NET 10 Preview 4 - Containers (#9879)

* add here

* udpate

* update links

* Updated [dotnet-sdk-win-x86.zip] link 10.0.0-preview.4.md

* .NET 10 Preview 4 - Libraries (#9875)

* update here

* Add Out-of-Proc Trace Support for Activity Events and Links

* Rate Limiting Trace Sampling Support

* Clean-ip

* minor touch

* zip async

* gzip perf improvement

* Update release-notes/10.0/preview/preview4/libraries.md

Co-authored-by: Martin Costello <martin@martincostello.com>

* Update release-notes/10.0/preview/preview4/libraries.md

Co-authored-by: Rich Lander <rlander@microsoft.com>

* updates

---------

Co-authored-by: Tarek Mahmoud Sayed <10833894+tarekgh@users.noreply.github.com>
Co-authored-by: Carlos Sánchez López <1175054+carlossanlop@users.noreply.github.com>
Co-authored-by: Rich Lander <rlander@microsoft.com>
Co-authored-by: Martin Costello <martin@martincostello.com>

* .NET 10 Preview 4 - WPF (#9877)

* Add here

* Add WPF notes

* Add blurb about breaking changes

* cleanup messagebox stuff

* Update release-notes/10.0/preview/preview4/wpf.md

Co-authored-by: Harshit <62823486+harshit7962@users.noreply.github.com>

---------

Co-authored-by: Andy (Steve) De George <67293991+adegeo@users.noreply.github.com>
Co-authored-by: Harshit <62823486+harshit7962@users.noreply.github.com>

* .NET 10 Preview 4 - SDK (#9876)

* add here

* update

* .NET 10 Preview 4 - Runtime (#9874)

* Update runtime.md

* Add JIT notes

* Update inlining notes

Co-authored-by: Andy Ayers <andya@microsoft.com>

* Remove whitespace

* Brevity

Co-authored-by: Rich Lander <rlander@microsoft.com>

* cleanup top links

---------

Co-authored-by: Aman Khalid (from Dev Box) <amankhalid@microsoft.com>
Co-authored-by: Andy Ayers <andya@microsoft.com>
Co-authored-by: Rich Lander <rlander@microsoft.com>

* Add ASP.NET Core release notes for .NET 10 Preview 4 (#9881)

* Add ASP.NET Core release notes for .NET 10 Preview 4

* Add IJSObjectReference to JS function

* Update release-notes/10.0/preview/preview4/aspnetcore.md

Co-authored-by: Martin Costello <martin@martincostello.com>

* Fix OpenAPI.NET version

* Add todo for remaining features

* Add WebApplicationFactory with Kestrel

* Update todos

* Update todos

* Add NavigationManager.NotFound

* Add Blazor WebAssembly runtime diagnostics

* Edits

* Edits

* Edits

---------

Co-authored-by: Martin Costello <martin@martincostello.com>

* cleanup

* linter

* Address default Blazor UI template update.

* Add hyphen to dotnet-gcdump

* some updates

* updates

* .NET MAUI in .NET 10 Preview 4 (#9873)

* .NET MAUI in .NET 10 Preview 4

* added new MAUI features

* updates for known issues

* updates

---------

Co-authored-by: James Montemagno <james.montemagno@gmail.com>

* fix up md

* Update install-linux.md

* Update install-macos.md

* Update install-windows.md

* Update releases.json

* Updated release date in README.md

* Updated line16 with preview4 in releases.json

---------

Co-authored-by: maumar <maumar@microsoft.com>
Co-authored-by: Merrie McGaw <mmcgaw@microsoft.com>
Co-authored-by: Tanya Solyanik <tanyaso@microsoft.com>
Co-authored-by: victorisr <victorisr@microsoft.com>
Co-authored-by: Tarek Mahmoud Sayed <10833894+tarekgh@users.noreply.github.com>
Co-authored-by: Carlos Sánchez López <1175054+carlossanlop@users.noreply.github.com>
Co-authored-by: Rich Lander <rlander@microsoft.com>
Co-authored-by: Martin Costello <martin@martincostello.com>
Co-authored-by: Andy (Steve) De George <67293991+adegeo@users.noreply.github.com>
Co-authored-by: Harshit <62823486+harshit7962@users.noreply.github.com>
Co-authored-by: Aman Khalid (from Dev Box) <amankhalid@microsoft.com>
Co-authored-by: Andy Ayers <andya@microsoft.com>
Co-authored-by: Daniel Roth <daroth@microsoft.com>
Co-authored-by: David Ortinau <david.ortinau@microsoft.com>
Co-authored-by: padmasrid <38444564+padmasrid@users.noreply.github.com>
2025-05-13 10:32:54 -07:00

4.6 KiB

.NET Runtime in .NET 10 Preview 4 - Release Notes

Here's a summary of what's new in the .NET Runtime in this preview release:

.NET Runtime updates in .NET 10:

Escape Analysis for Local Struct Fields

Preview 4 expands the JIT compiler's escape analysis abilities to model references to objects from struct fields. As mentioned in prior release notes, the JIT performs escape analysis to determine if an object can outlive its parent method; if it cannot, the JIT can allocate it on the stack, removing the overhead of placing and tracking an object on the heap. Objects can "escape," for example, by being assigned to a non-local variable, or by being passed to or returned from a function that isn't eventually inlined by the JIT.

Consider the following example:

public class Program
{
    struct GCStruct
    {
        public int[] arr;
    }

    public static void Main()
    {
        int[] x = new int[10];
        GCStruct y = new GCStruct() { arr = x };
        return y.arr[0];
    }
}

Normally, the JIT will stack-allocate small, fixed-sized arrays that do not escape, such as x -- its assignment to y.arr does not cause x to escape, because y does not escape either. However, the JIT's escape analysis implementation previously did not model struct field references. In .NET 9, the x64 assembly generated for Main looks like this:

Program:Main():int (FullOpts):
       push     rax
       mov      rdi, 0x719E28028A98      ; int[]
       mov      esi, 10
       call     CORINFO_HELP_NEWARR_1_VC
       mov      eax, dword ptr [rax+0x10]
       add      rsp, 8
       ret

Note the call to CORINFO_HELP_NEWARR_1_VC to allocate x on the heap, indicating it was marked as escaping. Thanks to dotnet/runtime #113977, the JIT will no longer mark objects referenced by local struct fields as escaping, so long as the struct in question does not escape. The assembly now looks like this:

Program:Main():int (FullOpts):
       sub      rsp, 56
       vxorps   xmm8, xmm8, xmm8
       vmovdqu  ymmword ptr [rsp], ymm8
       vmovdqa  xmmword ptr [rsp+0x20], xmm8
       xor      eax, eax
       mov      qword ptr [rsp+0x30], rax
       mov      rax, 0x7F9FC16F8CC8      ; int[]
       mov      qword ptr [rsp], rax
       lea      rax, [rsp]
       mov      dword ptr [rax+0x08], 10
       lea      rax, [rsp]
       mov      eax, dword ptr [rax+0x10]
       add      rsp, 56
       ret

Note the heap allocation helper call is gone. To learn more about de-abstraction improvements planned for .NET 10, check out dotnet/runtime #108913.

Inlining Improvements

Preview 4 brings multiple enhancements to the JIT's inliner:

  • dotnet/runtime #112998 enabled inlining of some methods with exception handling semantics, in particular those with try-finally blocks.
  • Because the above change increased the number of candidate inlinees, the inliner started exhausting its budget more frequently. dotnet/runtime #114191 addressed this by doubling the inliner's time constraints
  • To better take advantage of the JIT's ability to stack-allocate some arrays, dotnet/runtime #114806 adjusted the inliner's heuristics to increase the profitability of candidates that might be returning small, fixed-sized arrays.
  • When the JIT decides a call site is not profitable for inlining, it marks the method with NoInlining to save future inlining attempts from considering it, reducing compile times. However, many inlining heuristics are sensitive to profile data. For example, the JIT might decide a method is too large to be worth inlining in the absence of profile data, whereas when the caller is sufficiently hot, the JIT might be willing to relax its size restriction and inline the call. With dotnet/runtime #114821, the JIT will no longer flag unprofitable inlinees with NoInlining to avoid pessimizing call sites with profile data.

The above changes correspond with hundreds of microbenchmark improvements, frequently unblocking the de-abstraction capabilities introduced in earlier Previews.