News

Blazor WebAssembly Marches On to GA: Now Debug from Visual Studio, VS Code

Planning for a May 2020 debut of client-side Blazor, Microsoft released preview 3 of Blazor WebAssembly 3.2, which lets developers debug projects from Visual Studio or Visual Studio Code rather than browser-based development tools.

The client-side started out using the then-experimental WebAssembly for compilation of C# code so it can be used in browser/web development and ran into problems, so it has lagged behind the server-side effort (Blazor Server shipped with .NET Core 3.1 in December 2019) as Microsoft seeks to unity the whole ecosystem with .NET 5, coming in November.

To prepare for that huge milestone, the company has issued a series of previews in which Blazor WebAssembly gets loads of new features and functionality, and debugging support is a big step.

"You can now debug Blazor WebAssembly apps directly from Visual Studio and Visual Studio Code," said Daniel Roth, principal program manager, ASP.NET, in a March 26 blog post. "You can set breakpoints, inspect locals, and step through your code. You can also simultaneously debug your Blazor WebAssembly app and any .NET code running on the server. Using the browser dev tools to debug your Blazor WebAssembly apps is also still supported."

Roth provides instructions on how to first enable such debugging with a tweak to the launchSettings.json settings, along with how to get started in Visual Studio and VS Code.

Note that with this initial support, many debugging features are missing:

  • Inspecting arrays
  • Hovering to inspect members
  • Step debugging into or out of managed code
  • Full support for inspecting value types
  • Breaking on unhandled exceptions
  • Hitting breakpoints during app startup
  • Debugging an app with a service worker

The third preview also sports several other new features, including:

  • Auto-rebuild in Visual Studio: Auto-rebuild support for Blazor WebAssembly projects and Razor Class Libraries comes with Visual Studio 2019 16.6, which monitors file changes in .cs and .razor files and automatically rebuilds and restarts the app so the changes can be seen by simply refreshing the browser. So developers no longer need to manually rebuild and restart an app when making code changes, just refresh the browser.
  • Configuration: Developers can now load configuration data from appsettings.json and environment-specific configuration data from appsettings.{environment}.json.
  • New HttpClient extension methods for JSON handling: These will replace existing helper methods in the Microsoft.AspNetCore.Blazor.HttpClient package, using System.Text.Json for JSON serialization and deserialization. Even though the Blazor WebAssembly template doesn't use them by default yet, developers can leverage them by tweak that include substituting one package for another.

About the Author

David Ramel is an editor and writer at Converge 360.

comments powered by Disqus

Featured

  • Microsoft Revamps Fledgling AutoGen Framework for Agentic AI

    Only at v0.4, Microsoft's AutoGen framework for agentic AI -- the hottest new trend in AI development -- has already undergone a complete revamp, going to an asynchronous, event-driven architecture.

  • IDE Irony: Coding Errors Cause 'Critical' Vulnerability in Visual Studio

    In a larger-than-normal Patch Tuesday, Microsoft warned of a "critical" vulnerability in Visual Studio that should be fixed immediately if automatic patching isn't enabled, ironically caused by coding errors.

  • Building Blazor Applications

    A trio of Blazor experts will conduct a full-day workshop for devs to learn everything about the tech a a March developer conference in Las Vegas keynoted by Microsoft execs and featuring many Microsoft devs.

  • Gradient Boosting Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the gradient boosting regression technique, where the goal is to predict a single numeric value. Compared to existing library implementations of gradient boosting regression, a from-scratch implementation allows much easier customization and integration with other .NET systems.

  • Microsoft Execs to Tackle AI and Cloud in Dev Conference Keynotes

    AI unsurprisingly is all over keynotes that Microsoft execs will helm to kick off the Visual Studio Live! developer conference in Las Vegas, March 10-14, which the company described as "a must-attend event."

Subscribe on YouTube