Visual Studio 2022 has now been officially released alongside .NET 6, which it supports. It includes many new features and improvements, such as AI IntelliCode that can auto-complete chunks of code for you.
You can download the installer from their website. While it’s still new, it’s very much still Visual Studio, so unless you depend on extensions that haven’t been updated yet, don’t be afraid to give it a go.
We’ll cover the most important changes that we found, but if you want to read the line-by-line patch notes, you can do so from Microsoft’s docs. There’s also a roadmap describing the overall direction.
It’s Finally 64-bit
Visual Studio has always been 32-bit, which means it has been limited to 4 GB of RAM in the main process. It usually doesn’t go over this budget for normal projects, but some users can run into Out-Of-Memory exceptions with particularly large solutions.
With VS 2022, it’s fixed, and is now a 64 bit application. Microsoft has tested projects with 1600 projects and 300k files, and it works fine.
64-bit should theoretically run faster, and it does seem to be a bit faster in startup times, but Microsoft has also been working on performance in general, so it’s hard to tell how much this actually affects it. Either way, a good change.
Of course, you can still develop 32-bit applications with VS 2022. This only applies to the editor.
AI IntelliCode Is Amazing
Visual Studio 2022 features a serious upgrade to their IntelliCode auto-completion engine. It’s able to autocomplete entire lines and chunks of code, and it works very well.
It’s a bit different from GitHub’s Copilot, which does a similar job. Copilot will generate entire snippets of code, and works best for small, contained functions with a clear solution. It’s great, but it’s got its own problems, mostly the fact that the code it generates isn’t guaranteed to even be what you want (and can pull code word-for-word from random GitHub repos, which is another issue altogether).
IntelliCode takes a much more restricted approach, and simply completes a single line, taking into account some of the following factors:
- Variable names and positions
- Libraries you’re using
- Functions in the surrounding code
- The IntelliSense dropdown list, which you can actually tab down to give IntelliCode more suggestions
After using it for two weeks, it’s really something you have to try out for yourself. It’s shockingly smart, and many times while using it I found myself thinking “wow, I was just about to type that!”
For example, writing a function that takes a number from 1 to 12:
To understand and provide this result, IntelliCode is doing a lot more than just auto-completing syntax; It understands that I’m expecting an exception, pretty obvious given I’m typing “throw”, and it can figure out that this exception is only thrown if an integer size comparison fails. It knows that
Width is an argument being checked before the code runs, and that I’m throwing an exception because something is wrong with the argument.
Knowing all of this, it takes a wildly accurate guess at my intentions and decides that an
ArgumentOutOfRangeException must be what I’m trying to type, before I’m even able to start typing “new.”
And, if you page down, you can fill results for different options. It’s still a bit inconsistent (it decided to hardcode “Width” and then later used
nameof) but overall, it works well.
IntelliCode runs all the time, and all you have to do is press tab-tab to accept it, otherwise, you can continue typing. Currently, it only works for C#, but more languages are “coming soon.”
.NET 6 Support
.NET 6 is the latest release. VS 2022 has built-in support for it and all of its features, and defaults to .NET 6 for new projects.
Most notably, VS 2022 has full support for .NET MAUI, or Multi-platform App UI, Microsoft’s new standard for cross-platform native app development.
.NET Hot Reloading
It’s not completely universal, and requires a specific project setup, but VS 2022 includes hot reloading for “WPF, Windows Forms, .NET MAUI previews, ASP.NET Core apps code-behind, Console applications, WinUI 3, and many others.” This excludes class libraries used by another application.
Certain types of changes may not apply properly, which will prompt you to do a proper restart. You can view the full list of them here, but the gist of it is:
- No modifying method signatures
- No adding using statements
- No modifying interfaces
- No renaming members of any kind
Basically, you can edit the code in any method, but once you start touching the project structure, you may have to restart.
It’s integrated well into the VS debugging experience, with a new icon for “Apply Code Changes” that will trigger the hot reload. You can also use the new
dotnet watch command to hot reload automatically on file changes.
Razor/Blazor web applications can currently make use of hot reloading.
VS 2022 includes an experimental preview that allows you to run tests in other environments, including Linux containers, WSL, and even over SSH.
It’s got a bit of setup, and you will of course need to make sure your environment is configured to run your code properly, but once it is you’ll be able to select different environments when running your tests.
There’s a lot of small changes to break down from the patch notes, so we’ll list some of the most interesting ones here.
Debugging has seen some quality of life improvements, with new context options for more advanced breakpoints, as well as “Force Run To Cursor,” which will ignore all existing breakpoints and stop on the line of code you have selected. This can be very useful if you’d like to test something without removing every breakpoint, or manually skipping over everything again.
VS’s Git integrations now support multiple repositories per solution, and committing across many repos is now easier.
All the icons have been redesigned for consistency.
XML comments now support multi-line comments with preserved white space and CDATA blocks.
“Find all references” no longer produces garbage repeated output when in a multi-target project.
Razor Pages/Blazor have gotten numerous edit integrations, and will now work better with IntelliSense, syntax highlighting, and better formatting in @code blocks. You can now also use “View Code” in Razor files, which has been an annoying limitation for a while.
And there are a few more project templates, including ASP.NET Core hosted Angular and React applications, which can be made with API integrations automatically.
For the complete list of changes, you can refer to the VS 2022 release notes.
- › NZXT Signal 4K30 Capture Card Review: Lossless High-Quality Footage
- › A World Without Wires: 25 Years of Wi-Fi
- › What’s New in Windows 11’s 22H2 Update: Top 10 New Features
- › T-Mobile Is Selling Your App Activity: Here’s How to Opt Out
- › What Are the Best Nintendo Switch Games in 2022?
- › The 10 Best Netflix Original Movies in 2022