Visual Studio 2022 and .NET 6
Improvements
Visual Studio 2022 released this past Monday (11/8/2021) includes several improvement specifically for VB developers. Additionally, there are improvements that VB developers get to take advantage of in .NET 6. These improvements are documented elsewhere, so I’ll add my comments regarding these new features here…
Support for C# init
Properties
At the top of the list of underlying language improvements is the ability to fully support (consume) C# init
properties. This is very useful as this provides full support for consuming libraries authored by C# developers that leverage the C# Records feature. The addition of this has increased the underlying Visual Basic language version to 16.9.
Roslyn Source Generators
Although the article linked below doesn’t mention much in relation to Visual Basic related to the importance of Source Generators, let me share that this is possibly one of the most important improvements to Visual Basic. I can also confirm that the ASP.NET Core team has taken the time to rebuild their “home-grown” source generation by leveraging C# Source Generators which confirms what I’ve been suspecting/hoping. By having a common way for doing code generation, it is very possible that it will be a lot “simpler” (or at the very least more possible) to add support for Visual Basic where that support is limited due to “code generation” (typically) being the primary reason for why it isn’t being done.
Visual Studio 2022
Debugging
The addition of Temporary Breakpoints is a very welcomed feature. This gives you the ability to set a “one-time” breakpoint that is cleared upon it being hit. This saves us a lot of time by not having to continuously toggle breakpoints while debugging. Combine this with Conditional Breakpoints and Dependent Breakpoints; I think these may really help to improve debugging. With that said, I haven’t had a chance to take advantage of these other breakpoint options; but the Temporary Breakpoints have been immediately leveraged and they are nice.
Inheritance Margin
Having quick access to information where in the inheritance margin has been a huge timesaver when working with classes that heavily depend on inheritance.
Underline Reassigned
This feature takes unused variables to a whole new level. Additionally, being able to quickly see on the function declaration whether or not any of the variables passed into the method are reassigned is pretty helpful.
Inline Parameter Name Hints
I’ve been using this feature for a while now and although it takes a little getting used to, it is very nice to have the parameter name shown when working with the code as you have a clear understanding of what parameter is being mapped.
IntelliSense for Preprocessor Symbols
As we continue to progress forward in the land of cross-platform development, having better support for Preprocessor Directives is a huge help. You no longer have to go hunting for what preprocessor symbols are possibly available thanks to the IntelliSense support adding in VS2022.
Add Missing Imports On Paste
I’m not sure this feature brings anything to the table for my type of development; with that said, I do see that it might be beneficial for copy-and-paste developers.
Change Methods To Shared
There is now a refactoring tool for not only identifying that a routine doesn’t reference any outside variables but also includes a quick fix tool.
Generate Overrides Dialog
I don’t have much to say about this as yet as the opportunity to leverage it hasn’t arisen (at least not for me).
Simplify LINQ Expression
There are improvements made to the Simplify LINQ expression tool around Any versus Where making the expression “more efficient”.
WinForms
Not only is there full support for the Visual Basic Application Model in WinForms on .NET 6, we now have a new ApplyApplicationDefaults
event where (currently) can initialize the Font
, MinimumSplashScreenDisplayTime
and HighDpiMode
.
I should point out that if you were working with WinForms in .NET 5, the new event added has been removed.
.NET 6
Hot Reload
This is an evolution of Edit and Continue and, for the most part, just continues to provide what we as Visual Basic developers have come to expect. What is very cool is the breadth of scope that the feature is being embraced; when they say everywhere, it does indeed seem to be taken to being supported “everywhere”.
Upgrade Assistant
The .NET 6 Upgrade Assistant now includes support for Visual Basic.
See here for the official announcements that also include screen shots / videos of some of these new capabilities.