Microsoft releases Visual Studio 2022 version 17.2, the second supported long-term servicing channel for Visual Studio 2022. This version of Visual Studio will be supported with fixes and security updates for 18 months through January 2024. Visual Studio 2022 version 17.2 adds new improvements to the C# and .NET experiences, new Git performance and experiences, updates for C++ developers, and new Azure tools for local development and deployment.
Visual Studio 2022 17.2 adds Raw string literals to C# 11
"Raw string literal" support has been added to C# 11, which you can now use in Visual Studio 2022. To use the raw string literals, you need to set the C# language version in your project file to preview (using preview). Visual Studio 2022 version 17.2 will also allow you to quickly refactor a normal or verbatim string to a raw string.
Press the CTRL + . (period) keyboard shortcut on a normal or verbatim string to trigger the Quick Actions and Refactorings menu and then select ‘Convert to raw string’.
.NET Productivity Improvements
- There is a new change in the compiler to not allow parameterless constructors inside of structs. We added a new code fix that will automatically fix this.
- In .NET 7.0 we added a new attribute called the StringSyntaxAttribute which will allow you to tell us what kind of data a string represents such as JSON, Regex, or DateTime. We added support for this so you will get syntax highlighting in Visual Studio based on the type of data that the string represents.
- Double clicking on inline parameter or type hints will now insert parameter or type names.
- We added a new refactoring that removes unnecessary lambda expressions and calls the method group directly. Place your cursor on an unnecessary lambda. Press CTRL + . (period) to trigger the Quick Actions and Refactorings menu. Select Remove unnecessary lambda expression.
Git Tooling Improvements
- Enhanced line staging experience by allowing stage line adornment to work in different diff modes (side by side, inline, left, right view).
Stage and Undo commands in peek toolbar now operate on the target hunk.
- Added the ability to enable Git commit-graph for better history and Git operations performance.
- Improved interactive staging by adding support for staging individual lines of code right from the editor and the diff view.
- Enhanced the branch checkout experience, a.k.a branch switching by adding in more options and context for when there are un-committed changes.
- Enhanced the detached HEAD experience by providing the option to keep or discard commits when switching to a branch.
- Added an option to include license template when creating a new repository.
- Line-staging support, a.k.a interactive staging with the ability to stage specific lines and/or chunks of code right from the editor and the diff view.
- Azure DevOps connection detection enhancements making it easier to related work items to commits.
- Visual Studio now consumes 64-bit Git for Windows.
Web Tooling Improvements
- Creation of new Azure Function projects is now fully integrated into the general New Project dialog allowing you to pick and configure Azure Function triggers without the need for an additional dialog. You also get the option to create a dockerfile as part of the project creation. When further configuration through Connected Services is needed, the experience navigates you there and guides you through the rest of the steps.
- You can now connect your application to PostgreSQL (Postgres - Official Image | Docker Hub), MongoDB (Mongo - Official Image | Docker Hub) and SQLite (Data Source=Sqllite.db) through the Connected Services experience.
- Warnings coming from scaffolded coded and its non-nullable properties will be hidden by default by adding the property "Nullable" with the value "annotions" in the corresponding .csproj file.
- The Add Dependency dialog in Connected Services now features a search experience.
Debugging & Diagnostics Improvements
- IEnumerable visualizer will help explore larger collections objects in a more streamlined way in the tabular/ data grid view.It supports IEnumerable collections where T can be simple types or complex types like dictionaries, encapsulated.
- Whenever you have an IEnumerable code implementation, you will see a magnifying glass icon in the Value column of the Locals/ Watch window.You will also see the icon when you hover over a variable. Click the Icon, and you can access the IEnumerable visualizer.
- You can use Hide columns to Hide duplicate data or expand columns to see more profound items in the complex data. Finally, you can Hide Childrens to get a more concise view of your data.