Ahead of its Build developer event next week, Microsoft has pushed out a new preview of the forthcoming .NET 8, as well as a new long-term support release of its Visual Studio IDE.
Program manager Daniel Roth this week posted about a bunch of updates to ASP.NET Core, the .NET web application framework – prompting a discussion about whether ASP.NET Core is heading down the right path.
New in this preview is streaming rendering in Blazor applications, which renders components with placeholder content for quick page load, and then loads the actual content asynchronously and updates the user interface. Another new Blazor feature is Webcil, a “web-friendly packaging of .NET assemblies that removes any content specific to native Windows execution to avoid issues when deploying to environments that block the download or use of .dll files,” said Roth.
Perhaps the biggest change in this ASP.NET preview though is a new method called MapIdentityApi<TUser>(). This will enable developers to use JSON API endpoints for user registration and login, whereas previously ASP.NET Identity required Razor pages, causing problems for developers building single page applications or non-browser applications.
Beyond ASP.NET Core, the new .NET preview has an updated MSBuild utility which now has more intelligent console output, enabled using the /tl switch, including a build summary showing diagnostics. “We hope to use this logger as the foundation for a new batch of UX improvements for MSBuild,” said principal program manager Jon Douglas
Another change is new warnings when using the Nuget package manager via the dotnet command, which will now report on known vulnerabilities. “When you restore your packages through dotnet restore, you will see warnings for each affected package and advisory,” said Douglas.
A new abstract TimeProvider class will be useful for time mocking in test scenarios. Testing time-related code can be tricky, but it will now be possible to simulate time more easily to expose issues such as those involving time zones or daylight saving.
Microsoft has made further progress with optimizing ahead of time compilation for .NET. A Hello World console application is now 1.20 MB by default or 1.07 MB if optimized for size. “The above is the size of a fully self-contained application that includes the runtime (including GC) and all necessary class libraries,” said Douglas. That is impressive; by contrast, the new standalone option for bun executables creates a 90 MB executable.
The required version of glibc on Linux is being updated for .NET 8. “.NET 8 is built targeting Ubuntu 16.04, for all architectures … .NET 8 will fail to start on distro versions that include an older glibc, such as Ubuntu 14.04 or Red Hat Enterprise Linux 7,” said Douglas.
“Is there any plan for adding NativeAOT for WPF or WinUI 3/WASDK ?” asked a developer. “Not in the near future,” said program manager Sam Spencer, the reason being that “each workload/library will need to be updated to not depend on dynamic capabilities to be useable with native AOT. The XAML UI stacks are inherently very dynamic and involve extensive use of reflection.” According to Spencer, Microsoft is “taking a more rigorous approach in the Native AOT project than was taken in .NET Native, so that if your project published without errors for Native AOT, then it should not fail at runtime due to missing dependencies.” .NET Native references an earlier native compilation project from Microsoft.
Visual Studio 17.6, which is a long-term support release, includes Arm64 support for .NET MAUI, improved all-in-one search that covers code as well as IDE features, brace pair colorization and sticky scroll in the editor. Sticky scroll means that namespaces, classes, and methods will stick to the top of the editor, so devs can see the context of the code they are working on.
Performance when loading large projects is improved, with an example being the code for Chromium, the open source web browser, which is a solution comprised of around 11,000 projects. “Cached project load of the full Chromium solution is 8x faster, which translates to saving 3.5 minutes of Solution Load,” said group product manager Marian Luparu.