{"id":235905,"date":"2021-12-15T11:00:42","date_gmt":"2021-12-15T19:00:42","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/visualstudio\/?p=235905"},"modified":"2021-12-27T16:10:36","modified_gmt":"2021-12-28T00:10:36","slug":"whats-new-in-net-productivity-with-visual-studio-2022","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/visualstudio\/whats-new-in-net-productivity-with-visual-studio-2022\/","title":{"rendered":"What\u2019s new in .NET Productivity with Visual Studio 2022"},"content":{"rendered":"<p>With the release of Visual Studio 2022 the Roslyn team continues to enhance your .NET developer productivity with the latest tooling improvements.<\/p>\n<p><div  class=\"d-flex justify-content-center\"><a class=\"cta_button_link btn-primary mb-24\" href=\"https:\/\/visualstudio.microsoft.com\/vs\/\" target=\"_blank\">Download Visual Studio 2022<\/a><\/div><\/p>\n<p>In this post I\u2019ll cover the following .NET productivity enhancements:<\/p>\n<ul>\n<li>Navigate to source code<\/li>\n<li>Stack Trace Explorer<\/li>\n<li>Naming Styles in the EditorConfig UI<\/li>\n<li>Sync namespaces from Solution Explorer<\/li>\n<li>IntelliSense completion for await<\/li>\n<li>New Code Fixes and Refactorings<\/li>\n<\/ul>\n<h3>Navigation and code exploration<\/h3>\n<p>Navigating and exploring code is an integral part of developer productivity. In Visual Studio 2022 we now surface embedded source and <a href=\"https:\/\/docs.microsoft.com\/dotnet\/standard\/library-guidance\/sourcelink\">Source Link<\/a> as part of Go To Definition. This allows you to navigate to original source files that declare the target symbol that isn&#8217;t in your current solution. Place your cursor on a symbol and press <strong>F12<\/strong> to navigate to the original source code.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/GTDSourceLink.gif\"><img decoding=\"async\" class=\"alignnone size-full wp-image-235930\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/GTDSourceLink.gif\" alt=\"Source Link Navigation\" width=\"1983\" height=\"1186\" \/><\/a><\/p>\n<p>A new Stack Trace Explorer Window displays stack traces allowing you to click and navigate directly to the related code. You can copy a stack trace from your solution and paste it into the Stack Trace Explorer window to get started. To open the Stack Trace Explorer window, go to <strong>View <\/strong>&gt; <strong>Other Windows<\/strong> and select <strong>Stack Trace Explorer<\/strong> or use the shortcut <strong>Ctrl+E<\/strong>, <strong>Ctrl+S<\/strong>.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/17.1_P2_stack_trace_explorer.gif\"><img decoding=\"async\" class=\"alignnone size-full wp-image-235914\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/17.1_P2_stack_trace_explorer.gif\" alt=\"Stack Trace Explorer\" width=\"1719\" height=\"911\" \/><\/a><\/p>\n<p>We added a new command called Value Tracking allowing you to perform data flow analysis on your code to help you quickly determine how certain values might have passed at a given point. Value Tracking is available on any member in the context (right-click) menu by selecting the <strong>Track Value Source<\/strong> command. The Track Value Source command will open the Value Tracking window allowing you to analyze results.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/Value-tracking.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-235918\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/Value-tracking.png\" alt=\"Value Tracking\" width=\"701\" height=\"204\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/Value-tracking.png 701w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/Value-tracking-300x87.png 300w\" sizes=\"(max-width: 701px) 100vw, 701px\" \/><\/a><\/p>\n<p>We added an option to underline variables that are reassigned. This is off by default so you will need to enable it in <strong>Tools<\/strong> &gt; <strong>Options <\/strong>&gt; <strong>Text Editor<\/strong> &gt; <strong>C#<\/strong> or <strong>Basic <\/strong>&gt; <strong>Advanced<\/strong> and select <strong>Underline reassigned variables<\/strong>. This helps reassigned variables stand out from other variables in the same local scope.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/reassigned-variables.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-235919\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/reassigned-variables.png\" alt=\"Underline reassigned variables\" width=\"606\" height=\"245\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/reassigned-variables.png 606w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/reassigned-variables-300x121.png 300w\" sizes=\"(max-width: 606px) 100vw, 606px\" \/><\/a><\/p>\n<p>The Code Definition Window now supports C# and Visual Basic allowing you to quickly understand and explore code. To use the Code Definition Window, select <strong>View <\/strong>&gt; <strong>Window <\/strong>&gt; <strong>Code Definition<\/strong>. Next, place your cursor on an identifier to navigate and explore code.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/code-definition-window2.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-235920\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/code-definition-window2.png\" alt=\"The Code Definition Window\" width=\"1881\" height=\"864\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/code-definition-window2.png 1881w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/code-definition-window2-300x138.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/code-definition-window2-1024x470.png 1024w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/code-definition-window2-768x353.png 768w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/code-definition-window2-1536x706.png 1536w\" sizes=\"(max-width: 1881px) 100vw, 1881px\" \/><\/a><\/p>\n<p>In C# 8.0 we introduced <a href=\"https:\/\/docs.microsoft.com\/dotnet\/csharp\/nullable-references\">nullable reference types<\/a> allowing you to declare whether null is expected. To use nullable reference types you either need to add the <strong>&lt;Nullable&gt;enable&lt;\/Nullable&gt;\u00a0<\/strong>element to your project file or add the <strong>#nullable enable<\/strong> pragma to every source file in your project. To help streamline this process we now automatically include the <strong>&lt;Nullable&gt;enable&lt;\/Nullable&gt;<\/strong> for new .NET projects. For existing .NET projects that target .NET Core 3.1 or newer, we offer a new refactoring to enable <a href=\"https:\/\/docs.microsoft.com\/dotnet\/csharp\/nullable-references\">nullable reference types<\/a> across a project. Place your cursor on a <strong>#nullable enable<\/strong> pragma and press (<strong>Ctrl+.<\/strong>) to trigger the <strong>Quick Actions and Refactorings<\/strong> menu. Select <strong>Enable nullable reference types in a project<\/strong>.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/17.1_P1_net_productivity_enable_nullable_refactoring.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-235921\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/17.1_P1_net_productivity_enable_nullable_refactoring.png\" alt=\"Enable nullable refactoring\" width=\"1013\" height=\"201\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/17.1_P1_net_productivity_enable_nullable_refactoring.png 1013w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/17.1_P1_net_productivity_enable_nullable_refactoring-300x60.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/17.1_P1_net_productivity_enable_nullable_refactoring-768x152.png 768w\" sizes=\"(max-width: 1013px) 100vw, 1013px\" \/><\/a><\/p>\n<h3>IntelliSense completion<\/h3>\n<p>IntelliSense is a code-completion aid that includes a number of features: List Members, Parameter Info, Quick Info, and Completion. We recently added IntelliSense completion for await within an awaitable expression. Start typing an awaitable expression and notice how await will now show up in the completion list.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/async-completion2.gif\"><img decoding=\"async\" class=\"alignnone size-full wp-image-235922\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/async-completion2.gif\" alt=\"Async completion\" width=\"695\" height=\"261\" \/><\/a><\/p>\n<p>If you want to learn more about recent additions to IntelliSense including AI helping you code, check out the <a href=\"https:\/\/docs.microsoft.com\/en-us\/visualstudio\/intellicode\/intellicode-visual-studio\">IntelliCode docs<\/a>.<\/p>\n<h3>Code fixes &amp; refactorings<\/h3>\n<p>Visual Studio provides hints to help you maintain and modify your code in the form of code fixes and refactorings. These appear as lightbulbs and screwdrivers next to your code or in the margin. The hints can resolve warnings and errors as well as provide suggestions. You can open these suggestions by typing (<strong>Ctrl+.<\/strong>) or by clicking on the lightbulb or screwdriver icons.<\/p>\n<p>You can check out the most popular refactorings that are built in to Visual Studio at https:\/\/aka.ms\/refactor. We\u2019ve added a bunch of new code fixes and refactorings in Visual Studio 2022! Here are some of our favorites.<\/p>\n<ul>\n<li>Introduce parameter<\/li>\n<li>File scoped namespace<\/li>\n<li>Use tuple to swap values<\/li>\n<li>Move static members<\/li>\n<li>Simplify property pattern<\/li>\n<li>Prefer null check over type check<\/li>\n<li>Sync namespaces<\/li>\n<\/ul>\n<p>The<strong> introduce parameter<\/strong> refactoring will move an expression from a method implementation to its callers by adding a new parameter.\u00a0Place your cursor on\u00a0the line containing the expression or highlight the expression.\u00a0Press (<strong>Ctrl+.<\/strong>) to trigger the\u00a0<strong>Quick Actions and\u00a0Refactorings\u00a0<\/strong>menu.\u00a0Select\u00a0<strong>Introduce\u00a0parameter for {0}<\/strong>\u00a0or\u00a0<strong>Introduce parameter for all occurrences of {0}<\/strong>.\u00a0Both options will have three flyout options to either (1) insert the updated expression at all the\u00a0call sites, (2) extract and create a new method that returns the expression and adds an argument at the\u00a0call sites, or (3) create an overload of the method that contains the expression and calls upon the original method.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/introduce-parameter.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-235923\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/introduce-parameter.png\" alt=\"Introduce parameter refactoring\" width=\"1347\" height=\"456\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/introduce-parameter.png 1347w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/introduce-parameter-300x102.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/introduce-parameter-1024x347.png 1024w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/introduce-parameter-768x260.png 768w\" sizes=\"(max-width: 1347px) 100vw, 1347px\" \/><\/a><\/p>\n<p>In C# 10.0 we introduced <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/csharp\/language-reference\/proposals\/csharp-10.0\/file-scoped-namespaces\">file-scoped namespace<\/a> so you no longer need to nest class definitions within a namespace. To use file-scoped namespace, make sure your project targets the .NET 6.0 SDK or you can set the language version in your project file to 10.0.\u00a0Place your cursor on a namespace. Press (<strong>Ctrl+.<\/strong>) to trigger the\u00a0<strong>Quick Actions and\u00a0Refactorings\u00a0<\/strong>menu.\u00a0Select <strong>Convert to file-scoped namespace<\/strong>.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/file-scoped-namespace-dark-theme.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-235924\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/file-scoped-namespace-dark-theme.png\" alt=\"File scoped namespace dark theme\" width=\"1224\" height=\"512\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/file-scoped-namespace-dark-theme.png 1224w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/file-scoped-namespace-dark-theme-300x125.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/file-scoped-namespace-dark-theme-1024x428.png 1024w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/file-scoped-namespace-dark-theme-768x321.png 768w\" sizes=\"(max-width: 1224px) 100vw, 1224px\" \/><\/a><\/p>\n<p>There is a new refactoring that detects variable swaps and suggests using a tuple to swap values instead of using a temporary variable in-order to swap arguments. Place your cursor on a temporary variable assignment where you are swapping values. Press (<strong>Ctrl+.<\/strong>) to trigger the <strong>Quick Actions and Refactorings<\/strong> menu. Select <strong>Use tuple to swap values<\/strong>.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/use-tuple-to-swap-values.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-235925\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/use-tuple-to-swap-values.png\" alt=\"Use tuple to swap values refactoring\" width=\"945\" height=\"417\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/use-tuple-to-swap-values.png 945w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/use-tuple-to-swap-values-300x132.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/use-tuple-to-swap-values-768x339.png 768w\" sizes=\"(max-width: 945px) 100vw, 945px\" \/><\/a><\/p>\n<p>You can more easily move static members to a new type. Place your cursor on a static member. Press (<strong>Ctrl+.<\/strong>) to trigger the <strong>Quick Actions and Refactorings<\/strong> menu. Select <strong>Move static members to another type<\/strong>. This will open a dialog where you can select the members that you would like to move.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/move-static-members.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-235926\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/move-static-members.png\" alt=\"Move static members to another type refactoring\" width=\"840\" height=\"223\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/move-static-members.png 840w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/move-static-members-300x80.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/move-static-members-768x204.png 768w\" sizes=\"(max-width: 840px) 100vw, 840px\" \/><\/a><\/p>\n<p>The simplify code to use the new C# 10.0 extended property patterns refactoring reduces noise allowing you to reference nested members instead of nesting another recursive pattern. Place your cursor on a nested member reference. Press (<strong>Ctrl+.<\/strong>) to trigger the\u00a0<strong>Quick Actions and\u00a0Refactorings<\/strong>\u00a0menu.\u00a0Select\u00a0<strong>Simplify property pattern<\/strong>.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/simplify-property-pattern.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-235927\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/simplify-property-pattern.png\" alt=\"Simplify property pattern refactoring\" width=\"1647\" height=\"445\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/simplify-property-pattern.png 1647w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/simplify-property-pattern-300x81.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/simplify-property-pattern-1024x277.png 1024w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/simplify-property-pattern-768x208.png 768w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/simplify-property-pattern-1536x415.png 1536w\" sizes=\"(max-width: 1647px) 100vw, 1647px\" \/><\/a><\/p>\n<p>There is now a refactoring to prefer <em>is not null<\/em> over <em>is object<\/em> when applied to value types. To use this new refactoring place your cursor on a type check. Press (<strong>Ctrl+.<\/strong>) to trigger the\u00a0<strong>Quick Actions and\u00a0Refactorings\u00a0<\/strong>menu.\u00a0Select <strong>Prefer &#8216;null&#8217; check over type check<\/strong>.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/prefer-is-null-over-is-object.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-235928\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/prefer-is-null-over-is-object.png\" alt=\"Prefer null check over type check refactoring\" width=\"972\" height=\"395\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/prefer-is-null-over-is-object.png 972w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/prefer-is-null-over-is-object-300x122.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/prefer-is-null-over-is-object-768x312.png 768w\" sizes=\"(max-width: 972px) 100vw, 972px\" \/><\/a><\/p>\n<p>You can also invoke code fixes and refactorings from the Solution Explorer (right-click) menu. One of our most popular refactorings is sync namespaces allowing you to synchronize namespaces to match your folder structure. The <strong>Sync Namespaces<\/strong> command is now available in the (right-click) menu of a project in Solution Explorer. Selecting Sync Namespaces will automatically synchronize namespaces to match your folder structure.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/sync-namespaces-dark.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-235929\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/sync-namespaces-dark.png\" alt=\"Sync namespaces refactoring\" width=\"948\" height=\"443\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/sync-namespaces-dark.png 948w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/sync-namespaces-dark-300x140.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/sync-namespaces-dark-768x359.png 768w\" sizes=\"(max-width: 948px) 100vw, 948px\" \/><\/a><\/p>\n<h3>Code style enforcement<\/h3>\n<p>Enforcing consistent code style is important as developer teams and their code bases grow. You can configure code styles with <a href=\"https:\/\/docs.microsoft.com\/visualstudio\/ide\/create-portable-custom-editor-options?view=vs-2022\">EditorConfig<\/a>! EditorConfig files help to keep your code consistent by defining code styles and formats. These files can live with your code in its repository and use the same source control. This way the style guidance is the same for everyone on your team who clones from that repository. With EditorConfig files you can enable or disable individual .NET coding conventions and configure the severity to which you want each rule enforced.<\/p>\n<p>In Visual Studio 2019 we introduced a new UI for EditorConfig\u00a0allowing you to easily view and configure every available .NET coding convention. In this release we added Naming Styles to the EditorConfig UI. Naming Styles allow you to enforce naming conventions in your code such as interfaces should always start with the letter \u201cI\u201d. To add an EditorConfig file to a project or solution:<span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<ul>\n<li>Right-click on the project or solution name within the Solution Explorer.<\/li>\n<li>Select <strong>Add New Item<\/strong>.<\/li>\n<li>In the <strong>Add New Item <\/strong>dialog, search for EditorConfig.<\/li>\n<li>Select the .NET EditorConfig template to add an EditorConfig file prepopulated with default options.<\/li>\n<\/ul>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/naming_styles-1.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-235932\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/naming_styles-1.png\" alt=\"Naming Styles\" width=\"1294\" height=\"1089\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/naming_styles-1.png 1294w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/naming_styles-1-300x252.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/naming_styles-1-1024x862.png 1024w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/12\/naming_styles-1-768x646.png 768w\" sizes=\"(max-width: 1294px) 100vw, 1294px\" \/><\/a><\/p>\n<p>You can also add a new EditorConfig file from the command line by typing <em><a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/core\/tools\/dotnet-new-sdk-templates#editorconfig\">dotnet new editorconfig.<\/a><\/em> To use <em>dotnet new editorconfig<\/em>\u00a0make sure your project targets the .NET 6.0 SDK or later. Next, open the Visual Studio integrated terminal by pressing (<strong>Ctrl+`<\/strong>). You can then run <em>dotnet new editorconfig<\/em> to add a new EditorConfig file to your project.<\/p>\n<h3>Thank you<\/h3>\n<p>Last, but certainly not least, a big Thank You to the following people who contributed to Roslyn. Ultimately, you&#8217;ve helped make Visual Studio 2022 awesome.<\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/AlFasGD\">AlFas (@AlFasGD)<\/a>: Fix unused Update parameter (PR <a href=\"https:\/\/github.com\/dotnet\/roslyn\/pull\/56741\">#56741<\/a>)<\/li>\n<li><a href=\"https:\/\/github.com\/svick\">Petr Onderka (@svick)<\/a>: Don&#8217;t suggest simplification for positional patterns (PR #<a href=\"https:\/\/github.com\/dotnet\/roslyn\/pull\/57676\">57676<\/a>)<\/li>\n<li><a href=\"https:\/\/github.com\/AdamSpeight2008\">Adam Speight (@AdamSpeight2008)<\/a>: Simplify the Lambda Functions (PR <a href=\"https:\/\/github.com\/dotnet\/roslyn\/pull\/51731\">#51731<\/a>)<\/li>\n<li><a href=\"https:\/\/github.com\/MaStr11\">Martin Strecker (@MaStr11<\/a>):\n<ul>\n<li>Provide quick info at #regionend showing #region message (PR <a href=\"https:\/\/github.com\/dotnet\/roslyn\/pull\/56609\">#56609<\/a>)<\/li>\n<li>Completion: Suggest &#8220;await&#8221; after dot of awaitable expression (PR <a href=\"https:\/\/github.com\/dotnet\/roslyn\/pull\/55817\">#55817<\/a>)<\/li>\n<li>Codefix for CS1591: Add inheritdoc (PR #<a href=\"https:\/\/github.com\/dotnet\/roslyn\/pull\/57004\">57004<\/a>)<\/li>\n<\/ul>\n<\/li>\n<li><a href=\"https:\/\/github.com\/Youssef1313\">Youssef Victor (@Youssef1313)<\/a>:\n<ul>\n<li>Remove redundant check in IsGlobalMain (PR <a href=\"https:\/\/github.com\/dotnet\/roslyn\/pull\/55395\">#55395<\/a>)<\/li>\n<li>Attempt to mark EqualityContract property accessor as not auto-implemented (PR #<a href=\"https:\/\/github.com\/dotnet\/roslyn\/pull\/57917\">57917<\/a>)<\/li>\n<li>Minor refactoring in SettingsUpdateHelper (PR #<a href=\"https:\/\/github.com\/dotnet\/roslyn\/pull\/55123\">55123<\/a>)<\/li>\n<li>Fix spacing when generating editorconfig options from UI (PR #<a href=\"https:\/\/github.com\/dotnet\/roslyn\/pull\/54601\">54601<\/a>)<\/li>\n<\/ul>\n<\/li>\n<li><a href=\"https:\/\/github.com\/pakrym\">Pavel Krymets (@pakrym)<\/a>: Do not normalize leading whitespace in code comments (PR #<a href=\"https:\/\/github.com\/dotnet\/roslyn\/pull\/57414\">57414<\/a>)<\/li>\n<li><a href=\"https:\/\/github.com\/KevRitchie\">Kev Ritchie (@KevRitchie)<\/a>: Update documentation to explain FullyQualifiedFormat behavior (PR #<a href=\"https:\/\/github.com\/dotnet\/roslyn\/pull\/57397)\">57397<\/a>)<\/li>\n<li><a href=\"https:\/\/github.com\/MarcioAB\">Marcio A Braga (@MarcioAB)<\/a>: Update TextSpan.cs (PR #<a href=\"https:\/\/github.com\/dotnet\/roslyn\/pull\/57300\">57300<\/a>)<\/li>\n<li><a href=\"https:\/\/github.com\/bernd5\">Bernd Baumanns (@bernd5)<\/a>: Fix for &#8220;Function pointer invocation has &#8220;None&#8221; IOperation&#8221; (PR #<a href=\"https:\/\/github.com\/dotnet\/roslyn\/pull\/57191\">57191<\/a>)<\/li>\n<li><a href=\"https:\/\/github.com\/paul1956\">Paul M Cohen (@paul1956)<\/a>: Initial fix for issue &#8220;VB Formatting of LineContinuation Wrong after _ &#8216; Comment&#8221; (PR #<a href=\"https:\/\/github.com\/dotnet\/roslyn\/pull\/54559\">54559<\/a>)<\/li>\n<li><a href=\"https:\/\/github.com\/panna-ahmed\">Saleh Ahmed Panna (@panna-ahmed)<\/a>: Localized missing warning message (PR #<a href=\"https:\/\/github.com\/dotnet\/roslyn\/pull\/57502)\">57502<\/a>)<\/li>\n<\/ul>\n<h3>Get involved<\/h3>\n<p>This was just a sneak peak of what\u2019s new in\u00a0<a href=\"https:\/\/visualstudio.microsoft.com\/vs\/\">Visual Studio 2022<\/a>. For a complete list of what\u2019s new, see the\u00a0<a href=\"https:\/\/docs.microsoft.com\/visualstudio\/releases\/2022\/release-notes\">release notes<\/a>. And feel free to provide feedback on the\u00a0<a href=\"https:\/\/developercommunity.visualstudio.com\/spaces\/8\/index.html\">Developer Community<\/a>\u00a0website, or using the\u00a0<a href=\"https:\/\/docs.microsoft.com\/visualstudio\/ide\/how-to-report-a-problem-with-visual-studio\">Report a Problem<\/a>\u00a0tool in Visual Studio.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>With the release of Visual Studio 2022 the Roslyn team continues to enhance your .NET developer productivity with the latest tooling improvements. In this post I\u2019ll cover the following .NET productivity enhancements: Navigate to source code Stack Trace Explorer Naming Styles in the EditorConfig UI Sync namespaces from Solution Explorer IntelliSense completion for await New [&hellip;]<\/p>\n","protected":false},"author":5818,"featured_media":228872,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[155],"tags":[],"class_list":["post-235905","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-visual-studio"],"acf":[],"blog_post_summary":"<p>With the release of Visual Studio 2022 the Roslyn team continues to enhance your .NET developer productivity with the latest tooling improvements. In this post I\u2019ll cover the following .NET productivity enhancements: Navigate to source code Stack Trace Explorer Naming Styles in the EditorConfig UI Sync namespaces from Solution Explorer IntelliSense completion for await New [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/235905","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/users\/5818"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/comments?post=235905"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/235905\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media\/228872"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media?parent=235905"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/categories?post=235905"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/tags?post=235905"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}