Stay Connected

The easy way to lose weight
Visual Studio 2019 version 16.10 Release Notes

Visual Studio 2019 version 16.10 Release Notes

  • August 07, 2021
  • by

For original article click here

  • 06/15/2021

Welcome to the 16.10 release of Visual Studio 2019. There’s a number of new features in this version that we hope you like, a few key highlights include:

To see all the new features in this release keep scrolling or use the buttons below to jump to the section that interests you.

Keep up to date with Visual Studio you can follow us on our blog, YouTube, and on Twitter.

Tip

Want to try out features and fixes as soon as possible? Try out Visual Studio 2022 Preview for the latest features and fixes. Visual Studio 2022 preview is free to use for evaluating Visual Studio 2022 in non-production environments.

Fixed issues by each update to 16.10:

.NET updates

Remove unused references

We added a Remove Unused References command that allows you to clean up project references and NuGet packages that have no usage. This option is off by default so you will need to enable it in Tools > Options > Text Editor > C# > Advanced and select Show “remove Unused References” command in Solution Explorer (experimental). Once the option is enabled the Remove Unused References command will appear in the right-click menu of a project name or dependencies node in Solution Explorer:

Remove Unused References command

Selecting Remove Unused References will open a dialog where you can view all references that are going to be removed with an option to preserve the ones that you want to keep:

Remove Unused References dialog

Smart break line

We added a new command called Smart Break Line that automatically inserts a set of braces and places the caret within those braces when using Shift+Enter as a commit character. Smart Break Line works for all type declarations that require braces as well as properties, events, fields, and object creation expressions. The example below shows Smart Break Line used on a class and a field. If the field doesn’t have a semicolon at the end, typing Shift+Enter will convert the field to a property by adding a set of braces. You can press Shift+Enter again to undo the commit which will also automatically add a semicolon at the end of the field:

Smart Break Line

Simplify LINQ expressions

There is now a refactoring to simplify LINQ expressions which will remove the unnecessary call to the Enumerable for the .Where() method to help improve performance and readability. Place your cursor on the LINQ expression. Press (Ctrl+.) to trigger the Quick Actions and Refactorings menu. Select Simplify LINQ expression.

Simplify LINQ Expression

Enum IntelliSense

There is now IntelliSense completion for Enum values when a type is known even if the Enum name is not entered.

IntelliSense completion for Enum values

Customize IntelliSense completion

We added a new IntelliSense completion mode setting that gives you the ability to set default completion options. This new setting is available in Tools > Options > Text Editor > Advanced > Default IntelliSense completion mode where you can choose from the following options: Last used which will preserve the last setting you used with Ctrl+Alt+Space, Tab-only which will only complete on tab, and Automatic which is currently the default behavior that will complete on punctuation and special characters.

IntelliSense completion mode setting

New line code style preferences

We added new code style preferences for new lines. You can configure these preferences with an EditorConfig file or within Tools > Options > Text Editor > C# > Code Style > New line preferences (experimental).

Code style options for new lines

For example, you can set your code style preference to report a diagnostic and offer a code fix to remove extra blank lines:

Code fix remove extra blank lines

Find all references for source generators

There is now Find All References support for Source Generators that allows you to find references in a source generated document.

Insert arguments completion

There is now a completion option that automatically inserts arguments when writing a method call. This feature is off by default so you will need to enable it in Tools > Options > Text Editor > C# > IntelliSense and select Tab twice to insert arguments (experimental). Start writing a method call and press tab twice (tab+tab). Notice that the method call includes arguments based on the method’s default values. You can then use parameter info to cycle through the list of arguments that you would like inserted by pressing the up and down arrow keys. You can also start typing an argument to bring up the IntelliSense completion list and type semicolon which will commit the argument and add a semicolon to the end of the method call.

Method call argument completion

UI for editor.config

We created a UI for EditorConfig. Open any C# or Visual Basic EditorConfig file from your solution. Notice that the new UI will open displaying code style and code quality configuration option for both C# and Visual Basic.

EditorConfig UI

Option to show inheritance chain

There is now a visual representation for navigating and inspecting the inheritance chain. This option is off by default so you will need to turn it on in Tools > Options > Text Editor > C# > Advanced and select Show inheritance margin. Enabling inheritance margin will add new icons to the margins representing your code’s implementations and overrides. Clicking on the inheritance margin icon will display inheritance options that you can select to navigate to.

Inheritance Margin Icons

IntelliSense for casts, indexers, and operators

There is now IntelliSense completion for casts, indexers, and operators.

IntelliSense completion for casts, indexers, and operators

Debugger support for source generators

There is now debugger support for Source Generators. You will first need to install the .NET Compiler Platform SDK component from the Visual Studio Installer. You will then need to add the true property to your your project file. Next, enable the ‘Roslyn Component’ debugger option in the Project Properties Debug page and select the appropriate target project. Next, press F5 on the generator project which will start the CSC.exe/VBC.exe that builds the target project allowing you to debug the generator code.

Source Generator debugger Source Generator debugger target project

Edit and continue improvements

In this release we also added the following enhancements to the Edit and Continue (EnC) debugging experience in Visual Studio:

  • It is now possible to apply changes in code that is within a partial class.
  • You can now apply changes within a Source Generated) file.
  • It is now possible to add and/or change a using directive.
  • Improvements in reliability and lower memory consumption.

All three changes are available anywhere where edit and continue is supported today and work with both C# and Visual Basic source files.

ASP.NET Core updates

Razor preview editor improvements

The new preview Razor editor now supports the following Razor editing features:

  • IntelliSense completion now filters for HTML components, TagHelper elements, and C# attributes:

Razor IntelliSense filters

  • IntelliSense completion for C# overrides.
  • Go to Definition support for generic components.
  • New code style configuration options for tabs vs spaces. These code styles will be respected when typing, formatting, and creating a new Razor file. You can configure tabs and spaces in Tools > Options > Text Editor > Razor (ASP.NET Core) > Tabs.
  • The Razor text editor in Tools Options has been renamed from ASP.NET Core Razor Language Services to Razor (ASP.NET Core).

To enable the new preview Razor editor, go to Tools > Options > Environment > Preview Features, select Enable experimental Razor editor, and then restart Visual Studio.

Dynamic configuration allows for configuration resources to be refreshed automatically using a middleware. App Configuration as a Connected Service can now automatically integrate dynamic configuration into your application. To use this connected service, click on Connected Services and add Azure App Configuration as a Service Dependency.

C++ updates

Nothing to see here.

Test tool updates

Cross platform test from dotnet CLI

You can now get cross-platform code coverage at the command-line on Ubuntu and Alpine with the dotnet cli. For users interested in getting code coverage on machines targeting those platforms you can now add the same code coverage collection commands that you’d normally use on windows. See more documentation for dotnet test. There is now an expand all button next to the collapse all button in the Test Explorer. This command has been available through keyboard shortcuts (Ctrl+A, Ctrl+ right arrow), but more feedback indicated adding a button was worth the additional UI. As always, thank you for letting us know what you think via https://developercommunity.visualstudio.com/.

Improved indication of persisted test results

There are also some slight changes to how the Test Explorer shows “staleness.” “Staleness” is the grayed out or “faded” test results that indicate the result was not from the latest test run. If a result is not a part of the most recent test run it will appear as stale. Previously, new test discoveries (or even old test results that were rediscovered) were also shown with solid icons. This caused some confusion on why some ‘Not Run’ tests were faded and why others were not. This change will reduce the complexity of staleness. With the persisted test results feature (added in version 16.2) you can see test results from the last test run even if you’ve closed and re-opened Visual Studio. This helps users remember where they left off and gives more context without requiring another test run. We also modified the behavior of persisted results so they will always appear stale. This better indicates that they were not from a test run that executed during the current Visual Studio session.

Persisted test results from last Visual Studio session appear faded

Test experience accessibility improvements

Console.WriteLine now shows in the Test Explorer! Long output appears as a collapsible section in the test detail summary pane. Output over a certain length displays the first several lines and is then truncated with an option to open the test log in a separate window. The stacktrace truncates if there are over 20 frames and will then only show the first and last 10 frames. An important part of the truncation design was also focused on reducing VS freezes when test runs have large output. Tests that have large output will no longer block the UI thread.

Test output includes Console.Writeline

Test output can now preserve tags so hyperlinks and stacktrace links are navigable even from the log files. These links are now keyboard friendly as well.

Test output preserves hyperlinks and stacktraces Test logs also preserve hyperlinks and stacktraces

Automatic splitting of large log files

Log files are created for a single test result when output is over 300 characters or if there are over 10 files attached to the test result. Log files can also now open in preview so it’s easier to manage your tabs. Log files and the Test Explorer support Ctrl PgUp/PgDn for navigating the cursor and Shift+Ctrl PgUp/PgDn for selection.

Test logs are easier to select with keyboard shortcuts

Log file editor using VS editor

The log file editor is now using the IVsTextView interface which means it will now be able to open very large text files. This should eliminate the need for users to Copy All truncated logs and open them in a separate editor such as Notepad. For MSTest, we now also include a single log file that aggregates all the output instead of only having individual log files for each data row.

Windows tools

Following up on last year’s work to enable NuGet package references in the Windows Application Packaging Project (WAP), we have enabled a new UI in the WAP’s Solution Explorer experience. The old experience didn’t show these package references or allow you to add NuGet packages via the UI.

WAP Project Old User Interface

In the new experience, with the help of CPS and the .NET Project System, we have enabled a “Dependencies Tree” that continues to display project references via the “Applications” subtree, but also features a “Packages” subtree that will allow you to manage NuGet packages as well.

WAP Project New User Interface

XAML tools

In this release we’ve made two small improvements to XAML IntelliSense and XAML Hot Reload for Xamarin.Forms customers. Hot Reload “change only” will no longer report false errors for:

Setters in VisualStateManager referencing properties without specifying type, e.g. . Merged ResourceDictionaries not wrapped into element

Example: