We are happy to announce that Visual Studio 2022 version 17.9 is now generally available! This post summarizes the new features you can find in this release for C++. You can download Visual Studio 2022 from the Visual Studio downloads page or upgrade your existing installation by following the Update Visual Studio Learn page.
Standard Library
We’re continuing to improve our open source standard library implementation. Thank you to everyone who has contributed features and fixes to this release! You can find the full set of changes at the STL changelog.
The main conformance highlight for this release is the implementation of the <mdspan>
header. This provides support for multi-dimensional views of data. You can read WG21 paper P0009R18 for details and the cppreference page for documentation on how to use it.
We’ve also made progress on the implementation of P2286 Formatting Ranges. This work will continue into version 17.10.
Outside of conformance, you’ll also find improved performance for some algorithms. For example, we optimized the copy()
, copy_n()
, and move()
algorithms for vector<bool>
iterators, with speedups varying from 1.8x (times, not percent) to 3200x (not a typo), depending on the size and alignment of the bits being copied.
Core Editor
AI Generated Git Commit Messages
Although developers frequently make Git commits, many often overlook the importance of writing meaningful commit messages. The new generated commit message feature is designed to assist you in describing your changes, ensuring clarity and relevance in your commits.
To get started, ensure you have an active GitHub Copilot subscription along with the preview GitHub Copilot Chat Extension installed. Simply click the ‘Add AI Generated Commit Message’ sparkle pen icon within the Git Changes window for a suggested commit message. GitHub Copilot analyzes your commit’s file changes, provides a summary, and then offers a descriptive message for each change. Choose to ‘Insert AI Suggestion’ or ‘Discard’ based on your preference. We welcome your feedback on this feature at this link. Additionally, the issue related to the icon’s appearance has been addressed; more information can be found here.
Open a Pull Request in Visual Studio or in the Browser
To support GitHub and Azure DevOps users who prefer to use the browser view for creating pull requests, we’ve added a secondary link to help maintain current user flows.
Responsive Ref Labels in the Git Repository Window
Your branch and tag labels now resize responsively to make it easier to see which branches you’re looking at in the Git graph.
Multi Project Configuration
Now, you can easily set up and save profiles for launching specific projects within a multi-project solution for streamlined debugging. Simplify working with complex solutions, enhance debugging efficiency, and effortlessly share configurations with your team.
Auto Surround with Quotes or Brackets
You can now easily surround a selection with bracket delimiters including: “double quotes”, ‘single quotes’, and (parentheses). Just select an area of code and press the relevant key.
To enable or disable this feature, go to Tools > Options > Text Editor and check the “Automatically surround selections when typing quotes or brackets” option.
Game Development
Streamlined Unreal Engine Blueprints References
Available gradually over the upcoming weeks, you will no longer need the Visual Studio Unreal Engine plugin to see Blueprint References, and Visual Studio will now display CodeLens hints with reduced latency and use fewer machine resources. Additionally, we have added support for including usages of UFUNCTIONs outside of the class hierarchy directly in the CodeLens results. We will cache your results from previous scans and only process new or modified assets since the last scan.
Improved IntelliSense for Unreal Engine projects
Unreal Engine uses its own reflection mechanism to connect the worlds of C++ and Blueprints. This is achieved through custom preprocessing of C++ sources with the Unreal Header Tool (UHT) and injection through the regular C++ preprocessor. We have improved the handling of Unreal Engine IntelliSense by ensuring consistency and accuracy. IntelliSense will now refresh more readily for UHT generated files, reducing the likelihood of displaying unwarranted errors.
Cross Platform
Remote Linux Unit Testing
Based on your feedback we have enabled running unit tests for remote Linux scenarios. Try it out with your C++ projects that target Linux on WSL or remote systems in the Test Explorer. Learn more about how the Azure Networking Team has used remote Linux in Visual Studio, including remote unit testing.
Specify custom CMake executable
Visual Studio ships with CMake bundled when you download the Desktop Development with C++ workload. However, you can now specify your own custom CMake executable on your machine if desired. Navigate to Tools > Options and select CMake > General. From here, you can check Enable custom CMake executable and specify the directory path of your CMake executable you wish to use.
Productivity
C++ Memory Layout Visualization
Based on your feedback we have added the Memory Layout feature. This feature enables visualization of the memory arrangements for your classes, structs, and unions directly within your editor, removing the need for compilation to view these layouts. When you hover over your types, a “Memory Layout” link will appear within the Quick Info. Clicking this link will open a dedicated window displaying the memory layout of the selected type. Furthermore, hovering over individual data types within this window will provide detailed information about their size and offset within the type.
#include Diagnostics
Visual Studio now introduces #include Diagnostics, which provides a detailed analysis of your #include directives by displaying their references and build time. Once you turn on this feature, the number of references will be displayed in CodeLens. From there, you can easily navigate to the list of references and locate each reference. To view the build time of your #include directives next to their references, you will need to run Build Insights by navigating to Build > Run Build Insights.
Send us your feedback
We are very much interested in your feedback to continue to improve this experience. The comments below are open. Feedback can also be shared through Visual Studio Developer Community. You can also reach us on Twitter (@VisualC), or via email at visualcpp@microsoft.com.
If you use Unreal, I’d suggest skipping this version, as it will probably fail to compile. See https://developercommunity.visualstudio.com/t/VS-2022-1790-Preview-10-__builtin_arr/10519788?sort=newest&ftype=problem
I get a lot of “Warning: IntelliSense is unable to provide an accurate memory layout.”
It would be nice if it could tell us why.
Hello, we value your input and would appreciate it if you could submit a feedback ticket on the Visual Studio Developer Community platform. This will allow our engineering team to review and address your concerns.
Indeed, that seems a fascinating feature. I would love to see how a std::atomic of a given type is aligned, for example. Being able to know when an atomic is not atomic (and using a hidden mutex) would also be useful.