News

'Epic Fail': ASP.NET PM Struggles with Blazor Hot Reload in Live Demo

"Epic fail," commented a developer who this week tuned in to a livestreamed ASP.NET Community Standup event on "ASP.NET Core updates in .NET 6 Preview 3" in which Daniel Roth, principal program manager (the head guy) for ASP.NET, struggled with a Blazor Hot Reload demo.

For about four minutes, watched by hundreds if not thousands of developers, the good-natured Roth laughed, tweaked, restarted and repeatedly did the puzzled fingers-to-the-chin gesture in trying to diagnose the problem.

Roth and host Jon Galloway had been ploughing through new features for ASP.NET Core coming in .NET 6, scheduled to ship in November.

In the Blazor Hot Reload segment, Roth -- using Visual Studio Code -- demonstrated how code changes could be made with the results instantly reflected in a running app with the app's state preserved, using the familiar counter example. He showed how, using dotnet watch, certain types of code changes that didn't lend themselves to Hot Reload automatically defaulted to a restart, seamlessly keeping the workflow going.

It all worked swimmingly -- until it didn't.

Jon Galloway and Daniel Roth in Livestream Demo
[Click on image for larger view.] Jon Galloway and Daniel Roth in Livestream Demo (source: Microsoft).

In a sequence that might have provided some been-there-done-that cold comfort to hackers like me who get flummoxed by mysterious glitches all the time, Roth and Galloway struggled to identify the problem, which was finally fixed with some help from the audience.

The livestream went something like this when errors popped up instead of code changes:

Roth, after seeing some kind of file locked error and finally diving into Task Manager to manually kill some .NET processes: "no you don't need to do this ... [laughter]"

"let me try it one more time"

"no it's still not updating ... huh, that's interesting"

"for some reason we're still locked ... oh well ... is it cached? ... I don't know what's going on with it, like I restarted the app ... "

Galloway: "people are saying save the file"

"oh"

[more testing]

"why not just test on a livestream? [laughter] ..."

"unresponsive ... what is going on?"

"try it one more time"

"are we good now?"

"yeah I don't know what's going on here ... that's really weird"

Galloway: "it was working super beautifully for a while ... it's in the right directory and everything"

Galloway: "people are saying the counter was a blank file"

"oh is it? Oh snap!" [much laughter]

"well that's obviously why it's not a component anymore ... ok that's fine"

So, apparently, the contents of the counter file were overwritten at some point, with nothing.

The fun begins at about the 43-minute mark in the 1 hour and 19 minute video.

Modern Web Stack
[Click on image for larger view.] Modern Web Stack (source: Microsoft).

In addition to Blazor Hot Reload, a much-requested feature that is actually being rolled out across the entire .NET 6 framework, Roth demonstrated:

  • Inner-loop performance
  • Cloud native development
  • OpenTelemetry
  • Servers
  • Performance
  • MVC
  • Single page apps (SPA)
  • Blazor WebAssembly performance and more

"Now that we're up to .NET 5, ASP.NET Core is your modern web framework for .NET," Roth said. "It's got pretty much everything you need to build UI, to build back-end services. Under the hood, we've got a powerful and flexible hosting model. We've got high-performance servers with Kestrel and IIS and HTTP.sys. And of course we've got a rich set of built-in middleware that just comes out of the box. So a lot of great stuff. But of course, there's always room to make it better."

Regarding that last point, he referenced the ASP.NET Core Roadmap for .NET 6 that tracks development efforts, part of the Themes of .NET site that shows all efforts across the ecosystem.

Themes of .NET
[Click on image for larger view.] Themes of .NET (source: Microsoft).

Roth earlier this month penned a ASP.NET Core updates in .NET 6 Preview 3 post in which new features included:

  • Smaller SignalR, Blazor Server, and MessagePack scripts
  • Enable Redis profiling sessions
  • HTTP/3 endpoint TLS configuration
  • Initial .NET Hot Reload support
  • Razor compiler no longer produces a separate Views assembly
  • Shadow-copying in IIS
  • Vcpkg port for SignalR C++ client
  • Reduced memory footprint for idle TLS connections
  • Remove slabs from the SlabMemoryPool
  • BlazorWebView controls for WPF & Windows Forms
  • The post includes the infamous Blazor counter example.

    It worked just fine in animated GIFs.

    About the Author

    David Ramel is an editor and writer at Converge 360.

    comments powered by Disqus

    Featured

    • Compare New GitHub Copilot Free Plan for Visual Studio/VS Code to Paid Plans

      The free plan restricts the number of completions, chat requests and access to AI models, being suitable for occasional users and small projects.

    • Diving Deep into .NET MAUI

      Ever since someone figured out that fiddling bits results in source code, developers have sought one codebase for all types of apps on all platforms, with Microsoft's latest attempt to further that effort being .NET MAUI.

    • Copilot AI Boosts Abound in New VS Code v1.96

      Microsoft improved on its new "Copilot Edit" functionality in the latest release of Visual Studio Code, v1.96, its open-source based code editor that has become the most popular in the world according to many surveys.

    • AdaBoost Regression Using C#

      Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the AdaBoost.R2 algorithm for regression problems (where the goal is to predict a single numeric value). The implementation follows the original source research paper closely, so you can use it as a guide for customization for specific scenarios.

    • Versioning and Documenting ASP.NET Core Services

      Building an API with ASP.NET Core is only half the job. If your API is going to live more than one release cycle, you're going to need to version it. If you have other people building clients for it, you're going to need to document it.

    Subscribe on YouTube