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

  • GitHub Previews Agentic AI in VS Code Copilot

    GitHub announced a raft of improvements to its Copilot AI in the Visual Studio Code editor, including a new "agent mode" in preview that lets developers use the AI technology to write code faster and more accurately.

  • Copilot Engineering in the Cloud with Azure and GitHub

    Who better to lead a full-day deep dive into this tech than two experts from GitHub, which introduced the original "AI pair programmer" and spawned the ubiquitous Copilot moniker?

  • Uno Platform Wants Microsoft to Improve .NET WebAssembly in Two Ways

    Uno Platform, a third-party dev tooling specialist that caters to .NET developers, published a report on the state of WebAssembly, addressing some shortcomings in the .NET implementation it would like to see Microsoft address.

  • Random Neighborhoods Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the random neighborhoods regression technique, where the goal is to predict a single numeric value. Compared to other ML regression techniques, advantages are that it can handle both large and small datasets, and the results are highly interpretable.

  • As Some Orgs Restrict DeepSeek AI Usage, Microsoft Offers Models and Dev Guidance

    While some organizations are restricting employee usage of the new open source DeepSeek AI from a Chinese company due to data collection concerns, Microsoft has taken a different approach.

Subscribe on YouTube

Upcoming Training Events