|Visual Basic 16.9 Support In .NET 5|
|Written by Kay Ewbank|
|Monday, 10 May 2021|
Visual Basic support in .NET 5 has been updated, and Visual Basic 16.9 is now supported, along with the ability to use Windows Forms. Microsoft is still firm in its stance that the Visual Basic language won't get new language features, but Kathleen Dollard Program Manager at Microsoft working on .NET Core CLI and Languages, says that Microsoft is definitely investing in VB.
Earlier versions of .NET Core lacked support for various features of Visual Basic, offering only support for Class Library and Console applications types.
With .NET 5, Visual Basic developers can use the Class Library, Console, Windows Forms, WPF, Worker Service, and ASP.NET Core Web API.
At the time they announced these features would be supported, Microsoft said that:
"Going forward, we do not plan to evolve Visual Basic as a language. This supports language stability and maintains compatibility between the .NET Core and .NET Framework versions of Visual Basic. Future features of .NET Core that require language changes may not be supported in Visual Basic."
Despite these warnings, Microsoft is making features available within .NET 5, including much improved Windows Forms designer support.
Dollard acknowledged that in .NET 3.1, Windows Forms designer worked badly for Visual Basic, largely because the designer was mainly aimed at C#, and VB's event syntax is radically different. The designer has now been overhauled and works correctly with VB.
A second improvement is to the Application Framework, something Klaus Loffelman said is needed if Microsoft is to see a bigger migration wave to .NET. The Application Framework provides VB devs with easy access to resources, managing aspects such as user settings and authentication. It was a major benefit for Visual Basic when Windows Forms first appeared, but until now hasn't been available in .NET Core. The support in VB 16.9 in .NET has now been improved and handles aspects such as modern UI appearance on high DPI systems.
Visual Basic 16.9 now has support for Default Interface Methods as used in C#8. In C#, this feature can be used to add new methods to interfaces, and while Visual Basic won't be able to create new Default Interface Methods, VB apps will be able to consume them, so as Dollard says, if your app interoperates with a C# app that uses interface method, your app doesn't fail.
Source Generators are also supported for Visual Basic. When Source Generators were added for C#, they were described as allowing C# developers to inspect user code and generate new C# source files that can be added to a compilation. The new support for Visual Basic adds the ability to have code that can be created at compile time and added to the compilation.
or email your comment to: email@example.com