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 for Converge360.

comments powered by Disqus

Featured

  • Full Stack Hands-On Development with .NET

    In the fast-paced realm of modern software development, proficiency across a full stack of technologies is not just beneficial, it's essential. Microsoft has an entire stack of open source development components in its .NET platform (formerly known as .NET Core) that can be used to build an end-to-end set of applications.

  • .NET-Centric Uno Platform Debuts 'Single Project' for 9 Targets

    "We've reduced the complexity of project files and eliminated the need for explicit NuGet package references, separate project libraries, or 'shared' projects."

  • Creating Reactive Applications in .NET

    In modern applications, data is being retrieved in asynchronous, real-time streams, as traditional pull requests where the clients asks for data from the server are becoming a thing of the past.

  • AI for GitHub Collaboration? Maybe Not So Much

    No doubt GitHub Copilot has been a boon for developers, but AI might not be the best tool for collaboration, according to developers weighing in on a recent social media post from the GitHub team.

  • Visual Studio 2022 Getting VS Code 'Command Palette' Equivalent

    As any Visual Studio Code user knows, the editor's command palette is a powerful tool for getting things done quickly, without having to navigate through menus and dialogs. Now, we learn how an equivalent is coming for Microsoft's flagship Visual Studio IDE, invoked by the same familiar Ctrl+Shift+P keyboard shortcut.

Subscribe on YouTube