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

  • Hands On: New VS Code Insiders Build Creates Web Page from Image in Seconds

    New Vision support with GitHub Copilot in the latest Visual Studio Code Insiders build takes a user-supplied mockup image and creates a web page from it in seconds, handling all the HTML and CSS.

  • Naive Bayes Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the naive Bayes regression technique, where the goal is to predict a single numeric value. Compared to other machine learning regression techniques, naive Bayes regression is usually less accurate, but is simple, easy to implement and customize, works on both large and small datasets, is highly interpretable, and doesn't require tuning any hyperparameters.

  • VS Code Copilot Previews New GPT-4o AI Code Completion Model

    The 4o upgrade includes additional training on more than 275,000 high-quality public repositories in over 30 popular programming languages, said Microsoft-owned GitHub, which created the original "AI pair programmer" years ago.

  • Microsoft's Rust Embrace Continues with Azure SDK Beta

    "Rust's strong type system and ownership model help prevent common programming errors such as null pointer dereferencing and buffer overflows, leading to more secure and stable code."

  • Xcode IDE from Microsoft Archrival Apple Gets Copilot AI

    Just after expanding the reach of its Copilot AI coding assistant to the open-source Eclipse IDE, Microsoft showcased how it's going even further, providing details about a preview version for the Xcode IDE from archrival Apple.

Subscribe on YouTube

Upcoming Training Events