October 22, 2021

Uk News today – Up to date News, NHS, Health, Sport, Science

For the very latest UK news, with sport, health, science, covid

Microsoft .NET updates include C and C++ code in Blazor WebAssembly, release date for Visual Studio 2022

Microsoft .NET updates include C and C++ code in Blazor WebAssembly, release date for Visual Studio 2022
Microsoft has come up with its usual monthly splurge of .NET news, including the ability to compile native dependencies into Blazor WebAssembly, and a release date of 8 November for Visual Studio 2022. The .NET 6 wave – significant since it is a long-term support release – is close to release, with the launch expected…

Microsoft has come up with its usual monthly splurge of .NET news, including the ability to compile native dependencies into Blazor WebAssembly, and a release date of 8 November for Visual Studio 2022.

The .NET 6 wave – significant since it is a long-term support release – is close to release, with the launch expected at the online .NET Conf 2021 on 9-11 November. The date for Visual Studio 2022 is therefore no surprise. Not everything will be ready, though, in particular the cross-platform MAUI (Multi-platform App UI) framework, based on Xamarin technology, which is scheduled for an RC release in early 2022 and general availability in the second quarter of 2022. Preview 9 of MAUI is now out, with updated controls and graphics API (Microsoft.Maui.Graphics).

At this point in the release cycle new features give way to bug fixes, but a key new feature has arrived in the Blazor framework for browser applications. Principal program manager Daniel Roth described native dependencies for Blazor WebAssembly (Wasm) apps, which means that “any portable native code can be used as a native dependency.” This in turn means that C code, for example, can be called from C# code running in the browser. Both the C# and the C code will be compiled to Wasm so technically it may seem just a small step, but it is nicely wrapped to work in the same way as native code interop for C# on the server or desktop.

The new feature depends on a Visual Studio component called .NET WebAssembly build tools, which installs a bunch of stuff including the Emscripten compiler toolchain for C++ and C. The main limitation is that the code must be portable, though some other code (such as that using 64-bit int variables) may run slowly since JavaScript does not have a native 64-bit int type. Roth referenced the SkiaSharp 2D graphics library as an example, which wraps the native Skia graphics library and has preview support for Blazor WebAssembly.

A Blazor application can now include C and C++ code

A Blazor application can now include C and C++ code

We tried the new feature with a one-line C function and it worked. Although Blazor seems like a roundabout way to avoid writing JavaScript or TypeScript, it does have value for developers who would rather use C# both for server-side code and in a browser application. They can now also reuse C or C++ code, or reference .wasm code previously compiled with Emscripten.

Developers wishing to use the new Visual Studio can do so now with Microsoft’s go-live licence which applies to the release candidate. There is an oddity, though. Those who install the release candidate will automatically update to the release version next month, but the preview release of Visual Studio 2022 also continues, and will become Visual Studio 2022 17.1 preview 1, as corporate veep Amanda Silver explained. Those who want the latest features should therefore stick with the preview, though it is also possible to install them side by side.

A new release candidate of .NET 6 is also now on offer, again with a go-live licence. Program manager Richard Lander noted that Visual Studio 2019 will never work with .NET 6; developers will need to upgrade to Visual Studio 2022.

In his post he also described features of C# 10, which comes along with .NET 6. There are also some changes to the way .NET 6 supports macOS. Lander said that the Arm64 SDK, needed to support Apple Silicon, now enables both Arm64 and x64 development, and he recommends that developers therefore use only the Arm64 SDK. As soon as .NET 6 is released, the .NET 5 Arm64 SDK will go out of support so a quick change is being asked of developers using what is today the current release.

Despite the energy Microsoft is putting behind .NET 6, some corners of the platform are getting little attention. One is Windows Presentation Framework (WPF), liked by developers but considered non-strategic by the company.

“WPF templates have not been updated as part of the release,” said Roth without further explanation. One developer responded: “If you develop on desktop it’s getting hard to develop with .NET. Winforms looks too old, WPF is unofficial dead, WinUI too buggy… UWP too restricted. Xamarin too much focus on mobile and too resource heavy on desktop.”

Spelling out all those options for desktop development perhaps illustrates why Microsoft is not investing in all of them, yet there are plenty of developers of business applications who would rather see WPF and Windows Forms improved than dive into WinUI or MAUI. ®

Read More