Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Web Development with Blazor
  • Table Of Contents Toc
Web Development with Blazor

Web Development with Blazor - Fourth Edition

By : Jimmy Engström
close
close
Web Development with Blazor

Web Development with Blazor

By: Jimmy Engström

Overview of this book

Blazor has grown, and with that growth comes a simple question: How should we build Blazor apps today? This book answers that question by building a real application step by step. We start with what Blazor is, why it is not just WebAssembly, and how the different hosting models fit together. From there, we create components, manage state, build forms with validation, add APIs, secure the app with authentication and authorization, use JavaScript when it makes sense, and test our components with bUnit. We also look at the key aspects of modern Blazor development, including render modes, server-side rendering, WebAssembly, Aspire, OpenTelemetry, debugging, deployment, and how to work with existing sites when starting from scratch is not an option. The goal is not only to copy code but also to understand why we choose one approach over another. Should this be SSR, Server, WebAssembly, or Auto? Where should interactivity live? What changes when the code runs in the browser? We answer those questions without making things more complicated than they need to be. Whether you're new to Blazor or upgrading from an earlier edition, the fourth edition brings the book up to date with .NET 10, Aspire, tracing, metrics, testing, and modern Blazor app development. Own a raccoon cover already? The collection must continue. The raccoons insist.
Table of Contents (30 chapters)
close
close
Lock Free Chapter
1
Part 1: Getting Started with Blazor
6
Part 2: Building a Blazor Application
16
Part 3: Running Blazor with Confidence
21
Part 4: Going Beyond the Main Application
28
Other Books You May Enjoy
29
Index

Debugging Blazor Server

If you have debugged any .NET application in the past, you will feel right at home. Don't worry; we will go through it if you haven't. Debugging Blazor Server is just as we might expect and provides the best debugging experience of the three different types we will cover.

Let's give it a try!

  1. In the BlazorWebApp project, open Components/App.razor.
  2. Change the Routes component's render mode so it looks like this:
    <Routes @rendermode="InteractiveServer" />
  3. Press F5 to start the project.
  4. Using the web browser, navigate to /throwexception.
  5. Press F12 to show the web browser developer tools.
  6. In the developer tools, click Console.
  7. Click the Throw exception button on our page.

    We should now be able to see the exception message in the developer tools, as shown in Figure 14.1:

    Figure 14.1: Exception in the web browser

    Figure 14.1: Exception in the web browser

    Even though we get the error in the console in the web browser, it is a real C# error.

    This makes it quite easy to find...

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Web Development with Blazor
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist download Download options font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon