February 11th, 2025

What’s New for C++ Developers in Visual Studio 2022 17.13

Sy Brand
C++ Developer Advocate

We are happy to announce that Visual Studio 2022 version 17.13 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 and Compiler

On the compiler side, we’ve implemented C++23’s size_t literal suffix. The suffix uz or UZ (or any permutation of these) will help you avoid sneaky truncations or signed comparison mismatches, especially when writing loops. For example:

//Infinite loop if v.size > max unsigned int
for (auto i = 0u; i < v.size(); ++i) {
    //Use v and v[i]
}

//Fine due to uz literal
for (auto i = 0uz; i < v.size(); ++i) {
    //Use v and v[i]
}

Note that, while this feature is available in our MSVC compiler, it is not yet supported in the EDG compiler that powers IntelliSense, so you may see red squiggles in your editor until support is added.

For all of the compiler improvements shipped in VS 2022 17.13, see MSVC Compiler Updates in Visual Studio 2022 version 17.13.

Our standard library has too many improvements to list in this blog post, so check out the changelog for all the details. Thanks to everyone in the community who contributed to this release! I’ve picked out some highlights below.

The feature I’m most excited about is std::generator. This brings some long-awaited standard library support for coroutines. A little example from the paper:

std::generator<int> fib() {
    auto a = 0, b = 1;
    while (true) {
        co_yield std::exchange(a, std::exchange(b, a + b));
    }
}

int answer_to_the_universe() {
    auto rng = fib() | std::views::drop(6) | std::views::take(3);
    return std::ranges::fold_left(std::move(rng), 0, std::plus{});
}

The fib function is a coroutine (because it uses the co_yield keyword). Whenever the co_yield statement is executed, fib is suspended and the value is returned to the caller. The fib coroutine can then be resumed later to produce more values, without requiring any manual state handling from the programmer. As you can see from the next function, std::generator is compatible with ranges, so we can pipe it into some range adaptors from the standard library.

Also in the area of conformance, we implemented two papers that improve the performance of std::print: P3107R5 and P3235R3.

We’ve improved the build throughput of <queue>, <stack>, <stacktrace>, and <thread> by not including all of <format>. For the same reason, we’ve moved system_clockhigh_resolution_clock, and chrono_literals from a commonly-included internal header to <chrono>. This has source-breaking impact. If you see compiler errors complaining that it doesn’t recognize chrono types like system_clock or UDLs like 1729ms, you need to include <chrono> specifically, instead of assuming that headers like <thread> will drag it in.

We have also continued our work in improving vectorization across the standard library. This release comes with improvements for the following types and functions:

  • (ranges::)find_end
  • basic_string::(r)find
  • adjacent_difference
  • bitset
  • basic_string::find_last_of
  • (ranges::)remove

C++ Productivity

Unreal Engine integration updates

We have made a series of updates for the Unreal Engine integration in Visual Studio:

  • We added two new options in Tools > Options that allow you to specify Code Analysis with Unreal Header Tool for both header and source files. To enhance performance, analysis of source files is disabled by default.
  • You can now specify Public and Private folders when using the Add Class wizard, ensuring that your classes are created in the correct folder structure.

If you want to learn more about the Visual Studio support for Unreal Engine, check out our Unreal Engine Overview page.

C++23 Preview Project Setting

You can now enable a preview of our C++23 implementation in Visual C++ directly from your project settings! This new setting unlocks access to the latest features we’ve implemented of the C++23 standard. As this is a preview of C++23 features, those new features will have limited support and may change in future releases.

A screenshot of a computer AI-generated content may be incorrect.

For more details and instructions, check out our documentation.

New Code Generation Property Page Settings for x86 and x64

Vector Length Property: Configure vector lengths for code generation on x86 and x64 directly in your C++ project settings by going to Configuration Properties > C/C++ > Code Generation.

A screenshot of a computer AI-generated content may be incorrect.

AVX10.1 Support: Unlock the power of AVX10.1 with a new entry in Enable Enhanced Instruction Set, adding the /arch:AVX10.1 flag to your builds.

A screenshot of a computer program AI-generated content may be incorrect.

Check out the documentation for details.

Support for CMake Presets v9

Visual Studio now supports CMake Presets v9. This latest version of CMake presets introduces several documented versions of macro expansions in the include field of a preset. Read more at the official CMake documentation.

Specify Linux timeout settings for C++

We have added support for specifying a minimum timeout period for your remote machines that you are connected to via the Connection Manager in Visual Studio. To learn more about adding a remote connection in Visual Studio, please see our C++ Linux documentation.

You can specify the timeout period in the Command Prompt in Visual Studio, using the new property MinTimeoutSeconds. For example, to set the timeout period to 1 minute, you can use the following command:

ConnectionManager modify <connection-id> --property MinTimeoutSeconds=60

General Productivity

Set Default File Encoding

Visual Studio now allows you to set the default file encoding for saving files. This feature ensures that your preferred encoding is used whenever possible.

To set the default encoding, navigate to Tools > Options > Environment > Documents. There, you will find an option titled Save files with the following encoding.

Horizontal Scrollbar Visibility Improvements

The horizontal scrollbar in the editor now repositions itself to always be accessible, even when space is limited. You can customize this behavior with the Tools > Options > Text Editor > Advanced > Editor horizontal scrollbar location option.

Word Wrap Indentation

You can now specify whether lines that wrap in the editor should be indented. Enable this with the Tools > Options > Text Editor > General > Automatically indent when word wrap is enabled option.

Recent Files in Code Search

When you open Code Search without a query, you’ll see a list of your recently navigated files. These include the files you opened through Code Search, but also any other files you opened in the solution. This makes it easy to jump back to a file you were recently working on without having to remember or type the file name.

A screen shot of a computer AI-generated content may be incorrect.

Enhanced Line and Column Navigation

In Code Search, we’ve significantly enhanced line navigation capabilities. The following formats are now supported:

  • :line to navigate to a specific line in the active document
  • :line,col to navigate to a specific line and column in the active document
  • file:line to navigate to a specific line in a specified file
  • file:line,col to navigate to a specific line and column in a specified file
  • file(line) to navigate to a specific line in a specified file
  • file(line,col) to navigate to a specific line and column in a specified file

A screenshot of a computer AI-generated content may be incorrect.

Debugging & Diagnostics

Targeted Instrumentation

The Visual Studio profiler’s instrumentation tool now supports targeted instrumentation for native code, allowing you to select specific classes and functions for detailed analysis.

To access this tool, select Debug > Performance Profiler… > Instrumentation.

A screenshot of a computer AI-generated content may be incorrect.

Color-Coded Swim Lanes for CPU Profiling

The Visual Studio profiler’s CPU Usage tool now supports multi-process analysis, displaying performance graphs with distinct color coding for each process in swim lanes.

The graphs are displayed as stacked area charts. You also have the option to filter processes using a dropdown on the top left, enabling focused analysis.

Git tooling

Add comments on pull requests

You can now add new comments to pull request files on the checked-out branch. This was a top request for the pull request experience and is the latest in a series of improvements to the pull request experience in Visual Studio.

Enable the feature flags Pull Request Comments and Pull Request Add Comment in Tools > Options > Environment > Preview Features, check out any branch with an active pull request, and select Show comments in files in the info bar. This will activate the pull request comments experience in the editor.

A screenshot of a computer AI-generated content may be incorrect.

Review Changes with Copilot

You can now request a code review from GitHub Copilot from the Git Changes window.

A screenshot of a computer AI-generated content may be incorrect.

The model will look for potential issues and create comments for them:

A screen shot of a computer AI-generated content may be incorrect.

To use this feature, ensure you have the following feature flags turned on:

  • Tools > Options > Preview Features > Pull Request Comments
  • Tools > Options > GitHub > Copilot > Source Control Integration > Enable Git preview features.

View and Manage Git Tags

You can now view and manage Git tags directly from the Git Repository window.

A screenshot of a computer AI-generated content may be incorrect.

IDE

Preserve Font Preferences Across Themes

Your font face and size choices are now retained when switching themes in Visual Studio. The colors of your fonts remain linked to the theme.

This feature is enabled by default. If you prefer the previous behavior, toggle the Tools > Manage Preview Features > Separate font settings from color theme selection option.

New Ways to Sign In With GitHub

You can now sign in to your GitHub account either from the first launch configuration dialog, or the “Sign in” button in Visual Studio.

Manage multiple GitHub accounts

You can now manage multiple GitHub accounts from Visual Studio. To do so, click Add another account in either the profile card menu accessible near the window controls of Visual Studio, or in File > Account Settings. If you have multiple GitHub accounts, Visual Studio will default to the one marked as active for GitHub-aware features, such as version control and GitHub Copilot.

A screenshot of a computer AI-generated content may be incorrect.

GitHub Copilot

GitHub Copilot Free

GitHub Copilot Free is now available. You get 2,000 code completions and 50 chat requests per month at no cost. Go to Microsoft Learn to find out all the details.

Better AI code completions for C++

GitHub Copilot code completions provide autocomplete suggestions inline as you code. To enhance the experience of C++ developers, we’ve updated GitHub Copilot to include other relevant files as context. This improvement helps reduce hallucinations while offering more relevant and accurate suggestions and is aligned with the current GitHub Copilot experience for C++ in VS Code.

GitHub Copilot Edits for Working Across Files

GitHub Copilot Edits is a new feature that helps make changes that touch multiple files in your project. To start a new Edits session, click the Create new edit session at the top of the GitHub Copilot Chat window:

A screenshot of a computer AI-generated content may be incorrect.

Describe the changes you want to make, and Copilot will suggest the relevant edits. You can then preview them one-by-one and accept the ones you want or make corrections.

A screenshot of a computer AI-generated content may be incorrect.

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 via email at visualcpp@microsoft.com.

 

Author

Sy Brand
C++ Developer Advocate

Sy Brand is Microsoft’s C++ Developer Advocate. Their background is in compilers and debuggers for embedded accelerators, but they’re also interested in generic library design, metaprogramming, functional-style C++, undefined behaviour, and making our communities more inclusive and welcoming.

0 comments