{"id":42724,"date":"2022-10-11T10:00:00","date_gmt":"2022-10-11T17:00:00","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/dotnet\/?p=42724"},"modified":"2022-10-31T11:14:52","modified_gmt":"2022-10-31T18:14:52","slug":"announcing-dotnet-7-rc-2","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/dotnet\/announcing-dotnet-7-rc-2\/","title":{"rendered":"Announcing .NET 7 Release Candidate 2"},"content":{"rendered":"<p>Today we announce .NET 7 Release Candidate 2. This is the final release candidate (RC) for .NET 7 and is supported in production.<\/p>\n<p>You can <a href=\"https:\/\/dotnet.microsoft.com\/download\/dotnet\/7.0\">download .NET 7 Release Candidate 2<\/a>, for Windows, macOS, and Linux.<\/p>\n<ul>\n<li><a href=\"https:\/\/dotnet.microsoft.com\/download\/dotnet\/7.0\">Installers and binaries<\/a><\/li>\n<li><a href=\"https:\/\/mcr.microsoft.com\/catalog?search=dotnet\/\">Container images<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/dotnet\/core\/blob\/master\/release-notes\/7.0\/\">Linux packages<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/dotnet\/core\/tree\/master\/release-notes\/7.0\">Release notes<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/dotnet\/core\/blob\/main\/release-notes\/7.0\/known-issues.md\">Known issues<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/dotnet\/core\/issues\">GitHub issue tracker<\/a><\/li>\n<\/ul>\n<p>.NET 7 Release Candidate 2 has been tested with Visual Studio 17.4 Preview 3. We recommend you use the <a href=\"https:\/\/visualstudio.com\/preview\">preview channel builds<\/a> if you want to try .NET 7 with Visual Studio family products. If you&#8217;re on macOS, we recommend using the latest <a href=\"https:\/\/visualstudio.microsoft.com\/vs\/mac\/preview\/\">Visual Studio 2022 for Mac preview<\/a>.<\/p>\n<p>Don&#8217;t forget about <a href=\"https:\/\/dotnetconf.net\">.NET Conf 2022<\/a>. Join us November 8-10, 2022 to celebrate the .NET 7 release!<\/p>\n<p>In this blog, we&#8217;ll highlight the core themes of .NET 7 and provide you with resources to dive deeper into the details.<\/p>\n<p>For a more detailed recap of all the features and improvements included in .NET 7 Release Candidate 2, check out the previous .NET 7 blog posts:<\/p>\n<ul>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/announcing-net-7-preview-1\/\">Announcing .NET 7 Preview 1<\/a><\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/announcing-dotnet-7-preview-2\/\">Announcing .NET 7 Preview 2<\/a><\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/announcing-dotnet-7-preview-3\/\">Announcing .NET 7 Preview 3<\/a><\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/announcing-dotnet-7-preview-4\/\">Announcing .NET 7 Preview 4<\/a><\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/announcing-dotnet-7-preview-5\/\">Announcing .NET 7 Preview 5<\/a><\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/announcing-dotnet-7-preview-6\/\">Announcing .NET 7 Preview 6<\/a><\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/announcing-dotnet-7-preview-7\/\">Announcing .NET 7 Preview 7<\/a><\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/announcing-dotnet-7-rc-1\/\">Announcing .NET 7 Release Candidate 1<\/a><\/li>\n<\/ul>\n<p><em>Note: Take a minute to re-visit the <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/announcing-dotnet-7-rc-1\/\">Announcing .NET 7 Release Candidate 1<\/a> blog as there was an omission of some exciting features that came in last minute.<\/em><\/p>\n<h2>C# 11<\/h2>\n<p>C# 11 is the latest version of C# that is now available in .NET 7.<\/p>\n<p>We design and develop C# in the open. You can join us on the <a href=\"https:\/\/github.com\/dotnet\/csharplang\">CSharpLang repo<\/a> to see the latest C# feature proposals and meeting notes. Once work is planned you can monitor progress through our <a href=\"https:\/\/github.com\/dotnet\/roslyn\/blob\/main\/docs\/Language%20Feature%20Status.md\">Feature Status page<\/a>. To learn more about C# 11, check out the following:<\/p>\n<ul>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/early-peek-at-csharp-11-features\/\">Early peek at C# 11 features<\/a><\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/csharp-11-preview-updates\/\">C# 11 Preview Updates &#8211; Raw string literals, UTF-8 and more!<\/a><\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/csharp-11-preview-august-update\/\">C# 11 preview: generic math, required members, and more<\/a><\/li>\n<li><a href=\"https:\/\/learn.microsoft.com\/dotnet\/csharp\/whats-new\/csharp-11\">What&#8217;s new in C# 11<\/a><\/li>\n<\/ul>\n<p><em>Note: To try out the C# 11 preview features, create a C# project and <a href=\"https:\/\/learn.microsoft.com\/dotnet\/csharp\/language-reference\/compiler-options\/language#langversion\">set the LangVersion to Preview<\/a>.<\/em><\/p>\n<h2>Libraries<\/h2>\n<p>The .NET libraries are constantly improving. New APIs containing brand new functionality is regularly added. Performance improvements are being made to existing APIs, providing you with benefits by simply upgrading. Completely new libraries are being made to assist your daily jobs-to-be-done. Many .NET library enhancements are included in these blogs, but don&#8217;t forget to also check out these library deep dives:<\/p>\n<ul>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/preview-features-in-net-6-generic-math\/\">Preview features in .NET 6 &#8211; Generic Math<\/a><\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/dotnet-7-generic-math\/\">.NET 7 Preview 5 &#8211; Generic Math<\/a><\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/regular-expression-improvements-in-dotnet-7\/\">Regular Expression Improvements in .NET 7<\/a><\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/announcing-rate-limiting-for-dotnet\/\">Announcing Rate Limiting for .NET<\/a><\/li>\n<\/ul>\n<h2>SDK<\/h2>\n<p>Each .NET release has a plethora of improvements to the .NET SDK which includes the core functionality to create, build, and manage your .NET projects. Many enhancements were already included in previous preview blogs that you can read up on. To read more about new SDK features, see the following:<\/p>\n<ul>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/announcing-builtin-container-support-for-the-dotnet-sdk\/\">Announcing built-in container support for the .NET SDK<\/a><\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/introducing-central-package-management\/\">Introducing Central Package Management<\/a><\/li>\n<\/ul>\n<h2>How to re-enable reflection fallback for System.Text.Json source generation<\/h2>\n<p>.NET 7 introduced an <a href=\"https:\/\/learn.microsoft.com\/dotnet\/core\/compatibility\/serialization\/7.0\/reflection-fallback\">intentional breaking change<\/a> which removes silent fallback to reflection-based serialization in System.Text.Json source generators. Based on early feedback we have been receiving from customers, it appears that quite a few users have (mostly accidentally) taken a dependency on the fallback behavior.<\/p>\n<p>Even though a workaround for the breaking change has been documented, it still requires a code change which might not be possible in certain cases. Starting in .NET 7 RC 2, you can re-enable reflection fallback globally using the provided AppContext compatibility switch. Add the following entry to your application&#8217;s project file to re-enable reflection fallback for all source-generated contexts in your app:<\/p>\n<pre><code class=\"language-xml\">&lt;ItemGroup&gt;\r\n  &lt;RuntimeHostConfigurationOption Include=\"System.Text.Json.Serialization.EnableSourceGenReflectionFallback\" Value=\"true\" \/&gt;\r\n&lt;\/ItemGroup&gt;<\/code><\/pre>\n<p>For more information on using AppContext switches, see the article on <a href=\"https:\/\/learn.microsoft.com\/dotnet\/core\/runtime-config\/\">.NET runtime configuration settings<\/a>.<\/p>\n<h2>New analyzers that help you consume APIs the right way<\/h2>\n<h3>Implement Generic Math interfaces correctly<\/h3>\n<p><a href=\"https:\/\/github.com\/dotnet\/runtime\/issues\/69775\">dotnet\/runtime #69775<\/a><\/p>\n<p>Ensures the .NET Generic Math interfaces that uses <a href=\"https:\/\/wikipedia.org\/wiki\/Curiously_recurring_template_pattern\">Curiously Recurring Template Pattern<\/a> (CRTP) are implemented correctly in user code. In particular it warns if a type that implements the .NET Generic Math interfaces (that implements CRTP pattern) do NOT fill the generic type parameter with the type itself.<\/p>\n<p>For example:<\/p>\n<pre><code class=\"language-csharp\">public readonly struct DateOnly : IParsable&lt;DateOnly&gt; \/\/ correct implementation of IParsable&lt;TSelf&gt; interface\r\n{ ... }\r\npublic readonly struct MyDate : IParsable&lt;DateOnly&gt; \/\/ Warns: \"The 'IParsable&lt;TSelf&gt;' requires the 'TSelf' type parameter to be filled with the derived type 'MyDate' \" the type parameter TSelf\r\n{ ... }<\/code><\/pre>\n<h3>Prevent behavioral change in built-in operators for IntPtr and UIntPtr<\/h3>\n<p><a href=\"https:\/\/github.com\/dotnet\/runtime\/issues\/74022\">dotnet\/runtime #74022<\/a><\/p>\n<p>Some built in operators added in .NET 7 for System.IntPtr and System.UIntPtr behave differently than the user defined operators in .NET 6 and below. Some operators that used to throw in unchecked context while overflowing now no longer throw unless wrapped within checked context, and some operators that not used to throw in checked context now would throw when overflow unless wrapped within unchecked context. The analyzer detects the code that could cause those behavioral changes and informs it.<\/p>\n<p>For example:<\/p>\n<pre><code class=\"language-csharp\">checked\r\n{\r\n    intPtr2 = intPtr1 + 2; \/\/ Warns: \"Starting with .NET 7 the operator '+' will throw when overflowing in a checked context. Wrap the expression with an 'unchecked' statement to restore the .NET 6 behavior.\"\r\n\r\n    intPtr2 = intPtr1 - 2; \/\/ Warns: \"Starting with .NET 7 the operator '-' will throw when overflowing in a checked context. Wrap the expression with an 'unchecked' statement to restore the .NET 6 behavior.\"\r\n\r\n    void* ptr = (void*)intPtr1; \/\/ Warns: \"Starting with .NET 7 the explicit conversion '(void*)IntPtr' will throw when overflowing in a checked context. Wrap the expression with an 'unchecked' statement to restore the .NET 6 behavior.\"\r\n\r\n    intPtr2 = (IntPtr)ptr; \/\/ Warns: \"Starting with .NET 7 the explicit conversion '(IntPtr)void*' will throw when overflowing in a checked context. Wrap the expression with an 'unchecked' statement to restore the .NET 6 behavior.\"\r\n}\r\n\r\nintPtr1 = (IntPtr)longValue; \/\/ Warns: \"Starting with .NET 7 the explicit conversion '(IntPtr)Int64' will not throw when overflowing in an unchecked context. Wrap the expression with a 'checked' statement to restore the .NET 6 behavior.\"\r\n\r\nint a = (int)intPtr1; \/\/ Warns: \"Starting with .NET 7 the explicit conversion '(Int32)IntPtr' will not throw when overflowing in an unchecked context. Wrap the expression with a 'checked' statement to restore the .NET 6 behavior.\"<\/code><\/pre>\n<h2>Contributor spotlight: Alan Hayward<\/h2>\n<p>A huge &#8220;Thank you&#8221; goes out to all our community members. We deeply appreciate your thoughtful contributions. We asked contributor <a href=\"https:\/\/github.com\/a74nh\">@a74nh<\/a> to share his thoughts.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2022\/10\/alanhayward.jpg\" alt=\"Alan Hayward\" \/><\/p>\n<p>In Alan&#8217;s own words:<\/p>\n<p>I&#8217;m Alan Hayward and I live just outside of Manchester in the UK.<\/p>\n<p>I&#8217;m fairly new to .NET and its ecosystem, but I&#8217;ve come from a long history of working on compilation like technologies. Early in my career I worked for a startup that produced a DBT called QuickTransit &#8211; more famously known as Apple&#8217;s Rosetta (back from when they moved from PPC to X86) &#8211; but I was more concerned with its less known applications across architectures: SPARC Solaris to X86\/Itanium\/PPC Linux and X86 Linux to MIPS\/PPC\/SPARC\/Z Linux, and probably a few more combinations now lost the the mists of time.<\/p>\n<p>In 2014 I joined Arm&#8217;s new Manchester UK office and worked on adding SVE support to GCC and GDB, then becoming the Arm\/AArch64 maintainer for GDB. Today I&#8217;m in Arm&#8217;s Runtimes team, which looks at the performance and security of popular cloud and desktop Runtimes. For a while I worked on OpenJDK and Graal, including adding support for Arm&#8217;s Pointer Authentication (PAC) security feature to protect control flow in OpenJDK.<\/p>\n<p>More recently I&#8217;ve been working with some of that team on .Net &#8211; getting us up to speed, improving some of the library routines with intrinsics, and adding an If Conversion pass to Ryujit. I&#8217;m excited to see what improvements to the Arm64 port we can add.<\/p>\n<p>What do I like about .Net? I love the simplicity of C# &#8211; you can get stuff done easily and quickly (everyone who can program, can program in C#). Similarly, the Jit itself is intuitive in the way it applies compiler techniques. Finally, a shoutout to SuperPMI &#8211; it&#8217;s is the tool I wish I had on previous projects, being able to quickly get diffs across test suites is amazing.<\/p>\n<p>When I&#8217;m not working, I can often be found with a small paintbrush trying to improve my miniature painting, listening to too many podcasts and audiobooks.<\/p>\n<p>I&#8217;m very happy to be on board and many thanks to those in the community I&#8217;ve interacted with up to now and hope to work with more of you over time.<\/p>\n<h2>Support<\/h2>\n<p>.NET 7 is released under <strong>Standard Support<\/strong>. Although this is the new name for what was formerly called <strong>Current<\/strong>, there is <em>no change<\/em> to the support duration. Odd-numbered .NET releases ship under <strong>Standard Support<\/strong> which lasts 18 months. There are no changes to the name or duration of <strong>Long-Term Support (LTS)<\/strong>, which still lasts for 36 months. See our <a href=\"https:\/\/dotnet.microsoft.com\/platform\/support\/policy\/dotnet-core\">.NET and .NET Core Support Lifecycle<\/a> document for more details.<\/p>\n<h2>Roadmaps<\/h2>\n<p>Releases of .NET include products, libraries, runtime, and tooling, and represent a collaboration across multiple teams inside and outside Microsoft. You can learn more about these areas by reading the product roadmaps:<\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/dotnet\/aspnetcore\/issues\/39504\">ASP.NET Core 7 and Blazor Roadmap<\/a><\/li>\n<li><a href=\"https:\/\/docs.microsoft.com\/ef\/core\/what-is-new\/ef-core-7.0\/plan\">EF 7 Roadmap<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/dotnet\/machinelearning\/blob\/main\/ROADMAP.md\">ML.NET<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/dotnet\/maui\/wiki\/Roadmap\">.NET MAUI<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/dotnet\/winforms\/blob\/main\/docs\/roadmap.md\">WinForms<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/dotnet\/wpf\/blob\/main\/roadmap.md\">WPF<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/NuGet\/Home\/issues\/11571\">NuGet<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/dotnet\/roslyn\/blob\/main\/docs\/Language%20Feature%20Status.md\">Roslyn<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/dotnet\/core\/blob\/main\/roadmap.md\">Runtime<\/a><\/li>\n<\/ul>\n<h2>Closing<\/h2>\n<p>We appreciate and <a href=\"https:\/\/dotnet.microsoft.com\/thanks\">thank you<\/a> for your all your support and contributions to .NET. Please <a href=\"https:\/\/dotnet.microsoft.com\/download\/dotnet\/7.0\">give .NET 7 Release Candidate 2 a try<\/a> and tell us what you think!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>.NET 7 Release Candidate 2 is the second of two release candidates that developers can now use in production. This post recaps major features included in the fastest .NET version to date.<\/p>\n","protected":false},"author":551,"featured_media":42725,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[685],"tags":[],"class_list":["post-42724","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dotnet"],"acf":[],"blog_post_summary":"<p>.NET 7 Release Candidate 2 is the second of two release candidates that developers can now use in production. This post recaps major features included in the fastest .NET version to date.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/42724","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/users\/551"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/comments?post=42724"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/42724\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media\/42725"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media?parent=42724"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/categories?post=42724"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/tags?post=42724"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}