Debugging blazor client side app


Debugging in blazor

Blazor supports full debugging in blazor server side. But, if you work with client-side you still have the opportunity to debug your code. At the writing moment, there is only early support of debugging blazor webassembly apps and there are some limitations.

  • Only int, string and bool type variables are observable
  • Classes and their properties and fields are not observable
  • Hover to observe is not working
  • Execute code expressions in the console is not working
  • Step into async methods is not working

Anyway, debugging allows to set and remove breakpoins, observe local variables of int, string and bool types. Also you can see call stack including when js call .net and vise versa.

Prerequisites

  • You need chrome +70 version

How to

1.NOTE. The debugger works only for Http. Https in not working

  1. Run your app
  2. Open your client app in chrome
  3. Press Shift+Alt+D. You get the following message debug blazor in browser

  4. Follow instructions
  5. Open a new instance of chrome as the instruction says
  6. Press Shift+Alt+D again
  7. New page will be open debug blazor in browser

  8. Go to the Sources tab. In the left side, goto page and find your code in file://
  9. Set breakpoint

Conclusion

You have ability to debug your code, observe variables and analyze call stack. It is not fully featured, however, it is more than nothing.

Buy Me A Coffee

Related Posts

Avoid reflections of mappers and let Mapster generate mappers for you

Mapster generating tool for onion application

Predict Bitcoin price with ML.net

Live time series coin price predictor with machine learning

Throw exceptions from backend to frontend with blazor

One of advantages of using same code language on both frontend and backend

How to avoid violating of SOLID principles while extending service behaviours

Step by step extending service behaviour with decorator pattern respecting SOLID

Blazor render optimization

Best practices

.Net 6 brings application state to blazor webassembly server prerender

It kills strange blinking on screen

Must have libraries for blazor

List of best nuget packages

Blazor virtualize component

Lazy loading of big lists. Rendering optimization.

Blazor grpc - comunication optimization

Smaller and faster requests to your backend from blazor wasm

Free database for your blazor app

Don't pay for the cloud