Create an account


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ASP.NET Core Updates in .NET 5 Preview 7

#1
ASP.NET Core Updates in .NET 5 Preview 7

<div style="margin: 5px 5% 10px 5%;"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/07/asp-net-core-updates-in-net-5-preview-7.png" width="58" height="58" title="" alt="" /></div><div><div class="row justify-content-center">
<div class="col-md-4">
<div><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/07/asp-net-core-updates-in-net-5-preview-7.png" width="58" height="58" alt="Avatar" class="avatar avatar-58 wp-user-avatar wp-user-avatar-58 photo avatar-default"></p>
<p>Sourabh</p>
</div>
</div>
</div>
<div class="entry-meta">
<p>July 21st, 2020</p>
</p></div>
<p><!-- .entry-meta --> </p>
<p><a href="https://devblogs.microsoft.com/dotnet/announcing-net-5-0-preview7/">.NET 5 Preview 7 is now available</a> and is ready for evaluation. Here’s what’s new in this release:</p>
<ul>
<li>Blazor WebAssembly apps now target .NET 5</li>
<li>Updated debugging requirements for Blazor WebAssembly</li>
<li>Blazor accessibility improvements</li>
<li>Blazor performance improvements</li>
<li>Certificate authentication performance improvements</li>
<li>Sending HTTP/2 PING frames</li>
<li>Support for additional endpoints types in the Kestrel sockets transport</li>
<li>Custom header decoding in Kestrel</li>
<li>Other minor improvements</li>
</ul>
<h2>Get started</h2>
<p>To get started with ASP.NET Core in .NET 5 Preview 7 <a href="https://dotnet.microsoft.com/download/dotnet-core/5.0">install the .NET 5 SDK</a>.</p>
<p>You need to use <a href="https://visualstudio.microsoft.com/vs/preview/">Visual Studio 2019 16.7 Preview 5</a> or newer to use .NET 5 Preview 7. .NET 5 is also supported with the latest <a href="https://docs.microsoft.com/visualstudio/mac/install-preview">preview</a> of <a href="https://visualstudio.microsoft.com/">Visual Studio for Mac</a>. To use .NET 5 with <a href="https://visualstudio.microsoft.com/">Visual Studio Code</a>, install the latest version of the <a href="https://code.visualstudio.com/Docs/languages/csharp">C# extension</a>.</p>
<h2>Upgrade an existing project</h2>
<p>To upgrade an existing ASP.NET Core app from .NET 5 Preview 6 to .NET 5 Preview 7:</p>
<ul>
<li>Update all Microsoft.AspNetCore.* package references to <code>5.0.0-preview.7.*</code>.</li>
<li>Update all Microsoft.Extensions.* package references to <code>5.0.0-preview.7.*</code>.</li>
<li>Update System.Net.Http.Json package references to <code>5.0.0-preview.7.*</code>.</li>
</ul>
<p>See the full list of <a href="https://github.com/aspnet/announcements/issues?q=is%3Aopen+is%3Aissue+milestone%3A5.0+label%3A%22Breaking+change%22">breaking changes</a> in ASP.NET Core for .NET 5.</p>
<h3>Upgrade existing Blazor WebAssembly projects</h3>
<p>To upgrade an existing Blazor WebAssembly project, update the following properties:</p>
<p><strong>From</strong></p>
<pre><code class="xml">&lt;TargetFramework&gt;netstandard2.1&lt;/TargetFramework&gt;
&lt;RazorLangVersoin&gt;3.0&lt;/RazorLangVersion&gt;
</code></pre>
<p><strong>To</strong></p>
<pre><code class="xml">&lt;TargetFramework&gt;net5.0&lt;/TargetFramework&gt;
&lt;RuntimeIdentifier&gt;browser-wasm&lt;/RuntimeIdentifier&gt;
&lt;UseBlazorWebAssembly&gt;true&lt;/UseBlazorWebAssembly&gt;
</code></pre>
<p>Also, remove any package references to <code>Microsoft.AspNetCore.Components.WebAssembly.Build</code>, as it is no longer needed.</p>
<h2>What’s new?</h2>
<h3>Blazor WebAssembly apps now target .NET 5</h3>
<p>Blazor WebAssembly 3.2 apps have access only to the .NET Standard 2.1 API set. With this release, Blazor WebAssembly projects now target .NET 5 (<code>net5.0</code>) and have access to a much wider set of APIs. Implementing Blazor WebAssembly support for the APIs in .NET 5 is a work in progress, so some APIs may throw a <code>PlatformNotSupportedException</code> at runtime. We’d love to hear from you if you’re blocked by the lack of support for specific APIs.</p>
<h3>Updated debugging requirements for Blazor WebAssembly</h3>
<p>To enable debugging of Blazor WebAssembly apps in Visual Studio Code, you previously needed to install the <a href="https://marketplace.visualstudio.com/items?itemName=ms-vscode.js-debug-nightly">JavaScript Debugger (Nightly) extension</a>. This is no longer required as the <a href="https://github.com/microsoft/vscode-js-debug#nightly-extension">JavaScript debugger extension is now shipped as part of VS Code</a>. If you’ve previously installed the JavaScript Debugger (Nightly) extension you can now uninstall it. Enabling the preview version of the JavaScript debugger through the Visual Studio Code settings is still required.</p>
<h3>Blazor accessibility improvements</h3>
<p>The built-in Blazor input components that derive from <code>InputBase</code> now render <code>aria-invalid</code> automatically when the validation fails.</p>
<h3>Blazor performance improvements</h3>
<p>One of the major areas of investment for Blazor WebAssembly in .NET 5 is improving runtime performance. This is a multifaceted effort. Below are some of the high-level areas being optimized:</p>
<ul>
<li>.NET runtime execution</li>
<li>JSON serialization</li>
<li>JavaScript interop</li>
<li>Blazor component rendering</li>
</ul>
<p>Improving Blazor WebAssembly runtime performance for .NET 5 in an ongoing effort. This release contains some initial performance improvements, and we expect to share more details on the results of this performance work for future .NET 5 updates.</p>
<h3>Certificate authentication performance improvements</h3>
<p>We have added caching to certificate authentication in ASP.NET Core. Caching certificate validation significantly improves the performance of certificate authentication. Our benchmarks show a 400% improvement in requests per second once caching was enabled.</p>
<p>You don’t need to make any changes to your app to take advantage of performance improvements; caching is on by default. There are options to tune or disable caching if you wish.</p>
<p>Find out more about certificate authentication in ASP.NET Core <a href="https://docs.microsoft.com/aspnet/core/security/authentication/certauth">in the docs</a>.</p>
<h3>Sending HTTP/2 PING frames</h3>
<p>HTTP/2 has a mechanism for sending PING frames as a way of ensuring whether an idle connection is still functional. This is especially useful to have when working with long-lived streams that are often idle but only intermittently see activity (for example, gRPC streams). We have added the ability to send periodic PING frames in Kestrel by setting limits on <code>KestrelServerOptions</code>.</p>
<pre><code class="csharp">public static IHostBuilder CreateHostBuilder(string[] args) =&gt; Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults(webBuilder =&gt; { webBuilder.ConfigureKestrel(options =&gt; { options.Limits.Http2.KeepAlivePingInterval = TimeSpan.FromSeconds(10); options.Limits.Http2.KeepAlivePingTimeout = TimeSpan.FromSeconds(1); }); webBuilder.UseStartup&lt;Startup&gt;(); });
</code></pre>
<h3>Support for additional endpoints types in the Kestrel sockets transport</h3>
<p>Building upon new API introduced in <code>System.Net.Sockets</code>, the sockets transport (default) in Kestrel now allows you to bind to both existing file handles and unix domain sockets. Support for binding to existing file handles enables using the existing Systemd integration without requiring you to use the libuv transport.</p>
<h3>Custom header decoding in Kestrel</h3>
<p>We added the ability to specify which <code>System.Text.Encoding</code> to use to interpret incoming headers based on the header name instead of defaulting to UTF-8. You can set the <code>RequestHeaderEncodingSelector</code> property on <code>KestrelServerOptions</code> to specify which encoding to use.</p>
<pre><code class="csharp">public static IHostBuilder CreateHostBuilder(string[] args) =&gt; Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults(webBuilder =&gt; { webBuilder.ConfigureKestrel(options =&gt; { options.RequestHeaderEncodingSelector = encoding =&gt; { switch (encoding) { case "Host": return System.Text.Encoding.Latin1; default: return System.Text.Encoding.UTF8; } }; }); webBuilder.UseStartup&lt;Startup&gt;(); });
</code></pre>
<h3>Other improvements</h3>
<ul>
<li>For preview 7, we’ve started applying nullable annotations to ASP.NET Core assemblies. We intend on annotating most of the common public API surface of the framework during the 5.0 release.</li>
<li><code>CompareAttribute</code> can now be applied to properties on Razor Page model. </li>
<li>Parameters and properties bound from the body are considered required by default.</li>
<li>We’ve started applying nullable annotations to ASP.NET Core assemblies. We intend to annotate most of the common public API surface of the framework during the .NET 5 release.</li>
<li>Authorization when using endpoint routing now receives the <code>HttpContext</code> rather than the endpoint instance. This allows the authorization middleware to access the <code>RouteData</code> and other properties of the <code>HttpContext</code> that were not accessible though the <code>Endpoint</code> class. The endpoint can be fetched from the context using <code>context.GetEndpoint()</code>.</li>
<li>The default format for <code>System.Diagnostics.Activity</code> now defaults to the W3C format. This makes distributed tracing support in ASP.NET Core interoperable with more frameworks by default.</li>
<li><code>CompareAttribute</code> can now be applied to properties on a Razor Page model. </li>
<li>
<p><code>FromBodyAttribute</code> now supports configuring an option that allows these parameters or properties to be considered optional:</p>
<p><code>C#<br />
public IActionResult Post([FromBody(EmptyBodyBehavior = EmptyBodyBehavior.Allow)] MyModel model) { ... }</code></p>
</li>
</ul>
<h2>Give feedback</h2>
<p>We hope you enjoy this release of ASP.NET Core in .NET 5! We are eager to hear about your experiences with this latest .NET 5 release. Let us know what you think by filing issues on <a href="https://github.com/dotnet/aspnetcore/issues">GitHub</a>.</p>
<p>Thanks for trying out ASP.NET Core!</p>
</div>


https://www.sickgaming.net/blog/2020/07/...preview-7/
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum software by © MyBB Theme © iAndrew 2016