Is ASP.NET on the right path? Microsoft .NET 8 preview prompts debate and Visual Studio 17.6 rolls out

Is ASP.NET on the right path? Microsoft .NET 8 preview prompts debate and Visual Studio 17.6 rolls out

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.

“I am so disappointed in the ASP.NET Core team these days,” said one developer “.NET 7/8 is all about Blazor and minimal APIs. Outside of MS I don’t see anybody using any of this. Blazor is for teams that don’t want to learn a real web-development framework. Angular/React/Vue are the client frameworks for web development.” This prompted the response from another: “I disagree that Blazor is for teams that don’t want to learn ‘real’ web-development frameworks. I’ve learnt them and have the scars from it. The Javascript ecosystem is a complete mess and has been for over a decade now.”

Roth responded that Blazor, which allows C# to be used for the front-end in the browser as well as on the server, “is now one of the fastest growing parts of the .NET platform.” He also noted that many developers use .NET on the server for an API, while implementing browser applications in the JavaScript/TypeScript framework of their choice. 

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. 

Despite its general availability, some early users have found problems with the new release. One reported that the editor is now unusable with JavaScript thanks to keystroke doubling while another said that one of their web projects would no longer load. Even with an LTS release, immediate adoption of a new Visual Studio appears to be risky.